Thread (9 messages) flat view 9 messages, 6 authors, 2017-03-08
DORMANTno replies

[PATCH v2] efi/libstub/arm*: Set default address and size cells values for an empty dtb

From: Timur Tabi <hidden>
Date: 2017-03-08 23:32:53
Also in: linux-efi

On Thu, Mar 2, 2017 at 9:23 AM, Goel, Sameer [off-list ref] 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, &reg);
+       usablemem->size = dt_mem_next_cell(dt_root_size_cells, &reg);
+
+       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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help