[PATCH V4] powerpc/prom: Export device tree physical address via proc

Tabi Timur-B04825 B04825 at freescale.com
Thu Jul 15 01:33:15 EST 2010


Matthew McClintock wrote:

> +static struct property flat_dt_start_prop = {
> +	.name = "linux,devicetree-start",
> +	.length = sizeof(phys_addr_t),
> +	.value =&flat_dt_start,
> +};
> +
> +static struct property flat_dt_end_prop = {
> +	.name = "linux,devicetree-end",
> +	.length = sizeof(phys_addr_t),
> +	.value =&flat_dt_end,
> +};

I think Segher was suggesting that you use "linux,device-tree-xxx".

> +
> +static int __init export_flat_device_tree_phys_addr(void)
> +{
> +	struct property *prop;
> +	struct device_node *node;
> +
> +	node = of_find_node_by_path("/chosen");
> +	if (!node)
> +		return -ENOENT;
> +
> +	prop = of_find_property(node, "linux,devicetree-start", NULL);

Does this work?

prop = of_find_property(node, flat_dt_start_prop.name, NULL);

> +	if (prop)
> +		prom_remove_property(node, prop);
> +
> +	prop = of_find_property(node, "linux,devicetree-end", NULL);
> +	if (prop)
> +		prom_remove_property(node, prop);
> +
> +	flat_dt_start = virt_to_phys(initial_boot_params);
> +	flat_dt_end = virt_to_phys(initial_boot_params)
> +				+ initial_boot_params->totalsize;

This is better, I think:

	flat_dt_end = flat_dt_start + initial_boot_params->totalsize;

-- 
Timur Tabi
Linux kernel developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20100714/a810e1f0/attachment.htm>


More information about the Linuxppc-dev mailing list