]> git.sur5r.net Git - u-boot/blob - arch/x86/lib/cmd_hob.c
Merge git://git.denx.de/u-boot-x86
[u-boot] / arch / x86 / lib / cmd_hob.c
1 /*
2  * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <command.h>
9 #include <linux/compiler.h>
10 #include <asm/arch/fsp/fsp_support.h>
11
12 DECLARE_GLOBAL_DATA_PTR;
13
14 static char *hob_type[] = {
15         "reserved",
16         "Hand-off",
17         "Memory Allocation",
18         "Resource Descriptor",
19         "GUID Extension",
20         "Firmware Volumn",
21         "CPU",
22         "Memory Pool",
23         "reserved",
24         "Firmware Volumn 2",
25         "Load PEIM Unused",
26         "UEFI Capsule",
27 };
28
29 int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
30 {
31         union hob_pointers_t hob;
32         u16 type;
33         char *desc;
34         int i = 0;
35
36         hob.raw = (u8 *)gd->arch.hob_list;
37
38         printf("HOB list address: 0x%08x\n\n", (unsigned int)hob.raw);
39
40         printf("No. | Address  | Type                | Length in Bytes\n");
41         printf("----|----------|---------------------|----------------\n");
42         while (!END_OF_HOB(hob)) {
43                 printf("%-3d | %08x | ", i, (unsigned int)hob.raw);
44                 type = hob.hdr->type;
45                 if (type == HOB_TYPE_UNUSED)
46                         desc = "*Unused*";
47                 else if (type == HOB_TYPE_EOH)
48                         desc = "**END OF HOB**";
49                 else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
50                         desc = hob_type[type];
51                 else
52                         desc = "!!!Invalid Type!!!";
53                 printf("%-19s | %-15d\n", desc, hob.hdr->len);
54                 hob.raw = GET_NEXT_HOB(hob);
55                 i++;
56         }
57
58         return 0;
59 }
60
61 /* -------------------------------------------------------------------- */
62
63 U_BOOT_CMD(
64         hob,    1,      1,      do_hob,
65         "print FSP Hand-Off Block information",
66         ""
67 );