]> Git Repo - J-u-boot.git/blame - arch/x86/lib/cmd_hob.c
x86: Move common FSP code into a common location
[J-u-boot.git] / arch / x86 / lib / cmd_hob.c
CommitLineData
ba7b38a5
BM
1/*
2 * Copyright (C) 2014, Bin Meng <[email protected]>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <command.h>
9#include <linux/compiler.h>
1021af4d 10#include <asm/fsp/fsp_support.h>
ba7b38a5
BM
11
12DECLARE_GLOBAL_DATA_PTR;
13
14static char *hob_type[] = {
15 "reserved",
16 "Hand-off",
17 "Memory Allocation",
18 "Resource Descriptor",
19 "GUID Extension",
255fd5ca 20 "Firmware Volume",
ba7b38a5
BM
21 "CPU",
22 "Memory Pool",
23 "reserved",
255fd5ca 24 "Firmware Volume 2",
ba7b38a5
BM
25 "Load PEIM Unused",
26 "UEFI Capsule",
27};
28
29int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
30{
949dbc12 31 const struct hob_header *hdr;
b2439aec 32 uint type;
ba7b38a5
BM
33 char *desc;
34 int i = 0;
35
949dbc12 36 hdr = gd->arch.hob_list;
ba7b38a5 37
949dbc12 38 printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
ba7b38a5
BM
39
40 printf("No. | Address | Type | Length in Bytes\n");
41 printf("----|----------|---------------------|----------------\n");
949dbc12
BM
42 while (!end_of_hob(hdr)) {
43 printf("%-3d | %08x | ", i, (unsigned int)hdr);
b2439aec 44 type = hdr->type;
ba7b38a5
BM
45 if (type == HOB_TYPE_UNUSED)
46 desc = "*Unused*";
47 else if (type == HOB_TYPE_EOH)
255fd5ca 48 desc = "*END OF HOB*";
ba7b38a5
BM
49 else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
50 desc = hob_type[type];
51 else
255fd5ca 52 desc = "*Invalid Type*";
b2439aec 53 printf("%-19s | %-15d\n", desc, hdr->len);
949dbc12 54 hdr = get_next_hob(hdr);
ba7b38a5
BM
55 i++;
56 }
57
58 return 0;
59}
60
ba7b38a5
BM
61U_BOOT_CMD(
62 hob, 1, 1, do_hob,
255fd5ca 63 "print Firmware Support Package (FSP) Hand-Off Block information",
ba7b38a5
BM
64 ""
65);
This page took 0.045462 seconds and 4 git commands to generate.