From 77639e4537cc9e56e65880e022e154af6d042453 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 5 Feb 2021 16:51:25 -0800 Subject: cbfs: Replace more instances of cbfs_boot_locate() with newer APIs In pursuit of the eventual goal of removing cbfs_boot_locate() (and direct rdev access) from CBFS APIs, this patch replaces all remaining "simple" uses of the function call that can easily be replaced by the newer APIs (like cbfs_load() or cbfs_map()). Some cases of cbfs_boot_locate() remain that will be more complicated to solve. Signed-off-by: Julius Werner Change-Id: Icd0f21e2fa49c7cc834523578b7b45b5482cb1a8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50348 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/cpu/x86/pae/pgtbl.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'src/cpu') diff --git a/src/cpu/x86/pae/pgtbl.c b/src/cpu/x86/pae/pgtbl.c index 145a31b7cc..814dbf5c70 100644 --- a/src/cpu/x86/pae/pgtbl.c +++ b/src/cpu/x86/pae/pgtbl.c @@ -321,42 +321,17 @@ void paging_set_default_pat(void) paging_set_pat(pat); } -static int read_from_cbfs(const char *name, void *buf, size_t size) -{ - struct cbfsf fh; - struct region_device rdev; - size_t rdev_sz; - - if (cbfs_boot_locate(&fh, name, NULL)) - return -1; - - cbfs_file_data(&rdev, &fh); - - rdev_sz = region_device_sz(&rdev); - - if (size < rdev_sz) { - printk(BIOS_ERR, "%s region too small to load: %zx < %zx\n", - name, size, rdev_sz); - return -1; - } - - if (rdev_readat(&rdev, buf, 0, rdev_sz) != rdev_sz) - return -1; - - return 0; -} - int paging_enable_for_car(const char *pdpt_name, const char *pt_name) { if (!preram_symbols_available()) return -1; - if (read_from_cbfs(pdpt_name, _pdpt, REGION_SIZE(pdpt))) { + if (!cbfs_load(pdpt_name, _pdpt, REGION_SIZE(pdpt))) { printk(BIOS_ERR, "Couldn't load pdpt\n"); return -1; } - if (read_from_cbfs(pt_name, _pagetables, REGION_SIZE(pagetables))) { + if (!cbfs_load(pt_name, _pagetables, REGION_SIZE(pagetables))) { printk(BIOS_ERR, "Couldn't load page tables\n"); return -1; } -- cgit v1.2.3