diff options
author | Nico Huber <nico.h@gmx.de> | 2024-01-11 18:50:50 +0100 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2024-01-14 02:06:11 +0000 |
commit | d7612e97651b75ba2d157ca89bd108c5172ab2c6 (patch) | |
tree | dd4542534c439bdb64a8d13e65fcd32907de963b /src | |
parent | 8a6045c3d0d987e0fca88f8e5e2fc88f25b51e0a (diff) |
tree: Use accessor functions for struct region fields
Always use the high-level API region_offset() and region_sz()
functions. This excludes the internal `region.c` code as well
as unit tests. FIT payload support was also skipped, as it
seems it never tried to use the API and would need a bigger
overhaul.
Change-Id: Iaae116a1ab2da3b2ea2a5ebcd0c300b238582834
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79904
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/x86/smm/smm_module_loader.c | 2 | ||||
-rw-r--r-- | src/lib/fmap.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c index f827e7b28f..d965593c55 100644 --- a/src/cpu/x86/smm/smm_module_loader.c +++ b/src/cpu/x86/smm/smm_module_loader.c @@ -363,7 +363,7 @@ static int append_and_check_region(const struct region smram, { unsigned int region_counter = 0; for (; region_counter < SMM_REGIONS_ARRAY_SIZE; region_counter++) - if (region_list[region_counter].size == 0) + if (region_sz(®ion_list[region_counter]) == 0) break; if (region_counter >= SMM_REGIONS_ARRAY_SIZE) { diff --git a/src/lib/fmap.c b/src/lib/fmap.c index 8901ff7ce2..75c5a9fb1c 100644 --- a/src/lib/fmap.c +++ b/src/lib/fmap.c @@ -235,15 +235,15 @@ int fmap_find_region_name(const struct region * const ar, if (area == NULL) return -1; - if ((ar->offset != le32toh(area->offset)) || - (ar->size != le32toh(area->size))) { + if (region_offset(ar) != le32toh(area->offset) || + region_sz(ar) != le32toh(area->size)) { rdev_munmap(&fmrd, area); offset += sizeof(struct fmap_area); continue; } printk(BIOS_DEBUG, "FMAP: area (%zx, %zx) found, named %s\n", - ar->offset, ar->size, area->name); + region_offset(ar), region_sz(ar), area->name); memcpy(name, area->name, FMAP_STRLEN); @@ -253,7 +253,7 @@ int fmap_find_region_name(const struct region * const ar, } printk(BIOS_DEBUG, "FMAP: area (%zx, %zx) not found\n", - ar->offset, ar->size); + region_offset(ar), region_sz(ar)); return -1; } |