diff mbox series

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

Message ID 20211101104742.69908-3-oleksandr.suvorov@foundries.io
State Superseded
Delegated to: Michal Simek
Headers show
Series fpga: zynqmp: Adding support of loading authenticated images | expand

Commit Message

Oleksandr Suvorov Nov. 1, 2021, 10:47 a.m. UTC
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@foundries.io>
---

(no changes since v1)

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

Comments

Michal Simek Nov. 1, 2021, 11:54 a.m. UTC | #1
On 11/1/21 11:47, Oleksandr Suvorov wrote:
> 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@foundries.io>
> ---
> 
> (no changes since v1)
> 
>   cmd/Kconfig | 9 +++++++++
>   cmd/fpga.c  | 8 ++++----

SPL doesn't use commands that's why this is quite weird.

M
Oleksandr Suvorov Nov. 1, 2021, 5:04 p.m. UTC | #2
On Mon, Nov 1, 2021 at 1:54 PM Michal Simek <michal.simek@xilinx.com> wrote:
>
>
>
> On 11/1/21 11:47, Oleksandr Suvorov wrote:
> > 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@foundries.io>
> > ---
> >
> > (no changes since v1)
> >
> >   cmd/Kconfig | 9 +++++++++
> >   cmd/fpga.c  | 8 ++++----
>
> SPL doesn't use commands that's why this is quite weird.

Omg, thanks! That case when doing something weird using tough mind template :-D

>
> M
diff mbox series

Patch

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"