x86: fsp: Print GUID whenever applicable in the hob command output
authorBin Meng <bmeng.cn@gmail.com>
Sat, 10 Oct 2015 08:47:57 +0000 (01:47 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 21 Oct 2015 13:46:26 +0000 (07:46 -0600)
When examining a HOB, it's useful to see which GUID this HOB
belongs to. Add GUID output in the hob command to aid this.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
arch/x86/lib/cmd_hob.c

index 6ff321adb714a68a1d7fecad97a9e9eb12c5404c..4a29aeed3bde8a8eca50743dff04e8a37d9c4c67 100644 (file)
@@ -37,8 +37,10 @@ int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
 
-       printf("#  | Address  | Type      | Len\n");
-       printf("---|----------|-----------|-----\n");
+       printf("#  | Address  | Type      | Len  | ");
+       printf("%42s\n", "GUID");
+       printf("---|----------|-----------|------|-");
+       printf("------------------------------------------\n");
        while (!end_of_hob(hdr)) {
                printf("%-2d | %08x | ", i, (unsigned int)hdr);
                type = hdr->type;
@@ -50,7 +52,21 @@ int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        desc = hob_type[type];
                else
                        desc = "*Invalid*";
-               printf("%-9s | %-4d\n", desc, hdr->len);
+               printf("%-9s | %-4d | ", desc, hdr->len);
+
+               if (type == HOB_TYPE_MEM_ALLOC || type == HOB_TYPE_RES_DESC ||
+                   type == HOB_TYPE_GUID_EXT) {
+                       struct efi_guid *guid = (struct efi_guid *)(hdr + 1);
+                       int j;
+
+                       printf("%08x-%04x-%04x", guid->data1,
+                              guid->data2, guid->data3);
+                       for (j = 0; j < ARRAY_SIZE(guid->data4); j++)
+                               printf("-%02x", guid->data4[j]);
+               } else {
+                       printf("%42s", "Not Available");
+               }
+               printf("\n");
                hdr = get_next_hob(hdr);
                i++;
        }