mb/google/nissa/var/rull: Add 6W and 15W DPTF parameters
[coreboot2.git] / src / drivers / intel / fsp2_0 / hob_display.c
blobb86b79b13807b01348d74d3755887523d29300a2
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <console/console.h>
4 #include <fsp/util.h>
6 struct hob_type_name {
7 uint16_t type;
8 const char *name;
9 } __packed;
11 static const struct hob_type_name hob_type_names[] = {
12 { HOB_TYPE_HANDOFF, "HOB_TYPE_HANDOFF" },
13 { HOB_TYPE_MEMORY_ALLOCATION, "HOB_TYPE_MEMORY_ALLOCATION" },
14 { HOB_TYPE_RESOURCE_DESCRIPTOR, "HOB_TYPE_RESOURCE_DESCRIPTOR" },
15 { HOB_TYPE_GUID_EXTENSION, "HOB_TYPE_GUID_EXTENSION" },
16 { HOB_TYPE_FV, "HOB_TYPE_FV" },
17 { HOB_TYPE_CPU, "HOB_TYPE_CPU" },
18 { HOB_TYPE_MEMORY_POOL, "HOB_TYPE_MEMORY_POOL" },
19 { HOB_TYPE_FV2, "HOB_TYPE_FV2" },
20 { HOB_TYPE_LOAD_PEIM_UNUSED, "HOB_TYPE_LOAD_PEIM_UNUSED" },
21 { HOB_TYPE_UCAPSULE, "HOB_TYPE_UCAPSULE" },
22 { HOB_TYPE_UNUSED, "HOB_TYPE_UNUSED" },
23 { HOB_TYPE_END_OF_HOB_LIST, "HOB_TYPE_END_OF_HOB_LIST" }
26 static const char *resource_names[] = {
27 [EFI_RESOURCE_SYSTEM_MEMORY] = "SYSTEM_MEMORY",
28 [EFI_RESOURCE_MEMORY_MAPPED_IO] = "MMIO",
29 [EFI_RESOURCE_IO] = "IO",
30 [EFI_RESOURCE_FIRMWARE_DEVICE] = "FIRMWARE_DEVICE",
31 [EFI_RESOURCE_MEMORY_MAPPED_IO_PORT] = "MMIO_PORT",
32 [EFI_RESOURCE_MEMORY_RESERVED] = "MEMORY_RESERVED",
33 [EFI_RESOURCE_IO_RESERVED] = "IO_RESERVED",
36 static const uint8_t bootloader_temp_memory_guid[16] = {
37 0x6c, 0xf4, 0xcf, 0xbb, 0xd3, 0xc8, 0x13, 0x41,
38 0x89, 0x85, 0xb9, 0xd4, 0xf3, 0xb3, 0xf6, 0x4e
41 static const uint8_t empty_guid[16] = {
42 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
45 static const uint8_t fsp_graphics_info_guid[16] = {
46 0xce, 0x2c, 0xf6, 0x39, 0x25, 0x68, 0x69, 0x46,
47 0xbb, 0x56, 0x54, 0x1a, 0xba, 0x75, 0x3a, 0x07
50 static const uint8_t fsp_info_header_guid[16] = {
51 0xbe, 0x40, 0x27, 0x91, 0x84, 0x22, 0x34, 0x47,
52 0xb9, 0x71, 0x84, 0xb0, 0x27, 0x35, 0x3f, 0x0c
55 static const uint8_t smbios_memory_info_guid[16] = {
56 0x8c, 0x10, 0xa1, 0x01, 0xee, 0x9d, 0x84, 0x49,
57 0x88, 0xc3, 0xee, 0xe8, 0xc4, 0x9e, 0xfb, 0x89
60 static const uint8_t tseg_guid[16] = {
61 0x7c, 0x74, 0x38, 0xd0, 0x0c, 0xd0, 0x80, 0x49,
62 0xb3, 0x19, 0x49, 0x01, 0x99, 0xa4, 0x7d, 0x55
65 struct guid_name_map {
66 const void *guid;
67 const char *name;
70 static const struct guid_name_map guid_names[] = {
71 { bootloader_temp_memory_guid, "FSP_BOOTLOADER_TEMP_MEMORY_HOB_GUID" },
72 { fsp_bootloader_tolum_guid, "BOOTLOADER_TOLUM" },
73 { empty_guid, "No GUID specified" },
74 { fsp_info_header_guid, "FSP_INFO_HEADER_GUID" },
75 { fsp_reserved_memory_guid, "FSP_RESERVED_MEMORY" },
76 { fsp_nv_storage_guid, "FSP_NV_STORAGE" },
77 { fsp_graphics_info_guid, "GRAPHICS INFO" },
78 { smbios_memory_info_guid, "FSP_SMBIOS_MEMORY_INFO_GUID" },
79 { tseg_guid, "TSEG" },
82 static const char *resource_name(uint32_t type)
84 if (type >= ARRAY_SIZE(resource_names))
85 return "UNKNOWN";
86 return resource_names[type];
89 void fsp_print_resource_descriptor(const void *base)
91 const struct hob_resource *res;
93 res = fsp_hob_header_to_resource(base);
95 printk(BIOS_SPEW, "Resource %s, attribute %x\n",
96 resource_name(res->type), res->attribute_type);
97 printk(BIOS_SPEW, "\t0x%08llx + 0x%08llx\n", res->addr, res->length);
98 if (!fsp_guid_compare(res->owner_guid, empty_guid)) {
99 printk(BIOS_SPEW, "\tOwner GUID: ");
100 fsp_print_guid(BIOS_SPEW, res->owner_guid);
101 printk(BIOS_SPEW, " (%s)\n",
102 fsp_get_guid_name(res->owner_guid));
106 void fsp_print_memory_resource_hobs(void)
108 const struct hob_header *hob = fsp_get_hob_list();
110 for (; hob->type != HOB_TYPE_END_OF_HOB_LIST;
111 hob = fsp_next_hob(hob)) {
112 if (hob->type == HOB_TYPE_RESOURCE_DESCRIPTOR)
113 fsp_print_resource_descriptor(hob);
117 const char *fsp_get_hob_type_name(const struct hob_header *hob)
119 size_t index;
120 const char *name;
122 for (index = 0; index < ARRAY_SIZE(hob_type_names); index++)
123 if (hob->type == hob_type_names[index].type)
124 return hob_type_names[index].name;
126 /* Get name for SOC specific HOB */
127 name = soc_get_hob_type_name(hob);
128 if (name != NULL)
129 return name;
130 return "Unknown HOB type";
133 const char *fsp_get_guid_name(const uint8_t *guid)
135 size_t index;
136 const char *name;
138 /* Compare the GUID values in this module */
139 for (index = 0; index < ARRAY_SIZE(guid_names); index++)
140 if (fsp_guid_compare(guid, guid_names[index].guid))
141 return guid_names[index].name;
143 /* Get GUID name from SOC */
144 name = soc_get_guid_name(guid);
145 if (name != NULL)
146 return name;
147 return "Unknown GUID";
150 __weak const char *soc_get_hob_type_name(
151 const struct hob_header *hob)
153 return NULL;
156 void fsp_print_guid_extension_hob(const struct hob_header *hob)
158 const struct hob_resource *res;
160 res = fsp_hob_header_to_resource(hob);
161 printk(BIOS_SPEW, "\t");
162 fsp_print_guid(BIOS_SPEW, res->owner_guid);
163 printk(BIOS_SPEW, ": %s\n", fsp_get_guid_name(res->owner_guid));
165 /* Some of the SoC FSP specific HOBs are of type HOB_TYPE_GUID_EXTENSION */
166 soc_display_hob(hob);
169 __weak const char *soc_get_guid_name(const uint8_t *guid)
171 return NULL;
174 void fsp_display_hobs(void)
176 const struct hob_header *hob = fsp_get_hob_list();
178 /* Display the HOB list pointer */
179 printk(BIOS_SPEW, "\n=== FSP HOBs ===\n");
180 printk(BIOS_SPEW, "%p: hob_list_ptr\n", hob);
182 /* Walk the list of HOBs */
183 while (1) {
184 /* Display the HOB header */
185 printk(BIOS_SPEW, "%p, 0x%08x bytes: %s\n", hob, hob->length,
186 fsp_get_hob_type_name(hob));
187 switch (hob->type) {
188 default:
189 soc_display_hob(hob);
190 break;
192 case HOB_TYPE_END_OF_HOB_LIST:
193 printk(BIOS_SPEW, "=== End of FSP HOBs ===\n\n");
194 return;
196 case HOB_TYPE_RESOURCE_DESCRIPTOR:
197 fsp_print_resource_descriptor(hob);
198 break;
200 case HOB_TYPE_GUID_EXTENSION:
201 fsp_print_guid_extension_hob(hob);
202 break;
204 hob = fsp_next_hob(hob);
208 __weak void soc_display_hob(const struct hob_header *hob)