aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/device_tree.c
Commit message (Collapse)AuthorAgeFilesLines
* xen/dts: Support Linux initrd DT bindingsJulien Grall2013-10-081-0/+25
| | | | | | | | Linux uses the property linux,initrd-start and linux,initrd-end to know where the initrd lives in memory. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Use ROUNDUP macro instead of the internal ALIGNJulien Grall2013-10-081-6/+4
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen: arm: add two new device tree helpersIan Campbell2013-09-271-0/+29
| | | | | | | | - dt_property_read_u64 - dt_find_node_by_type Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Julien Grall <julien.grall@linaro.org>
* xen/arm: Support dtb /memreserve/ regionsIan Campbell2013-09-261-1/+12
| | | | | | | | | | | | | This requires a mapping of the DTB during setup_mm. Previously this was in the BOOT_MISC slot, which is clobbered by setup_pagetables. Split it out into its own slot which can be preserved. Also handle these regions as part of consider_modules() and when adding pages to the heaps to ensure we do not locate any part of Xen or the heaps over them. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Tim Deegan <tim@xen.org>
* xen/arm: Reserve FDT via early module mechanismIan Campbell2013-09-261-1/+8
| | | | | | | | | | This will stop us putting any heaps or relocating Xen itself over the FDT. The devicetree will be copied to allocated memory in setup_mm and the original copy will be freed by discard_initial_modules. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Tim Deegan <tim@xen.org>
* xen/arm: Dissociate logical and hardware CPU IDJulien Grall2013-09-261-48/+0
| | | | | | | | | | | Introduce cpu_logical_map to associate a logical CPU ID to an hardware CPU ID. This map will be filled during Xen boot via the device tree. Each CPU node contains a "reg" property which contains the hardware ID (ie MPIDR[0:23]). Also move /cpus parsing later so we can use the dt_* API. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* ARM: parse separate DT properties for different commandlinesAndre Przywara2013-09-171-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained: - If xen,xen-bootargs is present, it will be used for Xen. - If xen,dom0-bootargs is present, it will be used for Dom0. - If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation. - If no Xen specific properties are present, bootargs is for Dom0. - If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0. The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader. I will send out a appropriate u-boot patch, which writes the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property. Signed-off-by: Andre Przywara <andre.przywara@linaro.org> Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: replace get_val by dt_next_cellJulien Grall2013-09-171-16/+2
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: device_get_reg: cells are 32-bit big endian valueJulien Grall2013-09-171-6/+6
| | | | | | | | Device tree cells are 32-bit big endian value. Use __be32 to avoid confusion later. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Clean up the exported API for device treeJulien Grall2013-09-171-78/+14
| | | | | | | | | | | All Xen code has been converted to the new device tree API that uses a tree structure to describe the DTS. The Flat Device tree is still used by Xen during early boot stage, but only in internal. Remove entirely unneeded functions or move to a static function. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: dt_find_interrupt_controller: accept multiple compatible stringsJulien Grall2013-09-171-2/+3
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Check the CPU ID is not greater than NR_CPUSJulien Grall2013-09-171-0/+7
| | | | | | | | | | | | On some board CPU IDs are not contiguous (for instance the Versatile Express with big.LITTLE supports). If the CPU ID is greater than NR_CPUS Xen will hang without any message. This is because console driver is not yet initialized and hypervisor data abort uses printk. For the moment check the CPU ID and print an warning if an error occured. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Check "reg" property length in process_multiboot_nodeJulien Grall2013-09-171-1/+5
| | | | | | | | | | The device tree compiler (dtc) will only warn if the "reg" property doesn't match #address-cells and #size-cells size. It won't update the different property. Therefore, Xen needs to check if the size match both properties, otherwise Xen can retrieve a wrong range. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Remove device_get_reg call in process_cpu_nodeJulien Grall2013-09-171-7/+12
| | | | | | | | The "reg" property is only composed of one uint32. device_get_reg can be replaced by dt_read_number. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen: Use the right string comparison function in device treeJulien Grall2013-09-171-3/+3
| | | | | | | | | When of_node_cmp and of_compat_cmp was introduced in commit fb97eb6 "xen/arm: Create a hierarchical device tree", they were copied from the wrong Linux header. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Add new helpers to use the device treeJulien Grall2013-09-171-7/+102
| | | | | | | | | | | | | | | | | | | | | | | List of new helpers taken from linux (commit 74b9272): - dt_property_read_string - dt_match_node - dt_find_maching_node - dt_device_is_available - dt_prop_cmp Other new helpers: - dt_set_cell - dt_for_each_child - dt_set_range - dt_cells_to_size - dt_next_cell - dt_get_range - dt_node_name_is_equal - dt_node_path_is_equal - dt_property_name_is_equal Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Don't add a fake property "name" in the device treeJulien Grall2013-09-171-1/+10
| | | | | | | | | | | | On new Flat Device Tree version, the property "name" may not exist. The property is never used in Xen code except to set the field "name" of dt_device_node. For convenience, remove the fake property. It will save space during the creation of the dom0 FDT. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Prefix device tree macro by dt_Julien Grall2013-09-171-5/+5
| | | | | | | | | | There is 2 macros: for_each_device_node and for_each_property_of_node with a too generic name. Also replace all call-site with the new function names. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Constify device_tree_flattenedJulien Grall2013-09-171-1/+1
| | | | | | | The Flat Device Tree is given by the bootloader. Xen doesn't need to modify it. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/dts: Don't check the number of address and size cells in process_cpu_nodeJulien Grall2013-09-101-6/+0
| | | | | | | | | | | | | | CPU nodes are not required to have #address-cells == 1 and #size-cells == 0, so don't check for that (see Linux Documentation/devicetree/booting-without-of.txt Section III.5.a). In some OMAP5 device, tree, these 2 properties are not correctly set. Therefore, Xen will only able to handle 1 CPU. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com> CC: andrii.anisov@globallogic.com CC: baozich@gmail.com
* xen/arm: use defines for boot module indexes instead of open coded numbersIan Campbell2013-08-271-2/+2
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reviewed-by: Julien Grall <julien.grall@linaro.org>
* xen: Introduce a helper to read a u32 property in device tree.Chen Baozi2013-08-221-0/+15
| | | | | Signed-off-by: Chen Baozi <baozich@gmail.com> Acked-by: Julien Grall <julien.grall@linaro.org>
* xen/arm: Use hierarchical device tree to retrieve GIC informationJulien Grall2013-05-131-42/+0
| | | | | | | | - Remove early parsing for GIC addresses - Remove hard coded maintenance IRQ number Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: Add helpers to retrieve an interrupt description from the device treeJulien Grall2013-05-131-0/+362
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: Add helpers to retrieve an address from the device treeJulien Grall2013-05-131-0/+343
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: Add helpers to use the device treeJulien Grall2013-05-131-18/+144
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: Create a hierarchical device treeJulien Grall2013-05-131-5/+450
| | | | | | | | | Add function to parse the device tree and create a hierarchical tree. This code is based on drivers/of/base.c in linux source. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen: arm: parse modules from DT during early boot.Ian Campbell2013-03-131-1/+53
| | | | | | | | | The bootloader should populate /chosen/modules/module@<N>/ for each module it wishes to pass to the hypervisor. The content of these nodes is described in docs/misc/arm/device-tree/booting.txt Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* dtb: correct handling of #address-cells and #size-cells.Ian Campbell2013-03-131-4/+8
| | | | | | | | If a node does not have #*-cells then the parent's value should be used. Currently we were asssuming zero which is useless. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-211-1/+1
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* xen/device_tree: introduce find_compatible_nodeStefano Stabellini2013-02-151-2/+54
| | | | | | | | | | | | | | | | | Introduce a find_compatible_node function that can be used by device drivers to find the node corresponding to their device in the device tree. Initialize device_tree_flattened early in start_xen, so that it is available before setup_mm. Get rid of fdt in the process. Also add device_tree_node_compatible to device_tree.h, that is currently missing. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> [ ijc - s/atag_paddr/fdt_paddr ] Committed-by: Ian Campbell <ian.campbell@citrix.com>
* device-tree: get_val cannot cope with cells > 2, add early_panicIan Campbell2013-01-211-0/+3
| | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: use strcmp in device_tree_type_matchesStefano Stabellini2012-12-131-3/+2
| | | | | | | | We want to match the exact string rather than the first subset. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen: get GIC addresses from DTStefano Stabellini2012-12-131-3/+70
| | | | | | | | | | | | | | Get the address of the GIC distributor, cpu, virtual and virtual cpu interfaces registers from device tree. Note: I couldn't completely get rid of GIC_BASE_ADDRESS, GIC_DR_OFFSET and friends because we are using them from mode_switch.S, that is executed before device tree has been parsed. But at least mode_switch.S is known to contain vexpress specific code anyway. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: get the number of cpus from device treeStefano Stabellini2012-11-191-0/+43
| | | | | | | | The system might have fewer cpus than the GIC supports. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* arm: move get_paddr_function to arch setup.c from device_tree.cIan Campbell2012-10-111-32/+0
| | | | | | | | | | | | It's not realy got any DT functionality in it and its only caller is setup_pagetables. Put it here because future patches want to incorporate of the module layout in memory and I'd like to confine that to setup.c Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* device tree: print a warning if a node is nested too deepDavid Vrabel2012-04-021-1/+18
| | | | | | | | | Since device_tree_for_each_node() is called before printk() works, a variable is used to switch between using early_printk() and printk(). Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* arm: use bootargs for the command lineDavid Vrabel2012-04-021-0/+20
| | | | | | | | | Use the /chosen node's bootargs parameter for the Xen command line. Parse it early on before the serial console is setup. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* device tree,arm: supply a flat device tree to dom0David Vrabel2012-04-021-16/+31
| | | | | | | | | | | | | | | | | | | Build a flat device tree for dom0 based on the one supplied to Xen. The following changes are made: * In the /chosen node, the xen,dom0-bootargs parameter is renamed to bootargs. * In all memory nodes, the reg parameters are adjusted to reflect the amount of memory dom0 can use. The p2m is updated using this info. Support for passing ATAGS to dom0 is removed. Signed-off-by: David Vrabel <david.vrabel@citrix.com> [ removed device_tree_dump call -- ijc ] Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* device tree: add device_tree_dump() to print a flat device treeDavid Vrabel2012-03-221-0/+38
| | | | | | | | | | | | | Add a device_tree_dump() function which prints to main structure and properties names of a flat device tree (but not the properties values yet). This will be useful for debugging problems with the device tree generated for dom0. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* device tree: add device_tree_for_each_node()David Vrabel2012-03-221-26/+46
| | | | | | | | Add device_tree_for_each_node() to iterate over all nodes in a flat device tree. Use this in device_tree_early_init(). Signed-off-by: David Vrabel <david.vrabel@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* device tree: correctly ignore unit-address when matching nodes by nameDavid Vrabel2012-03-221-6/+16
| | | | | | | | | | When matching node by their name, correctly ignore the unit address (@...) part of the name. Previously, a "memory-controller" node would be incorrectly matched as a "memory" node. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* device tree: follow coding styleDavid Vrabel2012-03-221-18/+30
| | | | | | | Only changes to the coding style, no functional changes. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libfdt: move headers to xen/include/xen/libfdt/David Vrabel2012-03-221-2/+1
| | | | | | | | | Move the public libfdt headers to xen/include/xen/libfdt/ so CFLAGS does need to be set to find them. This requires minor tweaks to one of the headers imported from upstream. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* arm: setup MM using information from the device treeDavid Vrabel2012-02-131-1/+6
| | | | | | | | | | | Setup memory management, heaps etc. using the location and size of the first memory bank given in the device tree. The DTB is also copied so it can be used afterwards. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* arm, device tree: parse the DTB for RAM location and sizeDavid Vrabel2012-02-131-0/+179
Prior to setting up the page tables, parse the DTB for the location and size of RAM. Use this information to get the physical address to relocate Xen to in setup_pagetables(). Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>