| 167 | } |
| 168 | |
| 169 | rt_err_t rt_fdt_scan_root(void) |
| 170 | { |
| 171 | rt_err_t err = RT_EOK; |
| 172 | int root = fdt_path_offset(_fdt, "/"); |
| 173 | |
| 174 | if (root >= 0) |
| 175 | { |
| 176 | const fdt32_t *prop; |
| 177 | |
| 178 | _root_addr_cells = OFW_ROOT_NODE_ADDR_CELLS_DEFAULT; |
| 179 | _root_size_cells = OFW_ROOT_NODE_SIZE_CELLS_DEFAULT; |
| 180 | |
| 181 | if ((prop = fdt_getprop(_fdt, root, "#address-cells", RT_NULL))) |
| 182 | { |
| 183 | _root_addr_cells = fdt32_to_cpu(*prop); |
| 184 | } |
| 185 | |
| 186 | if ((prop = fdt_getprop(_fdt, root, "#size-cells", RT_NULL))) |
| 187 | { |
| 188 | _root_size_cells = fdt32_to_cpu(*prop); |
| 189 | } |
| 190 | } |
| 191 | else |
| 192 | { |
| 193 | err = -RT_EEMPTY; |
| 194 | } |
| 195 | |
| 196 | return err; |
| 197 | } |
| 198 | |
| 199 | static rt_err_t fdt_reserved_mem_check_root(int nodeoffset) |
| 200 | { |
no test coverage detected