blob: b552fe6c1b5d114ec85e8f7b8154ad9830d6e117 [file] [log] [blame]
Bin Meng90699df2014-12-12 21:05:32 +08001/*
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
12DECLARE_GLOBAL_DATA_PTR;
13
14static char *hob_type[] = {
15 "reserved",
16 "Hand-off",
17 "Memory Allocation",
18 "Resource Descriptor",
19 "GUID Extension",
Bin Mengdb60d862014-12-17 15:50:49 +080020 "Firmware Volume",
Bin Meng90699df2014-12-12 21:05:32 +080021 "CPU",
22 "Memory Pool",
23 "reserved",
Bin Mengdb60d862014-12-17 15:50:49 +080024 "Firmware Volume 2",
Bin Meng90699df2014-12-12 21:05:32 +080025 "Load PEIM Unused",
26 "UEFI Capsule",
27};
28
29int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
30{
Bin Mengdb60d862014-12-17 15:50:49 +080031 union hob_pointers hob;
Bin Meng90699df2014-12-12 21:05:32 +080032 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");
Bin Mengdb60d862014-12-17 15:50:49 +080042 while (!end_of_hob(hob)) {
Bin Meng90699df2014-12-12 21:05:32 +080043 printf("%-3d | %08x | ", i, (unsigned int)hob.raw);
Bin Mengdb60d862014-12-17 15:50:49 +080044 type = get_hob_type(hob);
Bin Meng90699df2014-12-12 21:05:32 +080045 if (type == HOB_TYPE_UNUSED)
46 desc = "*Unused*";
47 else if (type == HOB_TYPE_EOH)
Bin Mengdb60d862014-12-17 15:50:49 +080048 desc = "*END OF HOB*";
Bin Meng90699df2014-12-12 21:05:32 +080049 else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
50 desc = hob_type[type];
51 else
Bin Mengdb60d862014-12-17 15:50:49 +080052 desc = "*Invalid Type*";
53 printf("%-19s | %-15d\n", desc, get_hob_length(hob));
54 hob.raw = get_next_hob(hob);
Bin Meng90699df2014-12-12 21:05:32 +080055 i++;
56 }
57
58 return 0;
59}
60
Bin Meng90699df2014-12-12 21:05:32 +080061U_BOOT_CMD(
62 hob, 1, 1, do_hob,
Bin Mengdb60d862014-12-17 15:50:49 +080063 "print Firmware Support Package (FSP) Hand-Off Block information",
Bin Meng90699df2014-12-12 21:05:32 +080064 ""
65);