tools/bluemoon: Display FW version of firmware file
authorTedd Ho-Jeong An <tedd.an@intel.com>
Tue, 2 Feb 2021 03:40:04 +0000 (19:40 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:34 +0000 (19:08 +0530)
This patch displays a FW version after parsing the WRITE_BOOT_PARAMS
command in the firmeare file. It also change the display type for
Module vendor and Date in the CSS header to hex for easy read.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/bluemoon.c

index 8b62b1e..382c76c 100755 (executable)
@@ -805,8 +805,10 @@ static void analyze_firmware(const char *path)
                                le32_to_cpu(css->header_version) >> 16,
                                le32_to_cpu(css->header_version) & 0xffff);
        printf("Module ID:\t%u\n", le32_to_cpu(css->module_id));
-       printf("Module vendor:\t%u\n", le32_to_cpu(css->module_vendor));
-       printf("Date:\t\t%u\n", le32_to_cpu(css->date));
+       printf("Module vendor:\t0x%x\n", le32_to_cpu(css->module_vendor));
+       printf("Date:\t\t%04x-%02x-%02x\n", le32_to_cpu(css->date) >> 16,
+                               le32_to_cpu(css->date) >> 8 & 0xff,
+                               le32_to_cpu(css->date) & 0xff);
        printf("Size:\t\t%u DWORDs / %u bytes\n", le32_to_cpu(css->size),
                                                le32_to_cpu(css->size) * 4);
        printf("Key size:\t%u DWORDs / %u bytes\n",
@@ -840,13 +842,23 @@ static void analyze_firmware(const char *path)
        while (firmware_offset < firmware_size) {
                uint16_t opcode;
                uint8_t dlen;
+               struct cmd_write_boot_params *params;
 
                opcode = get_le16(firmware_data + firmware_offset);
                dlen = firmware_data[firmware_offset + 2];
 
                switch (opcode) {
-               case CMD_NO_OPERATION:
                case CMD_WRITE_BOOT_PARAMS:
+                       params = (void *)&firmware_data[firmware_offset + 3];
+                       printf("Boot Parameters\n");
+                       printf("Boot Address:\t0x%08x\n",
+                                       le32_to_cpu(params->boot_addr));
+                       printf("Firmware build:\t%u-%u.%u\n",
+                                       params->fw_build_nn,
+                                       params->fw_build_cw,
+                                       2000 + params->fw_build_yy);
+                       printf("\n");
+               case CMD_NO_OPERATION:
                case CMD_MEMORY_WRITE:
                        break;
                default: