[PATCH v2] efi/libstub/arm*: Set default address and size cells values for an empty dtb
Timur Tabi
timur at codeaurora.org
Wed Mar 8 15:32:53 PST 2017
On Thu, Mar 2, 2017 at 9:23 AM, Goel, Sameer <sgoel at codeaurora.org> wrote:
> Any tool making the device tree update should be checking for the cell sizes before
> assuming a 32 bit or a 64 bit value.
To be clear, Akashi's patches already look at the cell sizes:
+static int __init early_init_dt_scan_usablemem(unsigned long node,
+ const char *uname, int depth, void *data)
+{
+ struct memblock_region *usablemem = data;
+ const __be32 *reg;
+ int len;
+
+ if (depth != 1 || strcmp(uname, "chosen") != 0)
+ return 0;
+
+ reg = of_get_flat_dt_prop(node, "linux,usable-memory-range", &len);
+ if (!reg || (len < (dt_root_addr_cells + dt_root_size_cells)))
+ return 1;
+
+ usablemem->base = dt_mem_next_cell(dt_root_addr_cells, ®);
+ usablemem->size = dt_mem_next_cell(dt_root_size_cells, ®);
+
+ return 1;
+}
This function uses dt_root_addr_cells and dt_root_size_cells. With
Sameer's patch, those values should be 2 and 2, respectively, on ARM64
systems.
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
More information about the linux-arm-kernel
mailing list