diff options
Diffstat (limited to 'arch/powerpc/boot/devtree.c')
-rw-r--r-- | arch/powerpc/boot/devtree.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c index 60f561e307a9..5d12336dc360 100644 --- a/arch/powerpc/boot/devtree.c +++ b/arch/powerpc/boot/devtree.c | |||
@@ -350,3 +350,23 @@ int dt_is_compatible(void *node, const char *compat) | |||
350 | 350 | ||
351 | return 0; | 351 | return 0; |
352 | } | 352 | } |
353 | |||
354 | int dt_get_virtual_reg(void *node, void **addr, int nres) | ||
355 | { | ||
356 | unsigned long xaddr; | ||
357 | int n; | ||
358 | |||
359 | n = getprop(node, "virtual-reg", addr, nres * 4); | ||
360 | if (n > 0) | ||
361 | return n / 4; | ||
362 | |||
363 | for (n = 0; n < nres; n++) { | ||
364 | if (!dt_xlate_reg(node, n, &xaddr, NULL)) | ||
365 | break; | ||
366 | |||
367 | addr[n] = (void *)xaddr; | ||
368 | } | ||
369 | |||
370 | return n; | ||
371 | } | ||
372 | |||