[U-Boot] [PATCH 15/25] x86: Add a simple command to show FSP HOB information
Bin Meng
bmeng.cn at gmail.com
Fri Dec 5 10:11:04 CET 2014
Hi Simon,
On Fri, Dec 5, 2014 at 7:42 AM, Simon Glass <sjg at chromium.org> wrote:
> Hi Bin,
>
> On 4 December 2014 at 08:02, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Can we have a short commit message about what HOB is and why you want
> to list it?
Sure.
[snip]
>> ---
>> arch/x86/lib/Makefile | 1 +
>> arch/x86/lib/cmd_hob.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 72 insertions(+)
>> create mode 100644 arch/x86/lib/cmd_hob.c
>>
>> diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
>> index 55de788..73262d7 100644
>> --- a/arch/x86/lib/Makefile
>> +++ b/arch/x86/lib/Makefile
>> @@ -10,6 +10,7 @@ obj-y += bios_asm.o
>> obj-y += bios_interrupts.o
>> obj-$(CONFIG_CMD_BOOTM) += bootm.o
>> obj-y += cmd_boot.o
>> +obj-$(CONFIG_HAVE_FSP) += cmd_hob.o
>> obj-y += gcc.o
>> obj-y += init_helpers.o
>> obj-y += interrupts.o
>> diff --git a/arch/x86/lib/cmd_hob.c b/arch/x86/lib/cmd_hob.c
>> new file mode 100644
>> index 0000000..bf3bd83
>> --- /dev/null
>> +++ b/arch/x86/lib/cmd_hob.c
>> @@ -0,0 +1,71 @@
>> +/*
>> + * Copyright (C) 2014, Bin Meng <bmeng.cn at gmail.com>
>> + *
>> + * SPDX-License-Identifier: GPL-2.0+
>> + */
>> +
>> +#include <common.h>
>> +#include <command.h>
>> +#include <linux/compiler.h>
>> +#include <asm/arch/fsp/fsp_support.h>
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +#define HOB_TYPE_MIN 0
>> +#define HOB_TYPE_MAX 11
>
> ARRAY_SIZE(hob_type) ?
Yes, will fix.
>> +
>> +static char *hob_type[] = {
>> + "reserved",
>> + "Hand-off",
>> + "Memory Allocation",
>> + "Resource Descriptor",
>> + "GUID Extension",
>> + "Firmware Volumn",
>> + "CPU",
>> + "Memory Pool",
>> + "reserved",
>> + "Firmware Volumn 2",
>> + "Load PEIM Unused",
>> + "UEFI Capsule",
>> +};
>> +
>> +int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>> +{
>> + EFI_PEI_HOB_POINTERS hob;
>> + UINT16 type;
>> + char *desc;
>> + int i = 0;
>> +
>> + hob.Raw = (UINT8 *)gd->arch.hob_list;
>> +
>> + printf("HOB list address: 0x%08x\n\n", (unsigned int)hob.Raw);
>> +
>> + printf(" No. | Address | Type | Length in Bytes \n");
>> + printf("-----|----------|----------------------|-----------------\n");
>> + while (!END_OF_HOB_LIST(hob)) {
>> + printf(" %-3d | %08x |", i, (unsigned int)hob.Raw);
>> + type = hob.Header->HobType;
>> + if (type == EFI_HOB_TYPE_UNUSED)
>> + desc = "*Unused*";
>> + else if (type == EFI_HOB_TYPE_END_OF_HOB_LIST)
>> + desc = "**END OF HOB**";
>> + else if (type >= HOB_TYPE_MIN && type <= HOB_TYPE_MAX)
>> + desc = hob_type[type];
>> + else
>> + desc = "!!!Invalid Type!!!";
>> + printf(" %-20s |", desc);
>> + printf(" %-15d \n", hob.Header->HobLength);
>
> Can we combine those two. Also I see a space before \n - are you
> running patman to check patches?
Yes, I was intending to put an additional space there. Now I don't
think it is really necessary. I was using checkscript.pl to check
patches. I will remove those spaces in v2.
[snip]
Regards,
Bin
More information about the U-Boot
mailing list