Lines Matching refs:ram
54 static int test_multi_alloc(struct unit_test_state *uts, const phys_addr_t ram, in test_multi_alloc() argument
59 const phys_addr_t ram_end = ram + ram_size; in test_multi_alloc()
67 ut_assert(ram_end == 0 || ram_end > ram); in test_multi_alloc()
70 ut_assert(alloc_64k_addr >= ram + 8); in test_multi_alloc()
80 ret = lmb_add(&lmb, ram, ram_size); in test_multi_alloc()
87 ut_asserteq(lmb.memory.region[1].base, ram); in test_multi_alloc()
91 ut_asserteq(lmb.memory.region[0].base, ram); in test_multi_alloc()
165 ut_asserteq(lmb.memory.region[1].base, ram); in test_multi_alloc()
169 ut_asserteq(lmb.memory.region[0].base, ram); in test_multi_alloc()
177 const phys_addr_t ram) in test_multi_alloc_512mb() argument
179 return test_multi_alloc(uts, ram, 0x20000000, 0, 0, ram + 0x10000000); in test_multi_alloc_512mb()
183 const phys_addr_t ram, in test_multi_alloc_512mb_x2() argument
186 return test_multi_alloc(uts, ram, 0x20000000, ram0, 0x20000000, in test_multi_alloc_512mb_x2()
187 ram + 0x10000000); in test_multi_alloc_512mb_x2()
223 static int test_bigblock(struct unit_test_state *uts, const phys_addr_t ram) in test_bigblock() argument
227 const phys_addr_t ram_end = ram + ram_size; in test_bigblock()
228 const phys_addr_t alloc_64k_addr = ram + 0x10000000; in test_bigblock()
234 ut_assert(ram_end == 0 || ram_end > ram); in test_bigblock()
238 ret = lmb_add(&lmb, ram, ram_size); in test_bigblock()
244 ASSERT_LMB(&lmb, ram, ram_size, 1, alloc_64k_addr, 0x10000, in test_bigblock()
249 ut_asserteq(a, ram); in test_bigblock()
250 ASSERT_LMB(&lmb, ram, ram_size, 1, a, in test_bigblock()
256 ASSERT_LMB(&lmb, ram, ram_size, 1, a, in test_bigblock()
261 ASSERT_LMB(&lmb, ram, ram_size, 1, alloc_64k_addr, 0x10000, in test_bigblock()
268 ASSERT_LMB(&lmb, ram, ram_size, 1, alloc_64k_addr, 0x10000, in test_bigblock()
290 static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram, in test_noreserved() argument
294 const phys_addr_t ram_end = ram + ram_size; in test_noreserved()
302 ut_assert(ram_end == 0 || ram_end > ram); in test_noreserved()
306 ret = lmb_add(&lmb, ram, ram_size); in test_noreserved()
308 ASSERT_LMB(&lmb, ram, ram_size, 0, 0, 0, 0, 0, 0, 0); in test_noreserved()
313 ASSERT_LMB(&lmb, ram, ram_size, 1, ram + ram_size - alloc_size_aligned, in test_noreserved()
319 ASSERT_LMB(&lmb, ram, ram_size, 1, ram + ram_size - in test_noreserved()
323 ASSERT_LMB(&lmb, ram, ram_size, 2, ram + ram_size - in test_noreserved()
324 (alloc_size_aligned * 2), alloc_size, ram + ram_size in test_noreserved()
330 ASSERT_LMB(&lmb, ram, ram_size, 1, ram + ram_size - alloc_size_aligned, in test_noreserved()
334 ASSERT_LMB(&lmb, ram, ram_size, 0, 0, 0, 0, 0, 0, 0); in test_noreserved()
339 ASSERT_LMB(&lmb, ram, ram_size, 1, ram + ram_size - alloc_size_aligned, in test_noreserved()
344 ASSERT_LMB(&lmb, ram, ram_size, 0, 0, 0, 0, 0, 0, 0); in test_noreserved()
384 const phys_addr_t ram = 0; in lib_test_lmb_at_0() local
392 ret = lmb_add(&lmb, ram, ram_size); in lib_test_lmb_at_0()
397 ut_asserteq(a, ram + 4); in lib_test_lmb_at_0()
398 ASSERT_LMB(&lmb, ram, ram_size, 1, a, ram_size - 4, in lib_test_lmb_at_0()
405 ASSERT_LMB(&lmb, ram, ram_size, 1, a, ram_size - 4, in lib_test_lmb_at_0()
410 ASSERT_LMB(&lmb, ram, ram_size, 1, a, ram_size - 4, in lib_test_lmb_at_0()
415 ASSERT_LMB(&lmb, ram, ram_size, 0, 0, 0, 0, 0, 0, 0); in lib_test_lmb_at_0()
425 const phys_addr_t ram = 0x40000000; in lib_test_lmb_overlapping_reserve() local
432 ret = lmb_add(&lmb, ram, ram_size); in lib_test_lmb_overlapping_reserve()
437 ASSERT_LMB(&lmb, ram, ram_size, 1, 0x40010000, 0x10000, in lib_test_lmb_overlapping_reserve()
442 ASSERT_LMB(&lmb, ram, ram_size, 1, 0x40010000, 0x10000, in lib_test_lmb_overlapping_reserve()
447 ASSERT_LMB(&lmb, ram, ram_size, 2, 0x40010000, 0x10000, in lib_test_lmb_overlapping_reserve()
452 ASSERT_LMB(&lmb, ram, ram_size, 1, 0x40010000, 0x30000, in lib_test_lmb_overlapping_reserve()
465 static int test_alloc_addr(struct unit_test_state *uts, const phys_addr_t ram) in test_alloc_addr() argument
468 const phys_addr_t ram_end = ram + ram_size; in test_alloc_addr()
469 const phys_size_t alloc_addr_a = ram + 0x8000000; in test_alloc_addr()
470 const phys_size_t alloc_addr_b = ram + 0x8000000 * 2; in test_alloc_addr()
471 const phys_size_t alloc_addr_c = ram + 0x8000000 * 3; in test_alloc_addr()
477 ut_assert(ram_end == 0 || ram_end > ram); in test_alloc_addr()
481 ret = lmb_add(&lmb, ram, ram_size); in test_alloc_addr()
491 ASSERT_LMB(&lmb, ram, ram_size, 3, alloc_addr_a, 0x10000, in test_alloc_addr()
495 a = lmb_alloc_addr(&lmb, ram, alloc_addr_a - ram); in test_alloc_addr()
496 ut_asserteq(a, ram); in test_alloc_addr()
497 ASSERT_LMB(&lmb, ram, ram_size, 3, ram, 0x8010000, in test_alloc_addr()
502 ASSERT_LMB(&lmb, ram, ram_size, 2, ram, 0x10010000, in test_alloc_addr()
507 ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010000, in test_alloc_addr()
512 ASSERT_LMB(&lmb, ram, ram_size, 1, ram, ram_size, in test_alloc_addr()
518 ASSERT_LMB(&lmb, ram, ram_size, 1, ram, ram_size, in test_alloc_addr()
528 ASSERT_LMB(&lmb, ram, ram_size, 2, ram, 0x18010000, in test_alloc_addr()
532 ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010000, in test_alloc_addr()
537 ASSERT_LMB(&lmb, ram, ram_size, 2, ram, 0x18010000, in test_alloc_addr()
541 ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010000, in test_alloc_addr()
546 ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010004, in test_alloc_addr()
550 ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010000, in test_alloc_addr()
554 ret = lmb_free(&lmb, a, alloc_addr_a - ram); in test_alloc_addr()
556 ASSERT_LMB(&lmb, ram, ram_size, 1, ram + 0x8000000, 0x10010000, in test_alloc_addr()
558 d = lmb_alloc_addr(&lmb, ram, 4); in test_alloc_addr()
559 ut_asserteq(d, ram); in test_alloc_addr()
560 ASSERT_LMB(&lmb, ram, ram_size, 2, d, 4, in test_alloc_addr()
561 ram + 0x8000000, 0x10010000, 0, 0); in test_alloc_addr()
568 if (ram != 0) { in test_alloc_addr()
569 ret = lmb_alloc_addr(&lmb, ram - 1, 1); in test_alloc_addr()
593 const phys_addr_t ram) in test_get_unreserved_size() argument
596 const phys_addr_t ram_end = ram + ram_size; in test_get_unreserved_size()
597 const phys_size_t alloc_addr_a = ram + 0x8000000; in test_get_unreserved_size()
598 const phys_size_t alloc_addr_b = ram + 0x8000000 * 2; in test_get_unreserved_size()
599 const phys_size_t alloc_addr_c = ram + 0x8000000 * 3; in test_get_unreserved_size()
605 ut_assert(ram_end == 0 || ram_end > ram); in test_get_unreserved_size()
609 ret = lmb_add(&lmb, ram, ram_size); in test_get_unreserved_size()
619 ASSERT_LMB(&lmb, ram, ram_size, 3, alloc_addr_a, 0x10000, in test_get_unreserved_size()
623 s = lmb_get_free_size(&lmb, ram); in test_get_unreserved_size()
624 ut_asserteq(s, alloc_addr_a - ram); in test_get_unreserved_size()
625 s = lmb_get_free_size(&lmb, ram + 0x10000); in test_get_unreserved_size()
626 ut_asserteq(s, alloc_addr_a - ram - 0x10000); in test_get_unreserved_size()