summaryrefslogtreecommitdiff
path: root/payloads/libpayload/arch
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2019-10-02 07:45:45 -0400
committerPatrick Georgi <pgeorgi@google.com>2019-10-03 15:27:30 +0000
commit006eb9d8c8550ce0e8d01d37cceb88e7c1e12a5e (patch)
tree51127b37fa176dafaa5391669dd0424f5abf1e6e /payloads/libpayload/arch
parentc49869b4249b89e21c2d106645029801cb01aaea (diff)
downloadcoreboot-006eb9d8c8550ce0e8d01d37cceb88e7c1e12a5e.tar.xz
libpayload: refactor fetching cbmem pointers
There's a recurring pattern of reading cbtable entries that point into cbmem entries. Move that pattern into its own function. Coccinelle patch used for this: @@ identifier T, T2; expression TARGET; @@ -struct cb_cbmem_tab *const T2 = (struct cb_cbmem_tab *)T; -TARGET = phys_to_virt(T2->cbmem_tab); +TARGET = get_cbmem_ptr(T); Change-Id: I7bd4a7ad8baeeaebf0fa7d4b4de6dbc719bc781f Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35756 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/arch')
-rw-r--r--payloads/libpayload/arch/x86/coreboot.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/payloads/libpayload/arch/x86/coreboot.c b/payloads/libpayload/arch/x86/coreboot.c
index 3a9eb1a7be..07adee8917 100644
--- a/payloads/libpayload/arch/x86/coreboot.c
+++ b/payloads/libpayload/arch/x86/coreboot.c
@@ -50,8 +50,7 @@ static void cb_parse_x86_rom_var_mtrr(void *ptr, struct sysinfo_t *info)
static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
{
- struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr;
- info->mrc_cache = phys_to_virt(cbmem->cbmem_tab);
+ info->mrc_cache = get_cbmem_ptr(ptr);
}
int cb_parse_arch_specific(struct cb_record *rec, struct sysinfo_t *info)