Lines Matching full:regions
19 struct regions { struct
93 u32 end, struct regions *regions) in intersects_reserved_region() argument
106 if (regions->reserved_mem < 0) in intersects_reserved_region()
110 for (subnode = fdt_first_subnode(fdt, regions->reserved_mem); in intersects_reserved_region()
117 while (len >= (regions->reserved_mem_addr_cells + in intersects_reserved_region()
118 regions->reserved_mem_size_cells)) { in intersects_reserved_region()
121 if (regions->reserved_mem_addr_cells == 2) in intersects_reserved_region()
124 reg += regions->reserved_mem_addr_cells; in intersects_reserved_region()
125 len -= 4 * regions->reserved_mem_addr_cells; in intersects_reserved_region()
128 if (regions->reserved_mem_size_cells == 2) in intersects_reserved_region()
131 reg += regions->reserved_mem_size_cells; in intersects_reserved_region()
132 len -= 4 * regions->reserved_mem_size_cells; in intersects_reserved_region()
134 if (base >= regions->pa_end) in intersects_reserved_region()
146 u32 end, struct regions *regions) in intersects_occupied_region() argument
148 if (regions_intersect(start, end, regions->zimage_start, in intersects_occupied_region()
149 regions->zimage_start + regions->zimage_size)) in intersects_occupied_region()
152 if (regions_intersect(start, end, regions->initrd_start, in intersects_occupied_region()
153 regions->initrd_start + regions->initrd_size)) in intersects_occupied_region()
156 if (regions_intersect(start, end, regions->dtb_start, in intersects_occupied_region()
157 regions->dtb_start + regions->dtb_size)) in intersects_occupied_region()
160 return intersects_reserved_region(fdt, start, end, regions); in intersects_occupied_region()
163 static u32 count_suitable_regions(const void *fdt, struct regions *regions, in count_suitable_regions() argument
168 for (pa = regions->pa_start; pa < regions->pa_end; pa += SZ_2M, i++) { in count_suitable_regions()
170 pa + regions->image_size, in count_suitable_regions()
171 regions)) { in count_suitable_regions()
181 /* The caller ensures that num is within the range of regions.*/
330 struct regions regions; in kaslr_early_init() local
358 regions.image_size = image_base % SZ_128M + round_up(image_size, SZ_2M); in kaslr_early_init()
359 regions.pa_start = round_down(image_base, SZ_128M); in kaslr_early_init()
360 regions.pa_end = lowmem_top - PAGE_OFFSET + regions.pa_start; in kaslr_early_init()
361 regions.zimage_start = zimage_start; in kaslr_early_init()
362 regions.zimage_size = zimage_end - zimage_start; in kaslr_early_init()
363 regions.dtb_start = (u32)fdt; in kaslr_early_init()
364 regions.dtb_size = fdt_totalsize(fdt); in kaslr_early_init()
370 seed = __crc16(seed, fdt, regions.dtb_size); in kaslr_early_init()
376 regions.initrd_start = regions.initrd_size = 0; in kaslr_early_init()
379 regions.initrd_start = __memparse(p + 7, &p); in kaslr_early_init()
381 regions.initrd_size = __memparse(p, NULL); in kaslr_early_init()
382 if (regions.initrd_size == 0) in kaslr_early_init()
383 regions.initrd_start = 0; in kaslr_early_init()
387 if (regions.initrd_size == 0) { in kaslr_early_init()
405 regions.initrd_start = start; in kaslr_early_init()
406 regions.initrd_size = max_t(u64, end, U32_MAX) - start; in kaslr_early_init()
417 regions.pa_end = min(regions.pa_end, mem_fdt) - regions.image_size; in kaslr_early_init()
419 regions.pa_end = regions.pa_end - regions.image_size; in kaslr_early_init()
421 puthex32(regions.image_size); in kaslr_early_init()
422 puthex32(regions.pa_start); in kaslr_early_init()
423 puthex32(regions.pa_end); in kaslr_early_init()
424 puthex32(regions.zimage_start); in kaslr_early_init()
425 puthex32(regions.zimage_size); in kaslr_early_init()
426 puthex32(regions.dtb_start); in kaslr_early_init()
427 puthex32(regions.dtb_size); in kaslr_early_init()
428 puthex32(regions.initrd_start); in kaslr_early_init()
429 puthex32(regions.initrd_size); in kaslr_early_init()
432 regions.reserved_mem = fdt_path_offset(fdt, "/reserved-memory"); in kaslr_early_init()
433 if (regions.reserved_mem >= 0) in kaslr_early_init()
434 get_cell_sizes(fdt, regions.reserved_mem, in kaslr_early_init()
435 ®ions.reserved_mem_addr_cells, in kaslr_early_init()
436 ®ions.reserved_mem_size_cells); in kaslr_early_init()
441 * with any of the reserved regions for the zImage itself, the DTB, in kaslr_early_init()
442 * the initrd and any regions described as reserved in the device tree. in kaslr_early_init()
448 count = count_suitable_regions(fdt, ®ions, bitmap); in kaslr_early_init()