summaryrefslogtreecommitdiff
path: root/src/drivers/intel
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2021-04-16 16:48:32 -0700
committerJulius Werner <jwerner@chromium.org>2021-04-21 02:06:26 +0000
commitc893197352acc9b53c1beef5082cbc0271f63688 (patch)
treeb975712387bd54bd0101a736adbb2a6fe5b824bb /src/drivers/intel
parentb03e497ef16e9e38ba9220d31131a6bfdef35390 (diff)
commonlib/region: Turn addrspace_32bit into a more official API
We had the addrspace_32bit rdev in prog_loaders.c for a while to help represent memory ranges as an rdev, and we've found it useful for a couple of things that have nothing to do with program loading. This patch moves the concept straight into commonlib/region.c so it is no longer anchored in such a weird place, and easier to use in unit tests. Also expand the concept to the whole address space (there's no real need to restrict it to 32 bits in 64-bit environments) and introduce an rdev_chain_mem() helper function to make it a bit easier to use. Replace some direct uses of struct mem_region_device with this new API where it seems to make sense. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ie4c763b77f77d227768556a9528681d771a08dca Reviewed-on: https://review.coreboot.org/c/coreboot/+/52533 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers/intel')
-rw-r--r--src/drivers/intel/gma/opregion.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c
index e1ed6c8285..cf2c5d9846 100644
--- a/src/drivers/intel/gma/opregion.c
+++ b/src/drivers/intel/gma/opregion.c
@@ -128,16 +128,14 @@ static enum cb_err locate_vbt_vbios(const u8 *vbios, struct region_device *rdev)
size_t offset;
// FIXME: caller should supply a region_device instead of vbios pointer
- if (rdev_chain(&rd, &addrspace_32bit.rdev, (uintptr_t)vbios,
- sizeof(*oprom)))
+ if (rdev_chain_mem(&rd, vbios, sizeof(*oprom)))
return CB_ERR;
if (rdev_readat(&rd, &opromsize, offsetof(optionrom_header_t, size),
sizeof(opromsize)) != sizeof(opromsize) || !opromsize)
return CB_ERR;
- if (rdev_chain(&rd, &addrspace_32bit.rdev, (uintptr_t)vbios,
- opromsize * 512))
+ if (rdev_chain_mem(&rd, vbios, opromsize * 512))
return CB_ERR;
oprom = rdev_mmap(&rd, 0, sizeof(*oprom));
@@ -200,8 +198,7 @@ static enum cb_err locate_vbt_cbfs(struct region_device *rdev)
if (vbt == NULL)
return CB_ERR;
- if (rdev_chain(rdev, &addrspace_32bit.rdev, (uintptr_t)vbt,
- vbt_data_size))
+ if (rdev_chain_mem(rdev, vbt, vbt_data_size))
return CB_ERR;
printk(BIOS_INFO, "GMA: Found VBT in CBFS\n");