Re: [PATCH v6 2/7] fpga: sec-mgr: enable secure updates

From: Martin Hundebøll
Date: Thu Nov 19 2020 - 04:29:00 EST


Hi Russ,

Just stumbled upon the below when preparing to upstream some Silicom changes

On 06/11/2020 02.09, Russ Weight wrote:

<snip>

diff --git a/include/linux/fpga/fpga-sec-mgr.h b/include/linux/fpga/fpga-sec-mgr.h
index f85665b79b9d..e03de72134d6 100644
--- a/include/linux/fpga/fpga-sec-mgr.h
+++ b/include/linux/fpga/fpga-sec-mgr.h
@@ -7,16 +7,57 @@
#ifndef _LINUX_FPGA_SEC_MGR_H
#define _LINUX_FPGA_SEC_MGR_H
+#include <linux/completion.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/types.h>
struct fpga_sec_mgr;
+enum fpga_sec_err {
+ FPGA_SEC_ERR_NONE,
+ FPGA_SEC_ERR_HW_ERROR,
+ FPGA_SEC_ERR_TIMEOUT,
+ FPGA_SEC_ERR_CANCELED,
+ FPGA_SEC_ERR_BUSY,
+ FPGA_SEC_ERR_INVALID_SIZE,
+ FPGA_SEC_ERR_RW_ERROR,
+ FPGA_SEC_ERR_WEAROUT,
+ FPGA_SEC_ERR_FILE_READ,
+ FPGA_SEC_ERR_MAX
+};

<snip>

+
+/* Update progress codes */
+enum fpga_sec_prog {
+ FPGA_SEC_PROG_IDLE,
+ FPGA_SEC_PROG_READING,
+ FPGA_SEC_PROG_PREPARING,
+ FPGA_SEC_PROG_WRITING,
+ FPGA_SEC_PROG_PROGRAMMING,
+ FPGA_SEC_PROG_MAX
};

Shouldn't this enum and the fpga_sec_err above be indexed starting from 0, to make comparison with FPGA_SEC_ERR_MAX and

FPGA_SEC_PROG_MAX correct?

// Martin