blob: b3b663021bc1e2b984c9ffda919a0ecf0670427a [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Bin Mengba7b38a2014-12-12 21:05:32 +08002/*
Bin Meng62716eb2015-10-10 01:47:58 -07003 * Copyright (C) 2014-2015, Bin Meng <bmeng.cn@gmail.com>
Bin Mengba7b38a2014-12-12 21:05:32 +08004 */
5
6#include <common.h>
7#include <command.h>
Simon Glass83311882019-09-25 08:00:11 -06008#include <asm/fsp1/fsp_support.h>
Bin Mengba7b38a2014-12-12 21:05:32 +08009
10DECLARE_GLOBAL_DATA_PTR;
11
Bin Meng010921a2015-10-10 01:47:59 -070012static int do_hdr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
13{
Simon Glasse2adc362019-09-25 08:11:25 -060014 struct fsp_header *hdr = fsp_find_header();
Bin Meng010921a2015-10-10 01:47:59 -070015 u32 img_addr = hdr->img_base;
16 char *sign = (char *)&hdr->sign;
17 int i;
18
19 printf("FSP : binary 0x%08x, header 0x%08x\n",
20 CONFIG_FSP_ADDR, (int)hdr);
21 printf("Header : sign ");
22 for (i = 0; i < sizeof(hdr->sign); i++)
23 printf("%c", *sign++);
24 printf(", size %d, rev %d\n", hdr->hdr_len, hdr->hdr_rev);
Bin Mengb3fd2122017-08-15 22:41:57 -070025 printf("Image : rev ");
26 if (hdr->hdr_rev == FSP_HEADER_REVISION_1) {
27 printf("%d.%d",
28 (hdr->img_rev >> 8) & 0xff, hdr->img_rev & 0xff);
29 } else {
30 printf("%d.%d.%d.%d",
31 (hdr->img_rev >> 24) & 0xff, (hdr->img_rev >> 16) & 0xff,
32 (hdr->img_rev >> 8) & 0xff, hdr->img_rev & 0xff);
33 }
34 printf(", id ");
Bin Meng010921a2015-10-10 01:47:59 -070035 for (i = 0; i < ARRAY_SIZE(hdr->img_id); i++)
36 printf("%c", hdr->img_id[i]);
37 printf(", addr 0x%08x, size %d\n", img_addr, hdr->img_size);
Bin Mengb3fd2122017-08-15 22:41:57 -070038 if (hdr->hdr_rev == FSP_HEADER_REVISION_2) {
39 printf("GFX :%ssupported\n",
40 hdr->img_attr & FSP_ATTR_GRAPHICS_SUPPORT ? " " : " un");
41 }
Bin Meng010921a2015-10-10 01:47:59 -070042 printf("VPD : addr 0x%08x, size %d\n",
43 hdr->cfg_region_off + img_addr, hdr->cfg_region_size);
44 printf("\nNumber of APIs Supported : %d\n", hdr->api_num);
45 printf("\tTempRamInit : 0x%08x\n", hdr->fsp_tempram_init + img_addr);
46 printf("\tFspInit : 0x%08x\n", hdr->fsp_init + img_addr);
47 printf("\tFspNotify : 0x%08x\n", hdr->fsp_notify + img_addr);
Bin Mengb3fd2122017-08-15 22:41:57 -070048 if (hdr->hdr_rev == FSP_HEADER_REVISION_2) {
49 printf("\tMemoryInit : 0x%08x\n",
50 hdr->fsp_mem_init + img_addr);
51 printf("\tTempRamExit : 0x%08x\n",
52 hdr->fsp_tempram_exit + img_addr);
53 printf("\tSiliconInit : 0x%08x\n",
54 hdr->fsp_silicon_init + img_addr);
55 }
Bin Meng010921a2015-10-10 01:47:59 -070056
57 return 0;
58}
59
Bin Meng62716eb2015-10-10 01:47:58 -070060static cmd_tbl_t fsp_commands[] = {
Bin Meng010921a2015-10-10 01:47:59 -070061 U_BOOT_CMD_MKENT(hdr, 0, 1, do_hdr, "", ""),
Bin Meng62716eb2015-10-10 01:47:58 -070062};
63
64static int do_fsp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
65{
66 cmd_tbl_t *fsp_cmd;
67 int ret;
68
69 if (argc < 2)
70 return CMD_RET_USAGE;
71 fsp_cmd = find_cmd_tbl(argv[1], fsp_commands, ARRAY_SIZE(fsp_commands));
72 argc -= 2;
73 argv += 2;
74 if (!fsp_cmd || argc > fsp_cmd->maxargs)
75 return CMD_RET_USAGE;
76
77 ret = fsp_cmd->cmd(fsp_cmd, flag, argc, argv);
78
79 return cmd_process_error(fsp_cmd, ret);
80}
81
Bin Mengba7b38a2014-12-12 21:05:32 +080082U_BOOT_CMD(
Bin Meng62716eb2015-10-10 01:47:58 -070083 fsp, 2, 1, do_fsp,
84 "Show Intel Firmware Support Package (FSP) related information",
Park, Aiden7165fd52019-08-03 08:30:31 +000085 "hdr - Print FSP header information"
Bin Mengba7b38a2014-12-12 21:05:32 +080086);