diff options
author | Bin Meng <bmeng@tinylab.org> | 2023-09-26 16:43:33 +0800 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-10 16:19:43 -0400 |
commit | 8897faba2d1d2e6802cd066580100685baa46f7f (patch) | |
tree | 2589c2bb478a4c1f50c5b4e6d0f6fdf3c616406b /test/dm | |
parent | 77ca9d74571e92969591d39df134ccd72296f4d9 (diff) | |
download | u-boot-8897faba2d1d2e6802cd066580100685baa46f7f.tar.gz u-boot-8897faba2d1d2e6802cd066580100685baa46f7f.tar.bz2 u-boot-8897faba2d1d2e6802cd066580100685baa46f7f.zip |
blk: sandbox: Support binding a device with a given logical block size
Allow optionally set the logical block size of the host device to
bind in the "host bind" command. If not given, defaults to 512.
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/blk.c | 7 | ||||
-rw-r--r-- | test/dm/host.c | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/test/dm/blk.c b/test/dm/blk.c index 446c4423e6..799f1e4dc7 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <blk.h> #include <dm.h> #include <part.h> #include <sandbox_host.h> @@ -22,8 +23,8 @@ static int dm_test_blk_base(struct unit_test_state *uts) struct udevice *blk0, *blk1, *dev0, *dev1, *dev, *chk0, *chk1; /* Create two, one the parent of the other */ - ut_assertok(host_create_device("test0", false, &dev0)); - ut_assertok(host_create_device("test1", false, &dev1)); + ut_assertok(host_create_device("test0", false, DEFAULT_BLKSZ, &dev0)); + ut_assertok(host_create_device("test1", false, DEFAULT_BLKSZ, &dev1)); /* Check we can find them */ ut_assertok(blk_get_device(UCLASS_HOST, 0, &blk0)); @@ -99,7 +100,7 @@ static int dm_test_blk_find(struct unit_test_state *uts) { struct udevice *blk, *chk, *dev; - ut_assertok(host_create_device("test0", false, &dev)); + ut_assertok(host_create_device("test0", false, DEFAULT_BLKSZ, &dev)); ut_assertok(blk_find_device(UCLASS_HOST, 0, &chk)); ut_assertok(device_find_first_child_by_uclass(dev, UCLASS_BLK, &blk)); diff --git a/test/dm/host.c b/test/dm/host.c index 85f21f9839..4f623d9b04 100644 --- a/test/dm/host.c +++ b/test/dm/host.c @@ -31,7 +31,7 @@ static int dm_test_host(struct unit_test_state *uts) ut_asserteq(-ENODEV, uclass_first_device_err(UCLASS_PARTITION, &part)); mem_start = ut_check_delta(0); - ut_assertok(host_create_device(label, true, &dev)); + ut_assertok(host_create_device(label, true, DEFAULT_BLKSZ, &dev)); /* Check that the plat data has been allocated */ plat = dev_get_plat(dev); @@ -83,7 +83,7 @@ static int dm_test_host_dup(struct unit_test_state *uts) char fname[256]; ut_asserteq(0, uclass_id_count(UCLASS_HOST)); - ut_assertok(host_create_device(label, true, &dev)); + ut_assertok(host_create_device(label, true, DEFAULT_BLKSZ, &dev)); /* Attach a file created in test_ut_dm_init */ ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img")); @@ -93,7 +93,7 @@ static int dm_test_host_dup(struct unit_test_state *uts) ut_asserteq(1, uclass_id_count(UCLASS_HOST)); /* Create another device with the same label (should remove old one) */ - ut_assertok(host_create_device(label, true, &dev)); + ut_assertok(host_create_device(label, true, DEFAULT_BLKSZ, &dev)); /* Attach a different file created in test_ut_dm_init */ ut_assertok(os_persistent_file(fname, sizeof(fname), "1MB.fat32.img")); |