From b4b7560a9ee7c0c4f82a55ed9c592733c30d3abc Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sun, 25 Aug 2024 20:00:23 +0200 Subject: mb/qemu-i440fx/rom_media: Use MEM_REGION_DEV_INIT() for boot_dev `boot_dev` can be const, and we can use MEM_REGION_DEV_INIT() as all the values are known at compile time. Change-Id: Icd3757ba4b5e8bfbee9e9c9d18bf0ee71520a8ac Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/84089 Reviewed-by: Arthur Heymans Reviewed-by: Krystian Hebel Tested-by: build bot (Jenkins) --- src/mainboard/emulation/qemu-i440fx/rom_media.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mainboard/emulation/qemu-i440fx/rom_media.c b/src/mainboard/emulation/qemu-i440fx/rom_media.c index d2469bade2..f4fd3c3775 100644 --- a/src/mainboard/emulation/qemu-i440fx/rom_media.c +++ b/src/mainboard/emulation/qemu-i440fx/rom_media.c @@ -97,7 +97,8 @@ static ssize_t qemu_eraseat(const struct region_device *rd, size_t offset, } static struct region_device_ops flash_ops; -static struct mem_region_device boot_dev; +static const struct mem_region_device boot_dev = + MEM_REGION_DEV_INIT(0x100000000ULL - CONFIG_ROM_SIZE, CONFIG_ROM_SIZE, &flash_ops); /* * Depending on how firmware image was passed to QEMU, it may behave as: @@ -133,10 +134,6 @@ void boot_device_init(void) */ flash_ops = mem_rdev_rw_ops; - boot_dev.base = (void *)(uintptr_t)(0x100000000ULL - CONFIG_ROM_SIZE); - boot_dev.rdev.ops = &flash_ops; - boot_dev.rdev.region.size = CONFIG_ROM_SIZE; - /* * Find first byte different than any of the commands, simplified. * -- cgit v1.2.3