libpayload: Cache physical location of cb_table entries

In the presence of self-relocating payloads, it's safer to keep
physical addresses in `libsysinfo`. This updates all the references
to coreboot-table entries that are not consumed inside libpayload
code.

Change-Id: I95cb0af151e0707a1656deacddb8a5253ea38fc3
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43579
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Nico Huber 2020-07-18 16:15:42 +02:00 committed by Patrick Georgi
parent 5e0db58533
commit 12faea3095
2 changed files with 4 additions and 4 deletions

View File

@ -91,8 +91,8 @@ struct sysinfo_t {
unsigned long *mbtable; /** Pointer to the multiboot table */ unsigned long *mbtable; /** Pointer to the multiboot table */
struct cb_header *header; uintptr_t cb_header;
struct cb_mainboard *mainboard; uintptr_t cb_mainboard;
void *vboot_workbuf; void *vboot_workbuf;

View File

@ -287,7 +287,7 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
header->table_bytes) != header->table_checksum) header->table_bytes) != header->table_checksum)
return -1; return -1;
info->header = header; info->cb_header = virt_to_phys(header);
/* Initialize IDs as undefined in case they don't show up in table. */ /* Initialize IDs as undefined in case they don't show up in table. */
info->board_id = UNDEFINED_STRAPPING_ID; info->board_id = UNDEFINED_STRAPPING_ID;
@ -358,7 +358,7 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
break; break;
#endif #endif
case CB_TAG_MAINBOARD: case CB_TAG_MAINBOARD:
info->mainboard = (struct cb_mainboard *)ptr; info->cb_mainboard = virt_to_phys(ptr);
break; break;
case CB_TAG_GPIO: case CB_TAG_GPIO:
cb_parse_gpios(ptr, info); cb_parse_gpios(ptr, info);