2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-12-12 13:05:32 +00:00
|
|
|
/*
|
2015-10-10 08:47:58 +00:00
|
|
|
* Copyright (C) 2014-2015, Bin Meng <bmeng.cn@gmail.com>
|
2014-12-12 13:05:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2015-01-28 05:13:36 +00:00
|
|
|
#include <asm/fsp/fsp_support.h>
|
2014-12-12 13:05:32 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
static char *hob_type[] = {
|
|
|
|
"reserved",
|
|
|
|
"Hand-off",
|
2015-10-10 08:47:56 +00:00
|
|
|
"Mem Alloc",
|
|
|
|
"Res Desc",
|
|
|
|
"GUID Ext",
|
|
|
|
"FV",
|
2014-12-12 13:05:32 +00:00
|
|
|
"CPU",
|
2015-10-10 08:47:56 +00:00
|
|
|
"Mem Pool",
|
2014-12-12 13:05:32 +00:00
|
|
|
"reserved",
|
2015-10-10 08:47:56 +00:00
|
|
|
"FV2",
|
|
|
|
"Load PEIM",
|
|
|
|
"Capsule",
|
2014-12-12 13:05:32 +00:00
|
|
|
};
|
|
|
|
|
2015-10-10 08:47:59 +00:00
|
|
|
static int do_hdr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
|
|
{
|
|
|
|
struct fsp_header *hdr = find_fsp_header();
|
|
|
|
u32 img_addr = hdr->img_base;
|
|
|
|
char *sign = (char *)&hdr->sign;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
printf("FSP : binary 0x%08x, header 0x%08x\n",
|
|
|
|
CONFIG_FSP_ADDR, (int)hdr);
|
|
|
|
printf("Header : sign ");
|
|
|
|
for (i = 0; i < sizeof(hdr->sign); i++)
|
|
|
|
printf("%c", *sign++);
|
|
|
|
printf(", size %d, rev %d\n", hdr->hdr_len, hdr->hdr_rev);
|
2017-08-16 05:41:57 +00:00
|
|
|
printf("Image : rev ");
|
|
|
|
if (hdr->hdr_rev == FSP_HEADER_REVISION_1) {
|
|
|
|
printf("%d.%d",
|
|
|
|
(hdr->img_rev >> 8) & 0xff, hdr->img_rev & 0xff);
|
|
|
|
} else {
|
|
|
|
printf("%d.%d.%d.%d",
|
|
|
|
(hdr->img_rev >> 24) & 0xff, (hdr->img_rev >> 16) & 0xff,
|
|
|
|
(hdr->img_rev >> 8) & 0xff, hdr->img_rev & 0xff);
|
|
|
|
}
|
|
|
|
printf(", id ");
|
2015-10-10 08:47:59 +00:00
|
|
|
for (i = 0; i < ARRAY_SIZE(hdr->img_id); i++)
|
|
|
|
printf("%c", hdr->img_id[i]);
|
|
|
|
printf(", addr 0x%08x, size %d\n", img_addr, hdr->img_size);
|
2017-08-16 05:41:57 +00:00
|
|
|
if (hdr->hdr_rev == FSP_HEADER_REVISION_2) {
|
|
|
|
printf("GFX :%ssupported\n",
|
|
|
|
hdr->img_attr & FSP_ATTR_GRAPHICS_SUPPORT ? " " : " un");
|
|
|
|
}
|
2015-10-10 08:47:59 +00:00
|
|
|
printf("VPD : addr 0x%08x, size %d\n",
|
|
|
|
hdr->cfg_region_off + img_addr, hdr->cfg_region_size);
|
|
|
|
printf("\nNumber of APIs Supported : %d\n", hdr->api_num);
|
|
|
|
printf("\tTempRamInit : 0x%08x\n", hdr->fsp_tempram_init + img_addr);
|
|
|
|
printf("\tFspInit : 0x%08x\n", hdr->fsp_init + img_addr);
|
|
|
|
printf("\tFspNotify : 0x%08x\n", hdr->fsp_notify + img_addr);
|
2017-08-16 05:41:57 +00:00
|
|
|
if (hdr->hdr_rev == FSP_HEADER_REVISION_2) {
|
|
|
|
printf("\tMemoryInit : 0x%08x\n",
|
|
|
|
hdr->fsp_mem_init + img_addr);
|
|
|
|
printf("\tTempRamExit : 0x%08x\n",
|
|
|
|
hdr->fsp_tempram_exit + img_addr);
|
|
|
|
printf("\tSiliconInit : 0x%08x\n",
|
|
|
|
hdr->fsp_silicon_init + img_addr);
|
|
|
|
}
|
2015-10-10 08:47:59 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-10 08:47:58 +00:00
|
|
|
static int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
2014-12-12 13:05:32 +00:00
|
|
|
{
|
2014-12-30 08:02:05 +00:00
|
|
|
const struct hob_header *hdr;
|
2015-01-06 06:04:36 +00:00
|
|
|
uint type;
|
2014-12-12 13:05:32 +00:00
|
|
|
char *desc;
|
|
|
|
int i = 0;
|
|
|
|
|
2014-12-30 08:02:05 +00:00
|
|
|
hdr = gd->arch.hob_list;
|
2014-12-12 13:05:32 +00:00
|
|
|
|
2014-12-30 08:02:05 +00:00
|
|
|
printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
|
2014-12-12 13:05:32 +00:00
|
|
|
|
2015-10-10 08:47:57 +00:00
|
|
|
printf("# | Address | Type | Len | ");
|
|
|
|
printf("%42s\n", "GUID");
|
|
|
|
printf("---|----------|-----------|------|-");
|
|
|
|
printf("------------------------------------------\n");
|
2014-12-30 08:02:05 +00:00
|
|
|
while (!end_of_hob(hdr)) {
|
2015-12-11 10:55:51 +00:00
|
|
|
printf("%02x | %08x | ", i, (unsigned int)hdr);
|
2015-01-06 06:04:36 +00:00
|
|
|
type = hdr->type;
|
2014-12-12 13:05:32 +00:00
|
|
|
if (type == HOB_TYPE_UNUSED)
|
|
|
|
desc = "*Unused*";
|
|
|
|
else if (type == HOB_TYPE_EOH)
|
2015-10-10 08:47:56 +00:00
|
|
|
desc = "*EOH*";
|
2014-12-12 13:05:32 +00:00
|
|
|
else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
|
|
|
|
desc = hob_type[type];
|
|
|
|
else
|
2015-10-10 08:47:56 +00:00
|
|
|
desc = "*Invalid*";
|
2015-12-11 10:55:51 +00:00
|
|
|
printf("%-9s | %04x | ", desc, hdr->len);
|
2015-10-10 08:47:57 +00:00
|
|
|
|
|
|
|
if (type == HOB_TYPE_MEM_ALLOC || type == HOB_TYPE_RES_DESC ||
|
|
|
|
type == HOB_TYPE_GUID_EXT) {
|
|
|
|
struct efi_guid *guid = (struct efi_guid *)(hdr + 1);
|
|
|
|
int j;
|
|
|
|
|
|
|
|
printf("%08x-%04x-%04x", guid->data1,
|
|
|
|
guid->data2, guid->data3);
|
|
|
|
for (j = 0; j < ARRAY_SIZE(guid->data4); j++)
|
|
|
|
printf("-%02x", guid->data4[j]);
|
|
|
|
} else {
|
|
|
|
printf("%42s", "Not Available");
|
|
|
|
}
|
|
|
|
printf("\n");
|
2014-12-30 08:02:05 +00:00
|
|
|
hdr = get_next_hob(hdr);
|
2014-12-12 13:05:32 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-10 08:47:58 +00:00
|
|
|
static cmd_tbl_t fsp_commands[] = {
|
2015-10-10 08:47:59 +00:00
|
|
|
U_BOOT_CMD_MKENT(hdr, 0, 1, do_hdr, "", ""),
|
2015-10-10 08:47:58 +00:00
|
|
|
U_BOOT_CMD_MKENT(hob, 0, 1, do_hob, "", ""),
|
|
|
|
};
|
|
|
|
|
|
|
|
static int do_fsp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
|
|
{
|
|
|
|
cmd_tbl_t *fsp_cmd;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (argc < 2)
|
|
|
|
return CMD_RET_USAGE;
|
|
|
|
fsp_cmd = find_cmd_tbl(argv[1], fsp_commands, ARRAY_SIZE(fsp_commands));
|
|
|
|
argc -= 2;
|
|
|
|
argv += 2;
|
|
|
|
if (!fsp_cmd || argc > fsp_cmd->maxargs)
|
|
|
|
return CMD_RET_USAGE;
|
|
|
|
|
|
|
|
ret = fsp_cmd->cmd(fsp_cmd, flag, argc, argv);
|
|
|
|
|
|
|
|
return cmd_process_error(fsp_cmd, ret);
|
|
|
|
}
|
|
|
|
|
2014-12-12 13:05:32 +00:00
|
|
|
U_BOOT_CMD(
|
2015-10-10 08:47:58 +00:00
|
|
|
fsp, 2, 1, do_fsp,
|
|
|
|
"Show Intel Firmware Support Package (FSP) related information",
|
2015-10-10 08:47:59 +00:00
|
|
|
"hdr - Print FSP header information\n"
|
|
|
|
"fsp hob - Print FSP Hand-Off Block (HOB) information"
|
2014-12-12 13:05:32 +00:00
|
|
|
);
|