1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +02:00

libflashrom: Add layout "exclude" API

Layouts can be expensive to derive (reading from flash), so we might
want to reuse a layout for different purposes. Today, it's not possible
to undo a flashrom_layout_include_region() operation (to, say, operate
on a different region). Add such an API.

Change-Id: I7ea3e0674f25e34bf2cfc8f464ae7ca1c1a3fbfd
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/76005
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
This commit is contained in:
Brian Norris
2023-06-22 11:07:18 -07:00
committed by Edward O'Callaghan
parent 91aa2d8526
commit e08899fcf4
5 changed files with 58 additions and 0 deletions

View File

@ -110,6 +110,8 @@ void layout_pass_sanity_checks_test_success(void **state)
unsigned int region_start = 0x00021000;
unsigned int region_end = 0x00031000;
unsigned int region2_start = 0x00041000;
unsigned int region2_end = 0x00051000;
unsigned int start = 0;
unsigned int len = 0;
@ -119,6 +121,9 @@ void layout_pass_sanity_checks_test_success(void **state)
assert_int_equal(0, flashrom_layout_new(&layout));
assert_int_equal(0, flashrom_layout_add_region(layout, region_start, region_end, "region"));
assert_int_equal(0, flashrom_layout_include_region(layout, "region"));
assert_int_equal(0, flashrom_layout_add_region(layout, region2_start, region2_end, "region2"));
assert_int_equal(0, flashrom_layout_include_region(layout, "region2"));
assert_int_equal(0, flashrom_layout_exclude_region(layout, "region2"));
printf("done\n");
printf("Asserting region range... ");