Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Tests for mbr command |
| 4 | * |
| 5 | * Copyright 2023 Matrox Video |
| 6 | * Written by Alex Gendin <agendin@matrox.com> |
| 7 | */ |
| 8 | |
| 9 | #include <dm.h> |
| 10 | #include <console.h> |
| 11 | #include <dm/test.h> |
| 12 | #include <mapmem.h> |
| 13 | #include <part.h> |
| 14 | #include <asm/global_data.h> |
| 15 | #include <dm/device-internal.h> |
| 16 | #include <dm/lists.h> |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 17 | #include <linux/sizes.h> |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 18 | #include <test/ut.h> |
| 19 | |
| 20 | DECLARE_GLOBAL_DATA_PTR; |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 21 | |
| 22 | #define BLKSZ SZ_512 /* block size */ |
| 23 | |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 24 | /* |
| 25 | * Requirements for running test manually: |
| 26 | * mmc6.img - File size needs to be at least 12 MiB |
| 27 | * |
| 28 | * Command to create mmc6.img: |
| 29 | * $ dd if=/dev/zero of=mmc6.img bs=12M count=1 |
| 30 | * |
| 31 | * To run this test manually, place mmc6.img into the same directory as u-boot, |
| 32 | * then run: |
| 33 | * $ ./u-boot -Tc 'ut mbr' |
| 34 | * |
| 35 | * To run this test as part of U-Boot test: |
| 36 | * $ ./test/py/test.py --bd sandbox --build -k ut_dm -v |
| 37 | * Note: mmc6.img will be created by the test suit. |
| 38 | */ |
| 39 | |
| 40 | static char * mbr_parts_header = "setenv mbr_parts '"; |
| 41 | static char * mbr_parts_p1 = "uuid_disk=0x12345678;name=p1,start=8M,bootable,size=1M,id=0x0e"; |
| 42 | static char * mbr_parts_p2 = ";name=p2,size=1M,id=0x0e"; |
| 43 | static char * mbr_parts_p3 = ";name=p3,size=1M,id=0x0e"; |
| 44 | static char * mbr_parts_p4 = ";name=p4,size=1M,id=0x0e"; |
| 45 | static char * mbr_parts_p5 = ";name=[ext],size=2M,id=0x05;name=p5,size=1M,id=0x0e"; |
| 46 | static char * mbr_parts_tail = "'"; |
| 47 | |
| 48 | /* |
| 49 | * One MBR partition |
| 50 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 51 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 00 |...%$..@........| |
| 52 | 000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 53 | 000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 54 | 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| |
| 55 | */ |
Simon Glass | 40d2a6e | 2024-09-01 16:26:21 -0600 | [diff] [blame] | 56 | static unsigned int mbr_cmp_start = 0x1b8; |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 57 | static unsigned mbr_cmp_size = 0x48; |
| 58 | static unsigned char mbr_parts_ref_p1[] = { |
| 59 | 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x80, 0x05, |
| 60 | 0x05, 0x01, 0x0e, 0x25, 0x24, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, |
| 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa |
| 64 | }; |
| 65 | |
| 66 | /* |
| 67 | * Two MBR partitions |
| 68 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 69 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| |
| 70 | 000001d0 25 01 0e 46 05 01 00 48 00 00 00 08 00 00 00 00 |%..F...H........| |
| 71 | 000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 72 | 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| |
| 73 | */ |
| 74 | static unsigned char mbr_parts_ref_p2[] = { |
| 75 | 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x80, 0x05, |
| 76 | 0x05, 0x01, 0x0e, 0x25, 0x24, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x25, |
| 77 | 0x25, 0x01, 0x0e, 0x46, 0x05, 0x01, 0x00, 0x48, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, |
| 78 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa |
| 80 | }; |
| 81 | |
| 82 | /* |
| 83 | * Three MBR partitions |
| 84 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 85 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| |
| 86 | 000001d0 25 01 0e 46 05 01 00 48 00 00 00 08 00 00 00 46 |%..F...H.......F| |
| 87 | 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 00 |...f%..P........| |
| 88 | 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| |
| 89 | */ |
| 90 | static unsigned char mbr_parts_ref_p3[] = { |
| 91 | 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x80, 0x05, |
| 92 | 0x05, 0x01, 0x0e, 0x25, 0x24, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x25, |
| 93 | 0x25, 0x01, 0x0e, 0x46, 0x05, 0x01, 0x00, 0x48, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x46, |
| 94 | 0x06, 0x01, 0x0e, 0x66, 0x25, 0x01, 0x00, 0x50, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, |
| 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa |
| 96 | }; |
| 97 | |
| 98 | /* |
| 99 | * Four MBR partitions |
| 100 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 101 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| |
| 102 | 000001d0 25 01 0e 46 05 01 00 48 00 00 00 08 00 00 00 46 |%..F...H.......F| |
| 103 | 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 66 |...f%..P.......f| |
| 104 | 000001f0 26 01 0e 87 06 01 00 58 00 00 00 08 00 00 55 aa |&......X......U.| |
| 105 | */ |
| 106 | static unsigned char mbr_parts_ref_p4[] = { |
| 107 | 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x80, 0x05, |
| 108 | 0x05, 0x01, 0x0e, 0x25, 0x24, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x25, |
| 109 | 0x25, 0x01, 0x0e, 0x46, 0x05, 0x01, 0x00, 0x48, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x46, |
| 110 | 0x06, 0x01, 0x0e, 0x66, 0x25, 0x01, 0x00, 0x50, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x66, |
| 111 | 0x26, 0x01, 0x0e, 0x87, 0x06, 0x01, 0x00, 0x58, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x55, 0xaa |
| 112 | }; |
| 113 | |
| 114 | /* |
| 115 | * Five MBR partitions |
| 116 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 117 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| |
| 118 | 000001d0 25 01 0e 46 05 01 00 48 00 00 00 08 00 00 00 46 |%..F...H.......F| |
| 119 | 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 66 |...f%..P.......f| |
| 120 | 000001f0 26 01 05 a7 26 01 00 58 00 00 00 10 00 00 55 aa |&...&..X......U.| |
| 121 | */ |
| 122 | static unsigned char mbr_parts_ref_p5[] = { |
| 123 | 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x80, 0x05, |
| 124 | 0x05, 0x01, 0x0e, 0x25, 0x24, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x25, |
| 125 | 0x25, 0x01, 0x0e, 0x46, 0x05, 0x01, 0x00, 0x48, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x46, |
| 126 | 0x06, 0x01, 0x0e, 0x66, 0x25, 0x01, 0x00, 0x50, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x66, |
| 127 | 0x26, 0x01, 0x05, 0xa7, 0x26, 0x01, 0x00, 0x58, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x55, 0xaa |
| 128 | }; |
| 129 | static unsigned ebr_cmp_start = 0x1B8; |
| 130 | static unsigned ebr_cmp_size = 0x48; |
| 131 | /* |
| 132 | * EBR |
| 133 | 00b001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 87 |................| |
| 134 | 00b001c0 07 01 0e a7 26 01 00 08 00 00 00 08 00 00 00 00 |....&...........| |
| 135 | 00b001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 136 | 00b001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 137 | 00b001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| |
| 138 | */ |
| 139 | static unsigned char ebr_parts_ref_p5[] = { |
| 140 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, |
| 141 | 0x07, 0x01, 0x0e, 0xa7, 0x26, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, |
| 142 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 143 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 144 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa |
| 145 | }; |
| 146 | |
| 147 | /* Fill write buffers with pseudo-random data */ |
| 148 | static void init_write_buffers(char *mbr_wb, size_t mbr_wb_size, |
| 149 | char *ebr_wb, size_t ebr_wb_size, unsigned seed) |
| 150 | { |
| 151 | while (mbr_wb_size--) { |
| 152 | *mbr_wb++ = seed; |
| 153 | seed *= 43; |
| 154 | seed += 17 + mbr_wb_size/4; |
| 155 | } |
| 156 | while (ebr_wb_size--) { |
| 157 | *ebr_wb++ = seed; |
| 158 | seed *= 43; |
| 159 | seed += 17 + ebr_wb_size/4; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /* Build string with MBR partition(s) layout */ |
| 164 | static unsigned build_mbr_parts(char *buf, size_t buf_size, unsigned num_parts) |
| 165 | { |
| 166 | size_t bytes_remaining, cur_str_size; |
| 167 | char * cur_buf; |
| 168 | |
| 169 | if (!num_parts || num_parts > 5 || !buf) |
| 170 | return 1; |
| 171 | |
| 172 | cur_buf = buf; |
| 173 | *cur_buf = '\0'; |
| 174 | bytes_remaining = buf_size; |
| 175 | |
| 176 | cur_str_size = sizeof(mbr_parts_header); |
| 177 | if (cur_str_size + 1 > bytes_remaining) |
| 178 | return 1; |
| 179 | strcat(cur_buf, mbr_parts_header); |
| 180 | bytes_remaining -= cur_str_size; |
| 181 | |
| 182 | if (num_parts >= 1) { |
| 183 | cur_str_size = sizeof(mbr_parts_p1); |
| 184 | if (cur_str_size + 1 > bytes_remaining) |
| 185 | return 1; |
| 186 | strcat(cur_buf, mbr_parts_p1); |
| 187 | bytes_remaining -= cur_str_size; |
| 188 | |
| 189 | if (num_parts >= 2) { |
| 190 | cur_str_size = sizeof(mbr_parts_p2); |
| 191 | if (cur_str_size + 1 > bytes_remaining) |
| 192 | return 1; |
| 193 | strcat(cur_buf, mbr_parts_p2); |
| 194 | bytes_remaining -= cur_str_size; |
| 195 | |
| 196 | if (num_parts >= 3) { |
| 197 | cur_str_size = sizeof(mbr_parts_p3); |
| 198 | if (cur_str_size + 1 > bytes_remaining) |
| 199 | return 1; |
| 200 | strcat(cur_buf, mbr_parts_p3); |
| 201 | bytes_remaining -= cur_str_size; |
| 202 | |
| 203 | if (num_parts == 4) { |
| 204 | cur_str_size = sizeof(mbr_parts_p4); |
| 205 | if (cur_str_size + 1 > bytes_remaining) |
| 206 | return 1; |
| 207 | strcat(cur_buf, mbr_parts_p4); |
| 208 | bytes_remaining -= cur_str_size; |
| 209 | |
| 210 | } |
Alexander Gendin | 207fc53 | 2023-11-08 03:05:19 +0000 | [diff] [blame] | 211 | else if (num_parts == 5) { |
| 212 | cur_str_size = sizeof(mbr_parts_p5); |
| 213 | if (cur_str_size + 1 > bytes_remaining) |
| 214 | return 1; |
| 215 | strcat(cur_buf, mbr_parts_p5); |
| 216 | bytes_remaining -= cur_str_size; |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 217 | |
Alexander Gendin | 207fc53 | 2023-11-08 03:05:19 +0000 | [diff] [blame] | 218 | } |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 219 | } |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | cur_str_size = sizeof(mbr_parts_tail); |
| 224 | if (cur_str_size + 1 > bytes_remaining) |
| 225 | return 1; |
| 226 | strcat(cur_buf, mbr_parts_tail); |
| 227 | |
| 228 | return 0; |
| 229 | } |
| 230 | |
| 231 | static int mbr_test_run(struct unit_test_state *uts) |
| 232 | { |
| 233 | struct blk_desc *mmc_dev_desc; |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 234 | unsigned char *mbr_wbuf, *ebr_wbuf, *rbuf; |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 235 | char mbr_parts_buf[256]; |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 236 | ulong addr = 0x1000; /* start address for buffers */ |
| 237 | ulong mbr_wa = addr, ebr_wa = addr + BLKSZ, ra = addr + BLKSZ * 2; |
| 238 | ulong ebr_blk, mbr_parts_max; |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 239 | struct udevice *dev; |
| 240 | ofnode root, node; |
| 241 | |
| 242 | /* Enable the mmc6 node for this test */ |
| 243 | root = oftree_root(oftree_default()); |
| 244 | node = ofnode_find_subnode(root, "mmc6"); |
| 245 | ut_assert(ofnode_valid(node)); |
| 246 | ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false)); |
| 247 | |
Alexander Gendin | 2036ad1 | 2024-02-03 02:56:19 +0000 | [diff] [blame] | 248 | /* |
| 249 | * 1 byte for null character |
| 250 | * 2 reserved bytes |
| 251 | */ |
| 252 | mbr_parts_max = 1 + 2 + |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 253 | strlen(mbr_parts_header) + |
| 254 | strlen(mbr_parts_p1) + |
| 255 | strlen(mbr_parts_p2) + |
| 256 | strlen(mbr_parts_p3) + |
| 257 | max(strlen(mbr_parts_p4), strlen(mbr_parts_p5)) + |
| 258 | strlen(mbr_parts_tail); |
Heinrich Schuchardt | f53329d | 2024-11-03 23:48:11 +0100 | [diff] [blame] | 259 | ut_assertf(sizeof(mbr_parts_buf) >= mbr_parts_max, "Buffer avail: %zd; buffer req: %ld\n", |
| 260 | sizeof(mbr_parts_buf), mbr_parts_max); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 261 | |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 262 | mbr_wbuf = map_sysmem(mbr_wa, BLKSZ); |
| 263 | ebr_wbuf = map_sysmem(ebr_wa, BLKSZ); |
| 264 | rbuf = map_sysmem(ra, BLKSZ); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 265 | ebr_blk = (ulong)0xb00000 / BLKSZ; |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 266 | |
| 267 | /* Make sure mmc6 exists */ |
| 268 | ut_asserteq(6, blk_get_device_by_str("mmc", "6", &mmc_dev_desc)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 269 | ut_assertok(run_commandf("mmc dev 6")); |
| 270 | ut_assert_nextline("switch to partitions #0, OK"); |
| 271 | ut_assert_nextline("mmc6 is current device"); |
Simon Glass | c579bd4 | 2024-08-22 07:58:03 -0600 | [diff] [blame] | 272 | ut_assert_console_end(); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 273 | |
| 274 | /* Make sure mmc6 is 12+ MiB in size */ |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 275 | ut_assertok(run_commandf("mmc read %lx %lx 1", ra, |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 276 | (ulong)0xbffe00 / BLKSZ)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 277 | |
| 278 | /* Test one MBR partition */ |
Heinrich Schuchardt | ea27c84 | 2024-11-02 16:41:30 +0100 | [diff] [blame] | 279 | init_write_buffers(mbr_wbuf, BLKSZ, ebr_wbuf, BLKSZ, __LINE__); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 280 | ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 1)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 281 | ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 282 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 283 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 284 | ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 285 | ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 286 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 287 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 288 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 289 | ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); |
| 290 | ut_assertok(run_commandf("mbr write mmc 6")); |
Simon Glass | 5622825 | 2024-08-22 07:57:58 -0600 | [diff] [blame] | 291 | ut_assert_nextlinen("MMC read: dev # 6"); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 292 | ut_assert_nextline("MBR: write success!"); |
| 293 | ut_assertok(run_commandf("mbr verify mmc 6")); |
| 294 | ut_assert_nextline("MBR: verify success!"); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 295 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 296 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 297 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Simon Glass | c579bd4 | 2024-08-22 07:58:03 -0600 | [diff] [blame] | 298 | ut_assert_console_end(); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 299 | /* |
| 300 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 301 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 00 |...%$..@........| |
| 302 | 000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 303 | 000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 304 | 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| |
| 305 | */ |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 306 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 307 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 308 | for (unsigned i = 0; i < mbr_cmp_size; i++) { |
| 309 | ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p1[i], |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 310 | "1P MBR+0x%04X: expected %#02X, actual: %#02X\n", |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 311 | mbr_cmp_start + i, mbr_parts_ref_p1[i], rbuf[mbr_cmp_start + i]); |
| 312 | } |
| 313 | |
| 314 | /* Test two MBR partitions */ |
| 315 | init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); |
| 316 | ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 2)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 317 | ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 318 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 319 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 320 | ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 321 | ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 322 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 323 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 324 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 325 | ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); |
| 326 | ut_assertok(run_commandf("mbr write mmc 6")); |
| 327 | ut_assert_nextline("MBR: write success!"); |
| 328 | ut_assertok(run_commandf("mbr verify mmc 6")); |
| 329 | ut_assert_nextline("MBR: verify success!"); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 330 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 331 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 332 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Simon Glass | c579bd4 | 2024-08-22 07:58:03 -0600 | [diff] [blame] | 333 | ut_assert_console_end(); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 334 | /* |
| 335 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 336 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| |
| 337 | 000001d0 25 01 0e 46 05 01 00 48 00 00 00 08 00 00 00 00 |%..F...H........| |
| 338 | 000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 339 | 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| |
| 340 | */ |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 341 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 342 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 343 | for (unsigned i = 0; i < mbr_cmp_size; i++) { |
| 344 | ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p2[i], |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 345 | "2P MBR+0x%04X: expected %#02X, actual: %#02X\n", |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 346 | mbr_cmp_start + i, mbr_parts_ref_p2[i], rbuf[mbr_cmp_start + i]); |
| 347 | } |
| 348 | |
| 349 | /* Test three MBR partitions */ |
| 350 | init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); |
| 351 | ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 3)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 352 | ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 353 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 354 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 355 | ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 356 | ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 357 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 358 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 359 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 360 | ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); |
| 361 | ut_assertok(run_commandf("mbr write mmc 6")); |
| 362 | ut_assert_nextline("MBR: write success!"); |
| 363 | ut_assertok(run_commandf("mbr verify mmc 6")); |
| 364 | ut_assert_nextline("MBR: verify success!"); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 365 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 366 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 367 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Simon Glass | c579bd4 | 2024-08-22 07:58:03 -0600 | [diff] [blame] | 368 | ut_assert_console_end(); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 369 | /* |
| 370 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 371 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| |
| 372 | 000001d0 25 01 0e 46 05 01 00 48 00 00 00 08 00 00 00 46 |%..F...H.......F| |
| 373 | 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 00 |...f%..P........| |
| 374 | 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| |
| 375 | */ |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 376 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 377 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 378 | for (unsigned i = 0; i < mbr_cmp_size; i++) { |
| 379 | ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p3[i], |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 380 | "3P MBR+0x%04X: expected %#02X, actual: %#02X\n", |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 381 | mbr_cmp_start + i, mbr_parts_ref_p3[i], rbuf[mbr_cmp_start + i]); |
| 382 | } |
| 383 | |
| 384 | /* Test four MBR partitions */ |
| 385 | init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); |
| 386 | ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 4)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 387 | ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 388 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 389 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 390 | ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 391 | ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 392 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 393 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 394 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 395 | ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); |
| 396 | ut_assertok(run_commandf("mbr write mmc 6")); |
| 397 | ut_assert_nextline("MBR: write success!"); |
| 398 | ut_assertok(run_commandf("mbr verify mmc 6")); |
| 399 | ut_assert_nextline("MBR: verify success!"); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 400 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 401 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 402 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Simon Glass | c579bd4 | 2024-08-22 07:58:03 -0600 | [diff] [blame] | 403 | ut_assert_console_end(); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 404 | /* |
| 405 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 406 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| |
| 407 | 000001d0 25 01 0e 46 05 01 00 48 00 00 00 08 00 00 00 46 |%..F...H.......F| |
| 408 | 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 66 |...f%..P.......f| |
| 409 | 000001f0 26 01 0e 87 06 01 00 58 00 00 00 08 00 00 55 aa |&......X......U.| |
| 410 | */ |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 411 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 412 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 413 | for (unsigned i = 0; i < mbr_cmp_size; i++) { |
| 414 | ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p4[i], |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 415 | "4P MBR+0x%04X: expected %#02X, actual: %#02X\n", |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 416 | mbr_cmp_start + i, mbr_parts_ref_p4[i], rbuf[mbr_cmp_start + i]); |
| 417 | } |
| 418 | |
| 419 | /* Test five MBR partitions */ |
| 420 | init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); |
| 421 | ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 5)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 422 | ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 423 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 424 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 425 | ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 426 | ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 427 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 428 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Simon Glass | a8c1252 | 2024-09-01 16:26:32 -0600 | [diff] [blame] | 429 | ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 430 | ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); |
| 431 | ut_assertf(0 == run_commandf("mbr write mmc 6"), "Invalid partitions string: %s\n", mbr_parts_buf); |
| 432 | ut_assert_nextline("MBR: write success!"); |
| 433 | ut_assertok(run_commandf("mbr verify mmc 6")); |
| 434 | ut_assert_nextline("MBR: verify success!"); |
Simon Glass | c579bd4 | 2024-08-22 07:58:03 -0600 | [diff] [blame] | 435 | ut_assert_console_end(); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 436 | /* |
| 437 | 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| |
| 438 | 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| |
| 439 | 000001d0 25 01 0e 46 05 01 00 48 00 00 00 08 00 00 00 46 |%..F...H.......F| |
| 440 | 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 66 |...f%..P.......f| |
| 441 | 000001f0 26 01 05 a7 26 01 00 58 00 00 00 10 00 00 55 aa |&...&..X......U.| |
| 442 | */ |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 443 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 444 | ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 445 | for (unsigned i = 0; i < mbr_cmp_size; i++) { |
| 446 | ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p5[i], |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 447 | "5P MBR+0x%04X: expected %#02X, actual: %#02X\n", |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 448 | mbr_cmp_start + i, mbr_parts_ref_p5[i], rbuf[mbr_cmp_start + i]); |
| 449 | } |
| 450 | /* |
| 451 | 00b001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 87 |................| |
| 452 | 00b001c0 07 01 0e a7 26 01 00 08 00 00 00 08 00 00 00 00 |....&...........| |
| 453 | 00b001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 454 | 00b001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
| 455 | 00b001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| |
| 456 | */ |
Simon Glass | 2ca519b | 2024-09-01 16:26:33 -0600 | [diff] [blame] | 457 | memset(rbuf, '\0', BLKSZ); |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 458 | ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 459 | for (unsigned i = 0; i < ebr_cmp_size; i++) { |
| 460 | ut_assertf(rbuf[ebr_cmp_start + i] == ebr_parts_ref_p5[i], |
Simon Glass | 345567c | 2024-09-01 16:26:22 -0600 | [diff] [blame] | 461 | "5P EBR+0x%04X: expected %#02X, actual: %#02X\n", |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 462 | ebr_cmp_start + i, ebr_parts_ref_p5[i], rbuf[ebr_cmp_start + i]); |
| 463 | } |
Simon Glass | 2a1f169 | 2024-09-01 16:26:31 -0600 | [diff] [blame] | 464 | unmap_sysmem(mbr_wbuf); |
| 465 | unmap_sysmem(ebr_wbuf); |
| 466 | unmap_sysmem(rbuf); |
Alexander Gendin | 038cb02 | 2023-10-09 01:24:36 +0000 | [diff] [blame] | 467 | |
| 468 | return 0; |
| 469 | } |
| 470 | |
| 471 | /* Declare mbr test */ |
Simon Glass | b15512c | 2025-01-20 14:25:32 -0700 | [diff] [blame] | 472 | UNIT_TEST(mbr_test_run, UTF_CONSOLE, mbr); |