Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 2 | |
Kyösti Mälkki | 13f6650 | 2019-03-03 08:01:05 +0200 | [diff] [blame] | 3 | #include <device/mmio.h> |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 4 | #include <cbmem.h> |
| 5 | #include <commonlib/helpers.h> |
| 6 | #include <console/console.h> |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 7 | #include <fsp/api.h> |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 8 | #include <fsp/util.h> |
Jacob Garber | 5cf9ccc | 2019-08-08 13:35:31 -0600 | [diff] [blame] | 9 | #include <stdint.h> |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 10 | #include <string.h> |
| 11 | |
| 12 | #define HOB_HEADER_LEN 8 |
| 13 | |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 14 | /* GUIDs in little-endian, so they can be used with memcmp() */ |
Lee Leahy | 52d0c68 | 2016-08-01 15:47:42 -0700 | [diff] [blame] | 15 | const uint8_t fsp_bootloader_tolum_guid[16] = { |
| 16 | 0x56, 0x4f, 0xff, 0x73, 0x8e, 0xaa, 0x51, 0x44, |
| 17 | 0xb3, 0x16, 0x36, 0x35, 0x36, 0x67, 0xad, 0x44, |
| 18 | }; |
| 19 | |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 20 | const uint8_t fsp_reserved_memory_guid[16] = { |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 21 | 0x59, 0x97, 0xa7, 0x69, 0x73, 0x13, 0x67, 0x43, |
| 22 | 0xa6, 0xc4, 0xc7, 0xf5, 0x9e, 0xfd, 0x98, 0x6e, |
| 23 | }; |
| 24 | |
Anil Kumar | 0dd0368 | 2021-11-24 14:31:04 -0800 | [diff] [blame] | 25 | const uint8_t fsp_nv_storage_guid_2[16] = { |
| 26 | 0x8f, 0x78, 0x66, 0x48, 0xa8, 0x6b, 0xd8, 0x47, |
| 27 | 0x83, 0x6, 0xac, 0xf7, 0x7f, 0x55, 0x10, 0x46 |
| 28 | }; |
| 29 | |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 30 | const uint8_t fsp_nv_storage_guid[16] = { |
Ravi Sarawadi | 98e0ee6 | 2016-08-17 23:39:37 -0700 | [diff] [blame] | 31 | 0x02, 0xcf, 0x1a, 0x72, 0x77, 0x4d, 0x2a, 0x4c, |
| 32 | 0xb3, 0xdc, 0x27, 0x0b, 0x7b, 0xa9, 0xe4, 0xb0 |
| 33 | }; |
| 34 | |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 35 | static const uint8_t uuid_fv_info[16] = { |
| 36 | 0x2e, 0x72, 0x8e, 0x79, 0xb2, 0x15, 0x13, 0x4e, |
| 37 | 0x8a, 0xe9, 0x6b, 0xa3, 0x0f, 0xf7, 0xf1, 0x67 |
| 38 | }; |
| 39 | |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 40 | /* |
| 41 | * Utilities for walking HOBs |
| 42 | */ |
| 43 | |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 44 | bool fsp_guid_compare(const uint8_t guid1[16], const uint8_t guid2[16]) |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 45 | { |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 46 | return !memcmp(guid1, guid2, 16); |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 47 | } |
| 48 | |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 49 | const struct hob_header *fsp_next_hob(const struct hob_header *parent) |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 50 | { |
| 51 | union { |
| 52 | const struct hob_header *hob; |
| 53 | uintptr_t addr; |
| 54 | } hob_walker; |
| 55 | |
| 56 | hob_walker.hob = parent; |
| 57 | hob_walker.addr += parent->length; |
| 58 | return hob_walker.hob; |
| 59 | } |
| 60 | |
| 61 | static const void *hob_header_to_struct(const struct hob_header *hob) |
| 62 | { |
| 63 | union { |
| 64 | const struct hob_header *hob_hdr; |
| 65 | const void *hob_descr; |
| 66 | uintptr_t addr; |
| 67 | } hob_walker; |
| 68 | |
| 69 | hob_walker.hob_hdr = hob; |
| 70 | hob_walker.addr += HOB_HEADER_LEN; |
| 71 | return hob_walker.hob_descr; |
| 72 | } |
| 73 | |
| 74 | static const void *hob_header_to_extension_hob(const struct hob_header *hob) |
| 75 | { |
| 76 | union { |
| 77 | const struct hob_header *hob_hdr; |
| 78 | const void *hob_descr; |
| 79 | uintptr_t addr; |
| 80 | } hob_walker; |
| 81 | |
| 82 | hob_walker.hob_hdr = hob; |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 83 | hob_walker.addr += HOB_HEADER_LEN + 16; /* header and 16-byte GUID */ |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 84 | return hob_walker.hob_descr; |
| 85 | } |
| 86 | |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 87 | const |
| 88 | struct hob_resource *fsp_hob_header_to_resource(const struct hob_header *hob) |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 89 | { |
| 90 | return hob_header_to_struct(hob); |
| 91 | } |
| 92 | |
| 93 | /* |
| 94 | * Utilities for locating and identifying HOBs |
| 95 | */ |
| 96 | |
Arthur Heymans | 75c2015 | 2019-05-25 10:37:26 +0200 | [diff] [blame] | 97 | static void *fsp_hob_list_ptr; |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 98 | |
| 99 | static void save_hob_list(int is_recovery) |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 100 | { |
Aaron Durbin | a3a06ae | 2016-07-16 17:29:47 -0500 | [diff] [blame] | 101 | uint32_t *cbmem_loc; |
Subrata Banik | 097bd95 | 2017-07-24 19:09:31 +0530 | [diff] [blame] | 102 | const void *hob_list; |
Aaron Durbin | a3a06ae | 2016-07-16 17:29:47 -0500 | [diff] [blame] | 103 | cbmem_loc = cbmem_add(CBMEM_ID_FSP_RUNTIME, sizeof(*cbmem_loc)); |
Martin Roth | 53bd26f | 2016-11-18 12:02:18 -0700 | [diff] [blame] | 104 | if (cbmem_loc == NULL) |
| 105 | die("Error: Could not add cbmem area for hob list.\n"); |
Subrata Banik | 097bd95 | 2017-07-24 19:09:31 +0530 | [diff] [blame] | 106 | hob_list = fsp_get_hob_list(); |
| 107 | if (!hob_list) |
| 108 | die("Error: Could not locate hob list pointer.\n"); |
| 109 | *cbmem_loc = (uintptr_t)hob_list; |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 110 | } |
| 111 | |
Kyösti Mälkki | fa3bc04 | 2022-03-31 07:40:10 +0300 | [diff] [blame] | 112 | CBMEM_CREATION_HOOK(save_hob_list); |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 113 | |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 114 | const void *fsp_get_hob_list(void) |
| 115 | { |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 116 | uint32_t *list_loc; |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 117 | |
Kyösti Mälkki | 11cac78 | 2022-04-07 07:16:48 +0300 | [diff] [blame] | 118 | if (ENV_RAMINIT) |
Arthur Heymans | 75c2015 | 2019-05-25 10:37:26 +0200 | [diff] [blame] | 119 | return fsp_hob_list_ptr; |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 120 | list_loc = cbmem_find(CBMEM_ID_FSP_RUNTIME); |
Aaron Durbin | a3a06ae | 2016-07-16 17:29:47 -0500 | [diff] [blame] | 121 | return (list_loc) ? (void *)(uintptr_t)(*list_loc) : NULL; |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 124 | void *fsp_get_hob_list_ptr(void) |
| 125 | { |
Arthur Heymans | 75c2015 | 2019-05-25 10:37:26 +0200 | [diff] [blame] | 126 | return &fsp_hob_list_ptr; |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Felix Held | 79db987 | 2022-11-09 16:09:17 +0100 | [diff] [blame] | 129 | enum cb_err fsp_hob_iterator_init(const struct hob_header **hob_iterator) |
| 130 | { |
| 131 | *hob_iterator = fsp_get_hob_list(); |
| 132 | return *hob_iterator ? CB_SUCCESS : CB_ERR; |
| 133 | } |
| 134 | |
| 135 | static enum cb_err fsp_hob_iterator_get_next(const struct hob_header **hob_iterator, |
| 136 | uint16_t hob_type, |
| 137 | const struct hob_header **hob) |
| 138 | { |
| 139 | const struct hob_header *current_hob; |
| 140 | while ((*hob_iterator)->type != HOB_TYPE_END_OF_HOB_LIST) { |
| 141 | current_hob = *hob_iterator; |
| 142 | *hob_iterator = fsp_next_hob(*hob_iterator); |
| 143 | if (current_hob->type == hob_type) { |
| 144 | *hob = current_hob; |
| 145 | return CB_SUCCESS; |
| 146 | } |
| 147 | } |
| 148 | return CB_ERR; |
| 149 | } |
| 150 | |
| 151 | enum cb_err fsp_hob_iterator_get_next_resource(const struct hob_header **hob_iterator, |
| 152 | const struct hob_resource **res) |
| 153 | { |
| 154 | const struct hob_header *hob; |
| 155 | while (fsp_hob_iterator_get_next(hob_iterator, HOB_TYPE_RESOURCE_DESCRIPTOR, &hob) == CB_SUCCESS) { |
| 156 | *res = fsp_hob_header_to_resource(hob); |
| 157 | return CB_SUCCESS; |
| 158 | } |
| 159 | return CB_ERR; |
| 160 | } |
| 161 | |
| 162 | enum cb_err fsp_hob_iterator_get_next_guid_resource(const struct hob_header **hob_iterator, |
| 163 | const uint8_t guid[16], |
| 164 | const struct hob_resource **res) |
| 165 | { |
| 166 | const struct hob_resource *res_hob; |
| 167 | while (fsp_hob_iterator_get_next_resource(hob_iterator, &res_hob) == CB_SUCCESS) { |
| 168 | if (fsp_guid_compare(res_hob->owner_guid, guid)) { |
| 169 | *res = res_hob; |
| 170 | return CB_SUCCESS; |
| 171 | } |
| 172 | } |
| 173 | return CB_ERR; |
| 174 | } |
| 175 | |
| 176 | enum cb_err fsp_hob_iterator_get_next_guid_extension(const struct hob_header **hob_iterator, |
| 177 | const uint8_t guid[16], |
| 178 | const void **data, size_t *size) |
| 179 | { |
| 180 | const struct hob_header *hob; |
| 181 | const uint8_t *guid_hob; |
| 182 | while (fsp_hob_iterator_get_next(hob_iterator, HOB_TYPE_GUID_EXTENSION, &hob) == CB_SUCCESS) { |
| 183 | guid_hob = hob_header_to_struct(hob); |
| 184 | if (fsp_guid_compare(guid_hob, guid)) { |
| 185 | *size = hob->length - (HOB_HEADER_LEN + 16); |
| 186 | *data = hob_header_to_extension_hob(hob); |
| 187 | return CB_SUCCESS; |
| 188 | } |
| 189 | } |
| 190 | return CB_ERR; |
| 191 | } |
| 192 | |
Felix Held | 50c0a6d | 2022-11-14 22:11:56 +0100 | [diff] [blame] | 193 | void fsp_print_guid(int level, const void *base) |
Lee Leahy | 52d0c68 | 2016-08-01 15:47:42 -0700 | [diff] [blame] | 194 | { |
| 195 | uint32_t big; |
| 196 | uint16_t mid[2]; |
| 197 | |
| 198 | const uint8_t *id = base; |
| 199 | big = read32(id + 0); |
| 200 | mid[0] = read16(id + 4); |
| 201 | mid[1] = read16(id + 6); |
| 202 | |
Felix Held | 50c0a6d | 2022-11-14 22:11:56 +0100 | [diff] [blame] | 203 | printk(level, "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x", |
Lee Leahy | 52d0c68 | 2016-08-01 15:47:42 -0700 | [diff] [blame] | 204 | big, mid[0], mid[1], |
| 205 | id[8], id[9], id[10], id[11], id[12], id[13], id[14], id[15]); |
| 206 | } |
| 207 | |
| 208 | int fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16]) |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 209 | { |
Felix Held | 2516947 | 2022-11-12 01:42:39 +0100 | [diff] [blame] | 210 | const struct hob_header *hob_iterator; |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 211 | const struct hob_resource *fsp_mem; |
| 212 | |
Felix Held | 2516947 | 2022-11-12 01:42:39 +0100 | [diff] [blame] | 213 | if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) |
Subrata Banik | 097bd95 | 2017-07-24 19:09:31 +0530 | [diff] [blame] | 214 | return -1; |
| 215 | |
Aaron Durbin | 0fcd6f9 | 2016-03-08 11:23:52 -0600 | [diff] [blame] | 216 | range_entry_init(re, 0, 0, 0); |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 217 | |
Felix Held | 2516947 | 2022-11-12 01:42:39 +0100 | [diff] [blame] | 218 | if (fsp_hob_iterator_get_next_guid_resource(&hob_iterator, guid, &fsp_mem) != CB_SUCCESS) { |
Felix Held | 50c0a6d | 2022-11-14 22:11:56 +0100 | [diff] [blame] | 219 | fsp_print_guid(BIOS_SPEW, guid); |
Lee Leahy | 52d0c68 | 2016-08-01 15:47:42 -0700 | [diff] [blame] | 220 | printk(BIOS_SPEW, " not found!\n"); |
| 221 | return -1; |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 222 | } |
| 223 | |
Aaron Durbin | 0fcd6f9 | 2016-03-08 11:23:52 -0600 | [diff] [blame] | 224 | range_entry_init(re, fsp_mem->addr, fsp_mem->addr + fsp_mem->length, 0); |
Lee Leahy | 52d0c68 | 2016-08-01 15:47:42 -0700 | [diff] [blame] | 225 | return 0; |
| 226 | } |
| 227 | |
Michael Niewöhner | bc1dbb3 | 2019-10-24 22:58:25 +0200 | [diff] [blame] | 228 | void fsp_find_reserved_memory(struct range_entry *re) |
Lee Leahy | 52d0c68 | 2016-08-01 15:47:42 -0700 | [diff] [blame] | 229 | { |
Michael Niewöhner | bc1dbb3 | 2019-10-24 22:58:25 +0200 | [diff] [blame] | 230 | if (fsp_find_range_hob(re, fsp_reserved_memory_guid)) |
| 231 | die("9.1: FSP_RESERVED_MEMORY_RESOURCE_HOB missing!\n"); |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 232 | } |
| 233 | |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 234 | const void *fsp_find_extension_hob_by_guid(const uint8_t *guid, size_t *size) |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 235 | { |
Felix Held | e2949b7 | 2022-11-12 01:52:52 +0100 | [diff] [blame] | 236 | const struct hob_header *hob_iterator; |
| 237 | const void *hob_guid; |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 238 | |
Felix Held | e2949b7 | 2022-11-12 01:52:52 +0100 | [diff] [blame] | 239 | if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 240 | return NULL; |
| 241 | |
Felix Held | e2949b7 | 2022-11-12 01:52:52 +0100 | [diff] [blame] | 242 | if (fsp_hob_iterator_get_next_guid_extension(&hob_iterator, guid, &hob_guid, size) == CB_SUCCESS) |
| 243 | return hob_guid; |
Alexandru Gagniuc | 9b2e9bd | 2016-02-25 14:20:38 -0800 | [diff] [blame] | 244 | |
| 245 | return NULL; |
| 246 | } |
Hannah Williams | 3503b3f | 2016-03-04 12:14:52 -0800 | [diff] [blame] | 247 | |
Elyes HAOUAS | 83b6283 | 2020-08-07 15:28:51 +0200 | [diff] [blame] | 248 | static void display_fsp_version_info_hob(const void *hob) |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 249 | { |
Ronak Kanabar | c776246 | 2020-10-01 19:22:51 +0530 | [diff] [blame] | 250 | #if CONFIG(DISPLAY_FSP_VERSION_INFO) || CONFIG(DISPLAY_FSP_VERSION_INFO_2) |
| 251 | |
| 252 | int index, cnt, tcount; |
| 253 | char *str_ptr; |
| 254 | uint8_t vs; |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 255 | #if CONFIG(DISPLAY_FSP_VERSION_INFO) |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 256 | const FIRMWARE_VERSION_INFO *fvi; |
Felix Held | 9405dd0 | 2022-11-08 21:14:34 +0100 | [diff] [blame] | 257 | const FIRMWARE_VERSION_INFO_HOB *fvih = (FIRMWARE_VERSION_INFO_HOB *)hob; |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 258 | |
| 259 | fvi = (void *)&fvih[1]; |
Felix Held | 9405dd0 | 2022-11-08 21:14:34 +0100 | [diff] [blame] | 260 | str_ptr = (char *)((uintptr_t)fvi + (fvih->Count * sizeof(FIRMWARE_VERSION_INFO))); |
Ronak Kanabar | c776246 | 2020-10-01 19:22:51 +0530 | [diff] [blame] | 261 | tcount = fvih->Count; |
| 262 | #elif CONFIG(DISPLAY_FSP_VERSION_INFO_2) |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 263 | |
Ronak Kanabar | c776246 | 2020-10-01 19:22:51 +0530 | [diff] [blame] | 264 | uint8_t *hobstart = (uint8_t *) hob; |
| 265 | hobstart += sizeof(EFI_HOB_GUID_TYPE); |
| 266 | |
| 267 | const SMBIOS_TABLE_TYPE_OEM_INTEL_FVI *stfvi = |
| 268 | (SMBIOS_TABLE_TYPE_OEM_INTEL_FVI *)hobstart; |
| 269 | const INTEL_FIRMWARE_VERSION_INFO *fvi; |
| 270 | |
| 271 | str_ptr = ((char *) &(stfvi->Fvi[0])) + |
| 272 | (stfvi->Count * sizeof(INTEL_FIRMWARE_VERSION_INFO)); |
| 273 | tcount = stfvi->Count; |
| 274 | fvi = &stfvi->Fvi[0]; |
| 275 | #endif |
| 276 | |
| 277 | for (index = 0; index < tcount; index++) { |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 278 | cnt = strlen(str_ptr); |
| 279 | |
Ronak Kanabar | c776246 | 2020-10-01 19:22:51 +0530 | [diff] [blame] | 280 | #if CONFIG(DISPLAY_FSP_VERSION_INFO) |
| 281 | vs = fvi[index].VersionStringIndex; |
| 282 | #elif CONFIG(DISPLAY_FSP_VERSION_INFO_2) |
| 283 | vs = fvi[index].VersionString; |
| 284 | #endif |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 285 | /* Don't show ingredient name and version if its all 0xFF */ |
| 286 | if (fvi[index].Version.MajorVersion == 0xFF && |
Elyes HAOUAS | 365cb14 | 2019-05-19 23:31:48 +0200 | [diff] [blame] | 287 | fvi[index].Version.MinorVersion == 0xFF && |
| 288 | fvi[index].Version.Revision == 0xFF && |
| 289 | fvi[index].Version.BuildNumber == 0xFF && |
Ronak Kanabar | c776246 | 2020-10-01 19:22:51 +0530 | [diff] [blame] | 290 | vs == 0) { |
Felix Held | 9405dd0 | 2022-11-08 21:14:34 +0100 | [diff] [blame] | 291 | str_ptr = (char *)((uintptr_t)str_ptr + cnt + sizeof(uint8_t)); |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 292 | continue; |
| 293 | } |
| 294 | /* |
Elyes HAOUAS | 8bffebe | 2018-05-27 22:45:31 +0200 | [diff] [blame] | 295 | * Firmware Version String consist of 2 pieces of information |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 296 | * 1. Component Name: string type data holds FW type name. |
| 297 | * 2. Version Information : Either a string type data or |
| 298 | * numeric field holds FW version information. |
| 299 | */ |
| 300 | printk(BIOS_DEBUG, "%s = ", str_ptr); |
| 301 | |
Ronak Kanabar | c776246 | 2020-10-01 19:22:51 +0530 | [diff] [blame] | 302 | if (!vs) |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 303 | printk(BIOS_DEBUG, "%x.%x.%x.%x\n", |
| 304 | fvi[index].Version.MajorVersion, |
| 305 | fvi[index].Version.MinorVersion, |
| 306 | fvi[index].Version.Revision, |
| 307 | fvi[index].Version.BuildNumber); |
| 308 | else { |
Felix Held | 9405dd0 | 2022-11-08 21:14:34 +0100 | [diff] [blame] | 309 | str_ptr = (char *)((uintptr_t)str_ptr + cnt + sizeof(uint8_t)); |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 310 | cnt = strlen(str_ptr); |
| 311 | printk(BIOS_DEBUG, "%s\n", str_ptr); |
| 312 | } |
Felix Held | 9405dd0 | 2022-11-08 21:14:34 +0100 | [diff] [blame] | 313 | str_ptr = (char *)((uintptr_t)str_ptr + cnt + sizeof(uint8_t)); |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 314 | } |
| 315 | #endif |
| 316 | } |
| 317 | |
| 318 | void fsp_display_fvi_version_hob(void) |
| 319 | { |
| 320 | const uint8_t *hob_uuid; |
| 321 | const struct hob_header *hob = fsp_get_hob_list(); |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 322 | |
| 323 | if (!hob) |
| 324 | return; |
| 325 | |
Subrata Banik | 90557f4 | 2020-03-25 18:40:41 +0530 | [diff] [blame] | 326 | printk(BIOS_DEBUG, "Display FSP Version Info HOB\n"); |
Felix Held | 9405dd0 | 2022-11-08 21:14:34 +0100 | [diff] [blame] | 327 | for (; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = fsp_next_hob(hob)) { |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 328 | if (hob->type != HOB_TYPE_GUID_EXTENSION) |
| 329 | continue; |
| 330 | |
| 331 | hob_uuid = hob_header_to_struct(hob); |
| 332 | |
| 333 | if (fsp_guid_compare(hob_uuid, uuid_fv_info)) { |
Elyes HAOUAS | 83b6283 | 2020-08-07 15:28:51 +0200 | [diff] [blame] | 334 | display_fsp_version_info_hob(hob); |
Subrata Banik | 73b67dc | 2018-01-23 16:31:03 +0530 | [diff] [blame] | 335 | } |
| 336 | } |
| 337 | } |
| 338 | |
Hannah Williams | 3503b3f | 2016-03-04 12:14:52 -0800 | [diff] [blame] | 339 | const void *fsp_find_nv_storage_data(size_t *size) |
| 340 | { |
Anil Kumar | 0dd0368 | 2021-11-24 14:31:04 -0800 | [diff] [blame] | 341 | if (CONFIG(PLATFORM_USES_FSP2_3)) { |
| 342 | const struct fsp_nvs_hob2_data_region_header *hob; |
| 343 | |
| 344 | hob = (const struct fsp_nvs_hob2_data_region_header *) |
| 345 | fsp_find_extension_hob_by_guid(fsp_nv_storage_guid_2, size); |
| 346 | if (hob != NULL) { |
| 347 | *size = hob->nvs_data_length; |
| 348 | return (void *)(uintptr_t)hob->nvs_data_ptr; |
| 349 | } |
| 350 | } |
Lee Leahy | ac3b0a6 | 2016-07-27 07:40:25 -0700 | [diff] [blame] | 351 | return fsp_find_extension_hob_by_guid(fsp_nv_storage_guid, size); |
Hannah Williams | 3503b3f | 2016-03-04 12:14:52 -0800 | [diff] [blame] | 352 | } |
Michael Niewöhner | 68da454 | 2019-10-19 11:57:05 +0200 | [diff] [blame] | 353 | |
| 354 | void fsp_find_bootloader_tolum(struct range_entry *re) |
| 355 | { |
| 356 | if (fsp_find_range_hob(re, fsp_bootloader_tolum_guid)) |
| 357 | die("9.3: FSP_BOOTLOADER_TOLUM_HOB missing!\n"); |
| 358 | } |