[U-Boot][PATCH v2 0/3] Improve fpga cmd usage information

Current usage information is not read friendly specially when all the options are selected. This series fix some of the issues in the info, aligment and overlapping issues, excess of verbosity on the loads...
Additionally Xilinx exclusive command dependencies are included to remove text stating Xilinx Only
The output looks like this now:
fpga - loadable FPGA image support
Usage: fpga info [dev] List known device information fpga dump <dev> <address> <size> Load device to memory buffer fpga load <dev> <address> <size> Load device from memory buffer fpga loadb <dev> <address> <size> Load device from bitstream buffer fpga loadp <dev> <address> <size> Load device from memory buffer with partial bitstream fpga loadbp <dev> <address> <size> Load device from bitstream buffer with partial bitstream fpga loadfs <dev> <address> <size> <blocksize> <interface> [<dev[:part]>] <filename> Load device from filesystem (FAT by default) fpga loadmk <dev> <address> Load device generated with mkimage NOTE: loadmk operating on FIT must include subimage unit name in the form of addr:<subimg_uname> fpga loads <dev> <address> <size> <authflag> <encflag> [Userkey address] Load device from memory buffer with secure bistream (authenticated/encrypted/both) -authflag: 0 for OCM, 1 for DDR, 2 for no authentication (specifies where to perform authentication) -encflag: 0 for device key, 1 for user key, 2 for no encryption -Userkey address: address where user key is stored NOTE: secure bitstream has to be created using Xilinx bootgen tool
Changes in v2: - Tabs replaced by spaces - fpga command added on each option similar to other commands like sf - Dependencies to Xilinx only commands added in Kconfig
Ibai Erkiaga (3): fpga: fix alignment on fpga cmd usage info fpga: improve loads usage information fpga: xilinx exclusive commands info
cmd/Kconfig | 32 +++++++++++++++++++------------ cmd/fpga.c | 55 +++++++++++++++++++++-------------------------------- 2 files changed, 42 insertions(+), 45 deletions(-)

The current implementation generates some alignment issues as well as some overlapping when all the fpga command options are enabled. The fix is intended to improve readability of the usage info.
Signed-off-by: Ibai Erkiaga ibai.erkiaga-elorza@amd.com ---
Changes in v2: - Tabs replaced by spaces - fpga command added on each option similar to other commands like sf - Dependencies to Xilinx only commands added in Kconfig
cmd/fpga.c | 61 +++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 33 deletions(-)
diff --git a/cmd/fpga.c b/cmd/fpga.c index 93f14098ccb..ae85ff201b8 100644 --- a/cmd/fpga.c +++ b/cmd/fpga.c @@ -408,49 +408,44 @@ U_BOOT_CMD(fpga, 9, 1, do_fpga_wrapper, #else U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper, #endif - "loadable FPGA image support", - "[operation type] [device number] [image address] [image size]\n" - "fpga operations:\n" - " dump\t[dev] [address] [size]\tLoad device to memory buffer\n" - " info\t[dev]\t\t\tlist known device information\n" - " load\t[dev] [address] [size]\tLoad device from memory buffer\n" + "loadable FPGA image support", + "info [dev] List known device information\n" + "fpga dump <dev> <address> <size> Load device to memory buffer\n" + "fpga load <dev> <address> <size> Load device from memory buffer\n" #if defined(CONFIG_CMD_FPGA_LOADP) - " loadp\t[dev] [address] [size]\t" - "Load device from memory buffer with partial bitstream\n" + "fpga loadp <dev> <address> <size> Load device from memory buffer\n" + " with partial bitstream\n" #endif - " loadb\t[dev] [address] [size]\t" - "Load device from bitstream buffer (Xilinx only)\n" + "fpga loadb <dev> <address> <size> Load device from bitstream buffer\n" + " (Xilinx only)\n" #if defined(CONFIG_CMD_FPGA_LOADBP) - " loadbp\t[dev] [address] [size]\t" - "Load device from bitstream buffer with partial bitstream" - "(Xilinx only)\n" + "fpga loadbp <dev> <address> <size> Load device from bitstream buffer\n" + " with partial bitstream (Xilinx only)\n" #endif #if defined(CONFIG_CMD_FPGA_LOADFS) - "Load device from filesystem (FAT by default) (Xilinx only)\n" - " loadfs [dev] [address] [image size] [blocksize] <interface>\n" - " [<dev[:part]>] <filename>\n" + "fpga loadfs <dev> <address> <size> <blocksize> <interface> [<dev[:part]>] <filename>\n" + " Load device from filesystem (FAT by default) (Xilinx only)\n" #endif #if defined(CONFIG_CMD_FPGA_LOADMK) - " loadmk [dev] [address]\tLoad device generated with mkimage" + "fpga loadmk <dev> <address> Load device generated with mkimage\n" #if defined(CONFIG_FIT) - "\n" - "\tFor loadmk operating on FIT format uImage address must include\n" - "\tsubimage unit name in the form of addr:<subimg_uname>" + " NOTE: loadmk operating on FIT must include subimage unit\n" + " name in the form of addr:<subimg_uname>\n" #endif #endif #if defined(CONFIG_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" - "Loads the secure bistreams(authenticated/encrypted/both\n" - "authenticated and encrypted) of [size] from [address].\n" - "The auth-OCM/DDR flag specifies to perform authentication\n" - "in OCM or in DDR. 0 for OCM, 1 for DDR, 2 for no authentication.\n" - "The enc flag specifies which key to be used for decryption\n" - "0-device key, 1-user key, 2-no encryption.\n" - "The optional Userkey address specifies from which address key\n" - "has to be used for decryption if user key is selected.\n" - "NOTE: the secure bitstream has to be created using Xilinx\n" - "bootgen tool only.\n" + "fpga loads <dev> <address> <size> <auth-OCM-0/DDR-1/noauth-2>\n" + " <enc-devkey(0)/userkey(1)/nenc(2> [Userkey address]\n" + " Loads the secure bistreams(authenticated/encrypted/both\n" + " authenticated and encrypted) of [size] from [address]\n" + " (Xilinx only)\n" + " -The auth-OCM/DDR flag specifies to perform authentication\n" + " in OCM or in DDR. 0 for OCM, 1 for DDR, 2 for no authentication\n" + " -The enc flag specifies which key to be used for decryption\n" + " 0-device key, 1-user key, 2-no encryption.\n" + " -The optional Userkey address specifies from which address key\n" + " has to be used for decryption if user key is selected.\n" + " NOTE: the secure bitstream has to be created using Xilinx\n" + " bootgen tool only.\n" #endif );

Current usage information for loads command is too verbose and long for a command usage prompt. This flag simplifies the text for readability purposes.
Signed-off-by: Ibai Erkiaga ibai.erkiaga-elorza@amd.com ---
(no changes since v1)
cmd/fpga.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/cmd/fpga.c b/cmd/fpga.c index ae85ff201b8..91ccbee0fef 100644 --- a/cmd/fpga.c +++ b/cmd/fpga.c @@ -434,18 +434,13 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper, #endif #endif #if defined(CONFIG_CMD_FPGA_LOAD_SECURE) - "fpga loads <dev> <address> <size> <auth-OCM-0/DDR-1/noauth-2>\n" - " <enc-devkey(0)/userkey(1)/nenc(2> [Userkey address]\n" - " Loads the secure bistreams(authenticated/encrypted/both\n" - " authenticated and encrypted) of [size] from [address]\n" - " (Xilinx only)\n" - " -The auth-OCM/DDR flag specifies to perform authentication\n" - " in OCM or in DDR. 0 for OCM, 1 for DDR, 2 for no authentication\n" - " -The enc flag specifies which key to be used for decryption\n" - " 0-device key, 1-user key, 2-no encryption.\n" - " -The optional Userkey address specifies from which address key\n" - " has to be used for decryption if user key is selected.\n" - " NOTE: the secure bitstream has to be created using Xilinx\n" - " bootgen tool only.\n" + "fpga loads <dev> <address> <size> <authflag> <encflag> [Userkey address]\n" + " Load device from memory buffer with secure bistream\n" + " (authenticated/encrypted/both)(Xilinx only)\n" + " -authflag: 0 for OCM, 1 for DDR, 2 for no authentication\n" + " (specifies where to perform authentication)\n" + " -encflag: 0 for device key, 1 for user key, 2 for no encryption\n" + " -Userkey address: address where user key is stored\n" + " NOTE: secure bitstream has to be created using Xilinx bootgen tool\n" #endif );

Remove statements of Xilinx Only from the fpga command information and ensure Kconfig dependencies to FPGA_XILINX are implemented instead.
Signed-off-by: Ibai Erkiaga ibai.erkiaga-elorza@amd.com ---
(no changes since v1)
Due to an issue with patman I had to add an empty line on the CONFIG_FPGA_LOADB description ---
--- cmd/Kconfig | 32 ++++++++++++++++++++------------ cmd/fpga.c | 9 ++++----- 2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/cmd/Kconfig b/cmd/Kconfig index 1d7ddb4ed36..31f1df2a67d 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1163,16 +1163,31 @@ config CMD_FPGA help FPGA support.
-config CMD_FPGA_LOADBP - bool "fpga loadbp - load partial bitstream (Xilinx only)" +config CMD_FPGA_LOADB + bool "fpga loadb - load bitstream" + depends on CMD_FPGA && FPGA_XILINX + help + Supports loading an FPGA device from a bitstream buffer + . + + +config CMD_FPGA_LOADP + bool "fpga loadp - load partial bitstream" depends on CMD_FPGA help Supports loading an FPGA device from a bitstream buffer containing a partial bitstream.
+config CMD_FPGA_LOADBP + bool "fpga loadbp - load partial bitstream" + depends on CMD_FPGA && FPGA_XILINX + help + Supports loading an FPGA device from a bitstream buffer containing + a partial bitstream. + config CMD_FPGA_LOADFS - bool "fpga loadfs - load bitstream from FAT filesystem (Xilinx only)" - depends on CMD_FPGA + bool "fpga loadfs - load bitstream from FAT filesystem" + depends on CMD_FPGA && FPGA_XILINX help Supports loading an FPGA device from a FAT filesystem.
@@ -1182,16 +1197,9 @@ config CMD_FPGA_LOADMK help Supports loading an FPGA device from a image generated by mkimage.
-config CMD_FPGA_LOADP - bool "fpga loadp - load partial bitstream" - depends on CMD_FPGA - help - Supports loading an FPGA device from a bitstream buffer containing - a partial bitstream. - config CMD_FPGA_LOAD_SECURE bool "fpga loads - loads secure bitstreams" - depends on CMD_FPGA + depends on CMD_FPGA && FPGA_XILINX select FPGA_LOAD_SECURE help Enables the fpga loads command which is used to load secure diff --git a/cmd/fpga.c b/cmd/fpga.c index 91ccbee0fef..f46ca040d28 100644 --- a/cmd/fpga.c +++ b/cmd/fpga.c @@ -412,19 +412,18 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper, "info [dev] List known device information\n" "fpga dump <dev> <address> <size> Load device to memory buffer\n" "fpga load <dev> <address> <size> Load device from memory buffer\n" + "fpga loadb <dev> <address> <size> Load device from bitstream buffer\n" #if defined(CONFIG_CMD_FPGA_LOADP) "fpga loadp <dev> <address> <size> Load device from memory buffer\n" " with partial bitstream\n" #endif - "fpga loadb <dev> <address> <size> Load device from bitstream buffer\n" - " (Xilinx only)\n" #if defined(CONFIG_CMD_FPGA_LOADBP) "fpga loadbp <dev> <address> <size> Load device from bitstream buffer\n" - " with partial bitstream (Xilinx only)\n" + " with partial bitstream\n" #endif #if defined(CONFIG_CMD_FPGA_LOADFS) "fpga loadfs <dev> <address> <size> <blocksize> <interface> [<dev[:part]>] <filename>\n" - " Load device from filesystem (FAT by default) (Xilinx only)\n" + " Load device from filesystem (FAT by default)\n" #endif #if defined(CONFIG_CMD_FPGA_LOADMK) "fpga loadmk <dev> <address> Load device generated with mkimage\n" @@ -436,7 +435,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper, #if defined(CONFIG_CMD_FPGA_LOAD_SECURE) "fpga loads <dev> <address> <size> <authflag> <encflag> [Userkey address]\n" " Load device from memory buffer with secure bistream\n" - " (authenticated/encrypted/both)(Xilinx only)\n" + " (authenticated/encrypted/both)\n" " -authflag: 0 for OCM, 1 for DDR, 2 for no authentication\n" " (specifies where to perform authentication)\n" " -encflag: 0 for device key, 1 for user key, 2 for no encryption\n"

On 1/17/25 10:28, Ibai Erkiaga wrote:
Remove statements of Xilinx Only from the fpga command information and ensure Kconfig dependencies to FPGA_XILINX are implemented instead.
you are actually doing more than you write. You are also resorting commands which is kind of messy.
Signed-off-by: Ibai Erkiaga ibai.erkiaga-elorza@amd.com
(no changes since v1)
Due to an issue with patman I had to add an empty line on the CONFIG_FPGA_LOADB description
cmd/Kconfig | 32 ++++++++++++++++++++------------ cmd/fpga.c | 9 ++++----- 2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/cmd/Kconfig b/cmd/Kconfig index 1d7ddb4ed36..31f1df2a67d 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1163,16 +1163,31 @@ config CMD_FPGA help FPGA support.
-config CMD_FPGA_LOADBP
- bool "fpga loadbp - load partial bitstream (Xilinx only)"
+config CMD_FPGA_LOADB
- bool "fpga loadb - load bitstream"
- depends on CMD_FPGA && FPGA_XILINX
- help
Supports loading an FPGA device from a bitstream buffer
.
weird
one newline is enough.
+config CMD_FPGA_LOADP
- bool "fpga loadp - load partial bitstream" depends on CMD_FPGA help Supports loading an FPGA device from a bitstream buffer containing a partial bitstream.
+config CMD_FPGA_LOADBP
- bool "fpga loadbp - load partial bitstream"
- depends on CMD_FPGA && FPGA_XILINX
- help
Supports loading an FPGA device from a bitstream buffer containing
a partial bitstream.
- config CMD_FPGA_LOADFS
- bool "fpga loadfs - load bitstream from FAT filesystem (Xilinx only)"
- depends on CMD_FPGA
- bool "fpga loadfs - load bitstream from FAT filesystem"
- depends on CMD_FPGA && FPGA_XILINX help Supports loading an FPGA device from a FAT filesystem.
@@ -1182,16 +1197,9 @@ config CMD_FPGA_LOADMK help Supports loading an FPGA device from a image generated by mkimage.
-config CMD_FPGA_LOADP
- bool "fpga loadp - load partial bitstream"
- depends on CMD_FPGA
- help
Supports loading an FPGA device from a bitstream buffer containing
a partial bitstream.
- config CMD_FPGA_LOAD_SECURE bool "fpga loads - loads secure bitstreams"
- depends on CMD_FPGA
- depends on CMD_FPGA && FPGA_XILINX select FPGA_LOAD_SECURE help Enables the fpga loads command which is used to load secure
diff --git a/cmd/fpga.c b/cmd/fpga.c index 91ccbee0fef..f46ca040d28 100644 --- a/cmd/fpga.c +++ b/cmd/fpga.c @@ -412,19 +412,18 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper, "info [dev] List known device information\n" "fpga dump <dev> <address> <size> Load device to memory buffer\n" "fpga load <dev> <address> <size> Load device from memory buffer\n"
#if defined(CONFIG_CMD_FPGA_LOADP) "fpga loadp <dev> <address> <size> Load device from memory buffer\n" " with partial bitstream\n" #endif"fpga loadb <dev> <address> <size> Load device from bitstream buffer\n"
"fpga loadb <dev> <address> <size> Load device from bitstream buffer\n"
" (Xilinx only)\n"
You are removing Xilinx only but still still no symbol for it is created. It means when this is applied it will be available for other vendors too.
Feel free to create two more patches (in front of this one) 1. resort entries in Kconfig 2. introduce CONFIG_CMD_FPGA_LOADB with also using it around do_fpga_loadb()
#if defined(CONFIG_CMD_FPGA_LOADBP) "fpga loadbp <dev> <address> <size> Load device from bitstream buffer\n"
" with partial bitstream (Xilinx only)\n"
#endif #if defined(CONFIG_CMD_FPGA_LOADFS) "fpga loadfs <dev> <address> <size> <blocksize> <interface> [<dev[:part]>] <filename>\n"" with partial bitstream\n"
" Load device from filesystem (FAT by default) (Xilinx only)\n"
#endif #if defined(CONFIG_CMD_FPGA_LOADMK) "fpga loadmk <dev> <address> Load device generated with mkimage\n"" Load device from filesystem (FAT by default)\n"
@@ -436,7 +435,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper, #if defined(CONFIG_CMD_FPGA_LOAD_SECURE) "fpga loads <dev> <address> <size> <authflag> <encflag> [Userkey address]\n" " Load device from memory buffer with secure bistream\n"
" (authenticated/encrypted/both)(Xilinx only)\n"
" -authflag: 0 for OCM, 1 for DDR, 2 for no authentication\n" " (specifies where to perform authentication)\n" " -encflag: 0 for device key, 1 for user key, 2 for no encryption\n"" (authenticated/encrypted/both)\n"
M
participants (2)
-
Ibai Erkiaga
-
Michal Simek