diff options
author | Julius Werner <jwerner@chromium.org> | 2021-02-05 16:51:25 -0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-03-17 08:10:20 +0000 |
commit | 77639e4537cc9e56e65880e022e154af6d042453 (patch) | |
tree | fea2b411d9d1d7a52d53630efaef5fd4363809c2 /src/cpu/x86/pae | |
parent | 81dc20e744aa1762c17dcf5aac5c37643d62a983 (diff) | |
download | coreboot-77639e4537cc9e56e65880e022e154af6d042453.tar.xz |
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 <jwerner@chromium.org>
Change-Id: Icd0f21e2fa49c7cc834523578b7b45b5482cb1a8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50348
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/cpu/x86/pae')
-rw-r--r-- | src/cpu/x86/pae/pgtbl.c | 29 |
1 files changed, 2 insertions, 27 deletions
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; } |