|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 7/7] xen/arm: get the number of cpus from device tree
On Tue, 2012-11-13 at 15:42 +0000, Stefano Stabellini wrote:
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index 3d1f0f4..5b6dab9 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -153,6 +153,25 @@ const char *device_tree_bootargs(const void *fdt)
> return prop->data;
> }
>
> +int device_tree_cpus(const void *fdt)
> +{
> + int node = 0, depth = 1;
> + int cpus = 0;
> +
> + node = fdt_path_offset(fdt, "/cpus/cpu");
> + if ( node < 0 )
> + return 1; /* we have at least one cpu */
> +
> + while ( node >= 0 && depth >= 0 ) {
> + if ( strncmp(fdt_get_name(fdt, node, NULL), "cpu", 3) )
> + continue;
> + node = fdt_next_node(fdt, node, &depth);
> + cpus++;
Do we not need to track the largest <n> for each cpu@<n> which we see,
in order to handle systems with e.g. CPUs 0, 1, 4 & 5?
There are some helpers in device_tree.c to walk over trees like this,
are none of them suitable?
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |