aboutsummaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorSimon Glass2023-01-17 10:47:41 -0700
committerTom Rini2023-01-23 18:11:40 -0500
commitdcffa4428d0359fd09348fc05cf5b5ce2db38c5f (patch)
tree4768322f3c36e6a8537b5df083ab68b44b2fd071 /test/dm
parent4146c823fc27c1a4e06d1d25e0a2d4644948a5fc (diff)
part: Add a function to find the first bootable partition
If a disk has a bootable partition we are expected to use it to locate the boot files. Add a function to find it. To test this, update mmc1 to have two paritions, fixing up other tests accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/part.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/dm/part.c b/test/dm/part.c
index b60687114f1..35e99eeb01a 100644
--- a/test/dm/part.c
+++ b/test/dm/part.c
@@ -93,3 +93,16 @@ static int dm_test_part(struct unit_test_state *uts)
return ret;
}
DM_TEST(dm_test_part, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+static int dm_test_part_bootable(struct unit_test_state *uts)
+{
+ struct blk_desc *desc;
+ struct udevice *dev;
+
+ ut_assertok(uclass_get_device_by_name(UCLASS_BLK, "mmc1.blk", &dev));
+ desc = dev_get_uclass_plat(dev);
+ ut_asserteq(1, part_get_bootable(desc));
+
+ return 0;
+}
+DM_TEST(dm_test_part_bootable, UT_TESTF_SCAN_FDT);