blob: 6ff321adb714a68a1d7fecad97a9e9eb12c5404c [file] [log] [blame]
Bin Mengba7b38a2014-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>
Simon Glass1021af42015-01-27 22:13:36 -070010#include <asm/fsp/fsp_support.h>
Bin Mengba7b38a2014-12-12 21:05:32 +080011
12DECLARE_GLOBAL_DATA_PTR;
13
14static char *hob_type[] = {
15 "reserved",
16 "Hand-off",
Bin Mengfd755f02015-10-10 01:47:56 -070017 "Mem Alloc",
18 "Res Desc",
19 "GUID Ext",
20 "FV",
Bin Mengba7b38a2014-12-12 21:05:32 +080021 "CPU",
Bin Mengfd755f02015-10-10 01:47:56 -070022 "Mem Pool",
Bin Mengba7b38a2014-12-12 21:05:32 +080023 "reserved",
Bin Mengfd755f02015-10-10 01:47:56 -070024 "FV2",
25 "Load PEIM",
26 "Capsule",
Bin Mengba7b38a2014-12-12 21:05:32 +080027};
28
29int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
30{
Bin Meng949dbc12014-12-30 16:02:05 +080031 const struct hob_header *hdr;
Bin Mengb2439ae2015-01-06 14:04:36 +080032 uint type;
Bin Mengba7b38a2014-12-12 21:05:32 +080033 char *desc;
34 int i = 0;
35
Bin Meng949dbc12014-12-30 16:02:05 +080036 hdr = gd->arch.hob_list;
Bin Mengba7b38a2014-12-12 21:05:32 +080037
Bin Meng949dbc12014-12-30 16:02:05 +080038 printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
Bin Mengba7b38a2014-12-12 21:05:32 +080039
Bin Mengfd755f02015-10-10 01:47:56 -070040 printf("# | Address | Type | Len\n");
41 printf("---|----------|-----------|-----\n");
Bin Meng949dbc12014-12-30 16:02:05 +080042 while (!end_of_hob(hdr)) {
Bin Mengfd755f02015-10-10 01:47:56 -070043 printf("%-2d | %08x | ", i, (unsigned int)hdr);
Bin Mengb2439ae2015-01-06 14:04:36 +080044 type = hdr->type;
Bin Mengba7b38a2014-12-12 21:05:32 +080045 if (type == HOB_TYPE_UNUSED)
46 desc = "*Unused*";
47 else if (type == HOB_TYPE_EOH)
Bin Mengfd755f02015-10-10 01:47:56 -070048 desc = "*EOH*";
Bin Mengba7b38a2014-12-12 21:05:32 +080049 else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
50 desc = hob_type[type];
51 else
Bin Mengfd755f02015-10-10 01:47:56 -070052 desc = "*Invalid*";
53 printf("%-9s | %-4d\n", desc, hdr->len);
Bin Meng949dbc12014-12-30 16:02:05 +080054 hdr = get_next_hob(hdr);
Bin Mengba7b38a2014-12-12 21:05:32 +080055 i++;
56 }
57
58 return 0;
59}
60
Bin Mengba7b38a2014-12-12 21:05:32 +080061U_BOOT_CMD(
62 hob, 1, 1, do_hob,
Bin Meng255fd5c2014-12-17 15:50:49 +080063 "print Firmware Support Package (FSP) Hand-Off Block information",
Bin Mengba7b38a2014-12-12 21:05:32 +080064 ""
65);