From c893197352acc9b53c1beef5082cbc0271f63688 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 16 Apr 2021 16:48:32 -0700 Subject: 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 Change-Id: Ie4c763b77f77d227768556a9528681d771a08dca Reviewed-on: https://review.coreboot.org/c/coreboot/+/52533 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/drivers/elog/elog.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/drivers/elog/elog.c') diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c index 82df989e25..4769559ca0 100644 --- a/src/drivers/elog/elog.c +++ b/src/drivers/elog/elog.c @@ -44,7 +44,7 @@ struct elog_state { struct region_device nv_dev; /* Device that mirrors the eventlog in memory. */ - struct mem_region_device mirror_dev; + struct region_device mirror_dev; enum elog_init_state elog_initialized; }; @@ -56,7 +56,7 @@ static uint8_t elog_mirror_buf[ELOG_SIZE]; static inline struct region_device *mirror_dev_get(void) { - return &elog_state.mirror_dev.rdev; + return &elog_state.mirror_dev; } static size_t elog_events_start(void) @@ -798,8 +798,7 @@ int elog_init(void) printk(BIOS_ERR, "ELOG: Unable to allocate backing store\n"); return -1; } - mem_region_device_rw_init(&elog_state.mirror_dev, mirror_buffer, - elog_size); + rdev_chain_mem_rw(&elog_state.mirror_dev, mirror_buffer, elog_size); /* * Mark as initialized to allow elog_init() to be called and deemed -- cgit v1.2.3