Lines Matching full:block

57 static int sram_add_pool(struct sram_dev *sram, struct sram_reserve *block,  in sram_add_pool()  argument
63 NUMA_NO_NODE, block->label); in sram_add_pool()
68 block->size, NUMA_NO_NODE); in sram_add_pool()
77 static int sram_add_export(struct sram_dev *sram, struct sram_reserve *block, in sram_add_export() argument
90 part->battr.size = block->size; in sram_add_export()
95 static int sram_add_partition(struct sram_dev *sram, struct sram_reserve *block, in sram_add_partition() argument
107 virt_base = devm_ioremap_resource(sram->dev, &block->res); in sram_add_partition()
109 virt_base = devm_ioremap_resource_wc(sram->dev, &block->res); in sram_add_partition()
112 dev_err(sram->dev, "could not map SRAM at %pr\n", &block->res); in sram_add_partition()
118 part->base = sram->virt_base + block->start; in sram_add_partition()
121 if (block->pool) { in sram_add_partition()
122 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
126 if (block->export) { in sram_add_partition()
127 ret = sram_add_export(sram, block, start, part); in sram_add_partition()
131 if (block->protect_exec) { in sram_add_partition()
132 ret = sram_check_protect_exec(sram, block, part); in sram_add_partition()
136 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
179 struct sram_reserve *rblocks, *block; in sram_reserve_regions() local
190 * We need an additional block to mark the end of the memory region in sram_reserve_regions()
198 block = &rblocks[0]; in sram_reserve_regions()
212 "reserved block %pOF outside the sram area\n", in sram_reserve_regions()
218 block->start = child_res.start - res->start; in sram_reserve_regions()
219 block->size = resource_size(&child_res); in sram_reserve_regions()
220 block->res = child_res; in sram_reserve_regions()
221 list_add_tail(&block->list, &reserve_list); in sram_reserve_regions()
223 block->export = of_property_read_bool(child, "export"); in sram_reserve_regions()
224 block->pool = of_property_read_bool(child, "pool"); in sram_reserve_regions()
225 block->protect_exec = of_property_read_bool(child, "protect-exec"); in sram_reserve_regions()
227 if ((block->export || block->pool || block->protect_exec) && in sram_reserve_regions()
228 block->size) { in sram_reserve_regions()
240 block->label = devm_kasprintf(sram->dev, GFP_KERNEL, in sram_reserve_regions()
243 block->label = devm_kstrdup(sram->dev, in sram_reserve_regions()
245 if (!block->label) { in sram_reserve_regions()
251 block->export ? "exported " : "", block->label, in sram_reserve_regions()
252 block->start, block->start + block->size); in sram_reserve_regions()
254 dev_dbg(sram->dev, "found reserved block 0x%x-0x%x\n", in sram_reserve_regions()
255 block->start, block->start + block->size); in sram_reserve_regions()
258 block++; in sram_reserve_regions()
280 list_for_each_entry(block, &reserve_list, list) { in sram_reserve_regions()
282 if (block->start < cur_start) { in sram_reserve_regions()
284 "block at 0x%x starts after current offset 0x%lx\n", in sram_reserve_regions()
285 block->start, cur_start); in sram_reserve_regions()
291 if ((block->export || block->pool || block->protect_exec) && in sram_reserve_regions()
292 block->size) { in sram_reserve_regions()
293 ret = sram_add_partition(sram, block, in sram_reserve_regions()
294 res->start + block->start); in sram_reserve_regions()
301 /* current start is in a reserved block, so continue after it */ in sram_reserve_regions()
302 if (block->start == cur_start) { in sram_reserve_regions()
303 cur_start = block->start + block->size; in sram_reserve_regions()
309 * address and the following reserved block, or the in sram_reserve_regions()
312 cur_size = block->start - cur_start; in sram_reserve_regions()
327 /* next allocation after this reserved block */ in sram_reserve_regions()
328 cur_start = block->start + block->size; in sram_reserve_regions()