[PATCH v2 2/4] cmd: fpga: Separating the support of fpga loads

Oleksandr Suvorov oleksandr.suvorov at foundries.io
Mon Nov 1 11:47:40 CET 2021


This patch allows enabling support of "fpga lodas command which loads
secure bitstreams (authenticated or encrypted, or both) independently
in SPL and in u-boot.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
---

(no changes since v1)

 cmd/Kconfig | 9 +++++++++
 cmd/fpga.c  | 8 ++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 270d1765d3..3702a022e6 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -956,6 +956,15 @@ config CMD_FPGA_LOAD_SECURE
 	  Enables the fpga loads command which is used to load secure
 	  (authenticated or encrypted or both) bitstreams on to FPGA.
 
+config CMD_SPL_FPGA_LOAD_SECURE
+	bool "fpga loads - loads secure bitstreams for SPL"
+	depends on CMD_FPGA && CMD_SPL
+	select SPL_FPGA_LOAD_SECURE
+	help
+	  Enables the fpga loads command which is used to load secure
+	  (authenticated or encrypted or both) bitstreams on to FPGA from
+	  SPL.
+
 config CMD_FPGAD
 	bool "fpgad - dump FPGA registers"
 	help
diff --git a/cmd/fpga.c b/cmd/fpga.c
index 3fdd0b35e8..9a14618660 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -67,7 +67,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
 	return 0;
 }
 
-#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+#if CONFIG_IS_ENABLED(CMD_FPGA_LOAD_SECURE)
 int do_fpga_loads(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	size_t data_size = 0;
@@ -382,7 +382,7 @@ static struct cmd_tbl fpga_commands[] = {
 #if defined(CONFIG_CMD_FPGA_LOADMK)
 	U_BOOT_CMD_MKENT(loadmk, 2, 1, do_fpga_loadmk, "", ""),
 #endif
-#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+#if CONFIG_IS_ENABLED(CMD_FPGA_LOAD_SECURE)
 	U_BOOT_CMD_MKENT(loads, 6, 1, do_fpga_loads, "", ""),
 #endif
 };
@@ -416,7 +416,7 @@ static int do_fpga_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
 	return cmd_process_error(fpga_cmd, ret);
 }
 
-#if defined(CONFIG_CMD_FPGA_LOADFS) || defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+#if defined(CONFIG_CMD_FPGA_LOADFS) || CONFIG_IS_ENABLED(CMD_FPGA_LOAD_SECURE)
 U_BOOT_CMD(fpga, 9, 1, do_fpga_wrapper,
 #else
 U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper,
@@ -451,7 +451,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper,
 	   "\tsubimage unit name in the form of addr:<subimg_uname>"
 #endif
 #endif
-#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+#if CONFIG_IS_ENABLED(CMD_FPGA_LOAD_SECURE)
 	   "Load encrypted bitstream (Xilinx only)\n"
 	   "  loads [dev] [address] [size] [auth-OCM-0/DDR-1/noauth-2]\n"
 	   "        [enc-devkey(0)/userkey(1)/nenc(2) [Userkey address]\n"
-- 
2.31.1



More information about the U-Boot mailing list