Commit 62716ebb751dbe7346ff52b17be867505d959bcc

Authored by Bin Meng
Committed by Simon Glass
1 parent b325cbb171

x86: fsp: Make hob command a sub-command to fsp

Introduce a new fsp command and make the existing hob command a
sub-command to fsp for future extension. Also move cmd_hob.c to
the dedicated fsp sub-directory in arch/x86/lib.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

Showing 5 changed files with 105 additions and 85 deletions Side-by-side Diff

arch/x86/lib/Makefile
... ... @@ -10,7 +10,6 @@
10 10 obj-y += bios_interrupts.o
11 11 obj-$(CONFIG_CMD_BOOTM) += bootm.o
12 12 obj-y += cmd_boot.o
13   -obj-$(CONFIG_HAVE_FSP) += cmd_hob.o
14 13 obj-$(CONFIG_EFI) += efi/
15 14 obj-y += e820.o
16 15 obj-y += gcc.o
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/fsp/fsp_support.h>
11   -
12   -DECLARE_GLOBAL_DATA_PTR;
13   -
14   -static char *hob_type[] = {
15   - "reserved",
16   - "Hand-off",
17   - "Mem Alloc",
18   - "Res Desc",
19   - "GUID Ext",
20   - "FV",
21   - "CPU",
22   - "Mem Pool",
23   - "reserved",
24   - "FV2",
25   - "Load PEIM",
26   - "Capsule",
27   -};
28   -
29   -int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
30   -{
31   - const struct hob_header *hdr;
32   - uint type;
33   - char *desc;
34   - int i = 0;
35   -
36   - hdr = gd->arch.hob_list;
37   -
38   - printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
39   -
40   - printf("# | Address | Type | Len | ");
41   - printf("%42s\n", "GUID");
42   - printf("---|----------|-----------|------|-");
43   - printf("------------------------------------------\n");
44   - while (!end_of_hob(hdr)) {
45   - printf("%-2d | %08x | ", i, (unsigned int)hdr);
46   - type = hdr->type;
47   - if (type == HOB_TYPE_UNUSED)
48   - desc = "*Unused*";
49   - else if (type == HOB_TYPE_EOH)
50   - desc = "*EOH*";
51   - else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
52   - desc = hob_type[type];
53   - else
54   - desc = "*Invalid*";
55   - printf("%-9s | %-4d | ", desc, hdr->len);
56   -
57   - if (type == HOB_TYPE_MEM_ALLOC || type == HOB_TYPE_RES_DESC ||
58   - type == HOB_TYPE_GUID_EXT) {
59   - struct efi_guid *guid = (struct efi_guid *)(hdr + 1);
60   - int j;
61   -
62   - printf("%08x-%04x-%04x", guid->data1,
63   - guid->data2, guid->data3);
64   - for (j = 0; j < ARRAY_SIZE(guid->data4); j++)
65   - printf("-%02x", guid->data4[j]);
66   - } else {
67   - printf("%42s", "Not Available");
68   - }
69   - printf("\n");
70   - hdr = get_next_hob(hdr);
71   - i++;
72   - }
73   -
74   - return 0;
75   -}
76   -
77   -U_BOOT_CMD(
78   - hob, 1, 1, do_hob,
79   - "print Firmware Support Package (FSP) Hand-Off Block information",
80   - ""
81   -);
arch/x86/lib/fsp/Makefile
... ... @@ -4,6 +4,7 @@
4 4 # SPDX-License-Identifier: GPL-2.0+
5 5 #
6 6  
  7 +obj-y += cmd_fsp.o
7 8 obj-y += fsp_car.o
8 9 obj-y += fsp_common.o
9 10 obj-y += fsp_dram.o
arch/x86/lib/fsp/cmd_fsp.c
  1 +/*
  2 + * Copyright (C) 2014-2015, 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 <asm/fsp/fsp_support.h>
  10 +
  11 +DECLARE_GLOBAL_DATA_PTR;
  12 +
  13 +static char *hob_type[] = {
  14 + "reserved",
  15 + "Hand-off",
  16 + "Mem Alloc",
  17 + "Res Desc",
  18 + "GUID Ext",
  19 + "FV",
  20 + "CPU",
  21 + "Mem Pool",
  22 + "reserved",
  23 + "FV2",
  24 + "Load PEIM",
  25 + "Capsule",
  26 +};
  27 +
  28 +static int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  29 +{
  30 + const struct hob_header *hdr;
  31 + uint type;
  32 + char *desc;
  33 + int i = 0;
  34 +
  35 + hdr = gd->arch.hob_list;
  36 +
  37 + printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
  38 +
  39 + printf("# | Address | Type | Len | ");
  40 + printf("%42s\n", "GUID");
  41 + printf("---|----------|-----------|------|-");
  42 + printf("------------------------------------------\n");
  43 + while (!end_of_hob(hdr)) {
  44 + printf("%-2d | %08x | ", i, (unsigned int)hdr);
  45 + type = hdr->type;
  46 + if (type == HOB_TYPE_UNUSED)
  47 + desc = "*Unused*";
  48 + else if (type == HOB_TYPE_EOH)
  49 + desc = "*EOH*";
  50 + else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
  51 + desc = hob_type[type];
  52 + else
  53 + desc = "*Invalid*";
  54 + printf("%-9s | %-4d | ", desc, hdr->len);
  55 +
  56 + if (type == HOB_TYPE_MEM_ALLOC || type == HOB_TYPE_RES_DESC ||
  57 + type == HOB_TYPE_GUID_EXT) {
  58 + struct efi_guid *guid = (struct efi_guid *)(hdr + 1);
  59 + int j;
  60 +
  61 + printf("%08x-%04x-%04x", guid->data1,
  62 + guid->data2, guid->data3);
  63 + for (j = 0; j < ARRAY_SIZE(guid->data4); j++)
  64 + printf("-%02x", guid->data4[j]);
  65 + } else {
  66 + printf("%42s", "Not Available");
  67 + }
  68 + printf("\n");
  69 + hdr = get_next_hob(hdr);
  70 + i++;
  71 + }
  72 +
  73 + return 0;
  74 +}
  75 +
  76 +static cmd_tbl_t fsp_commands[] = {
  77 + U_BOOT_CMD_MKENT(hob, 0, 1, do_hob, "", ""),
  78 +};
  79 +
  80 +static int do_fsp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  81 +{
  82 + cmd_tbl_t *fsp_cmd;
  83 + int ret;
  84 +
  85 + if (argc < 2)
  86 + return CMD_RET_USAGE;
  87 + fsp_cmd = find_cmd_tbl(argv[1], fsp_commands, ARRAY_SIZE(fsp_commands));
  88 + argc -= 2;
  89 + argv += 2;
  90 + if (!fsp_cmd || argc > fsp_cmd->maxargs)
  91 + return CMD_RET_USAGE;
  92 +
  93 + ret = fsp_cmd->cmd(fsp_cmd, flag, argc, argv);
  94 +
  95 + return cmd_process_error(fsp_cmd, ret);
  96 +}
  97 +
  98 +U_BOOT_CMD(
  99 + fsp, 2, 1, do_fsp,
  100 + "Show Intel Firmware Support Package (FSP) related information",
  101 + "hob - Print FSP Hand-Off Block (HOB) information"
  102 +);
... ... @@ -332,9 +332,8 @@
332 332 adjust internal settings, there are several x86-specific commands that may be
333 333 useful:
334 334  
335   -hob - Display information about Firmware Support Package (FSP) Hand-off
336   - Block. This is only available on platforms which use FSP, mostly
337   - Atom.
  335 +fsp - Display information about Intel Firmware Support Package (FSP).
  336 + This is only available on platforms which use FSP, mostly Atom.
338 337 iod - Display I/O memory
339 338 iow - Write I/O memory
340 339 mtrr - List and set the Memory Type Range Registers (MTRR). These are used to