* [Qemu-devel] [PATCH v2 0/6] arm_boot/vexpress-a15: Support >4GB of RAM
@ 2012-07-16 13:24 Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 1/6] hw/arm_boot.c: Make ram_size a uint64_t Peter Maydell
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Peter Maydell @ 2012-07-16 13:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Crosthwaite, patches
From: Peter Maydell <petmay01@cam-vm-266.(none)>
This patchset adds support for booting with >4GB of RAM on the
Versatile Express Cortex-A15 model. There are some caveats:
* you need an LPAE A15 kernel
* you need to be booting with device tree
* your device tree blob needs to specify #address-cells and
#size-cells as 2 (so addresses and sizes are 64 bit), which
means you'll need to tweak the stock kernel dtb
[the dtb files for the vexpress boards should be getting this change
soon, although I'm not sure when it will hit upstream]
* you need a minor kernel patch which stops the kernel throwing away
the high 32 bits of the RAM size:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7465/1
[hopefully coming soon to an upstream kernel near you]
* you need a 64 bit host, obviously
Changes v1->v2:
* now based on master, no other dependencies
* use uint64_t rather than target_phys_addr_t for sizes
* removed debug tracing
* tweaked "ram size too big for ATAGS boot" message
NB that (following discussion with Peter C) the device_tree.c
patch is unchanged from v1.
Peter Maydell (6):
hw/arm_boot.c: Make ram_size a uint64_t
hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct
hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity
device_tree: Add support for reading device tree properties
hw/arm_boot.c: Support DTBs which use 64 bit addresses
hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard
device_tree.c | 30 ++++++++++++++++++++++++++++++
device_tree.h | 4 ++++
hw/arm-misc.h | 2 +-
hw/arm_boot.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
hw/vexpress.c | 13 ++++++++++---
5 files changed, 86 insertions(+), 9 deletions(-)
--
1.7.5.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v2 1/6] hw/arm_boot.c: Make ram_size a uint64_t
2012-07-16 13:24 [Qemu-devel] [PATCH v2 0/6] arm_boot/vexpress-a15: Support >4GB of RAM Peter Maydell
@ 2012-07-16 13:24 ` Peter Maydell
2012-07-18 12:25 ` Peter Crosthwaite
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 2/6] hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct Peter Maydell
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2012-07-16 13:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Crosthwaite, patches
Make the RAM size in arm_boot_info a uint64_t so it can express
the larger RAM sizes that may be seen in LPAE systems.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm-misc.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 1f96229..bdd8fec 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -25,7 +25,7 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
/* arm_boot.c */
struct arm_boot_info {
- int ram_size;
+ uint64_t ram_size;
const char *kernel_filename;
const char *kernel_cmdline;
const char *initrd_filename;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v2 2/6] hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct
2012-07-16 13:24 [Qemu-devel] [PATCH v2 0/6] arm_boot/vexpress-a15: Support >4GB of RAM Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 1/6] hw/arm_boot.c: Make ram_size a uint64_t Peter Maydell
@ 2012-07-16 13:24 ` Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 3/6] hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity Peter Maydell
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2012-07-16 13:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Crosthwaite, patches
Clean up the mix of getting the RAM size from the global ram_size
and from the ram_size field in the arm_boot_info structure, so
that we always use the structure field.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
---
hw/arm_boot.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index a1e6ddb..29ae324 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -357,7 +357,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
if (kernel_size < 0) {
entry = info->loader_start + KERNEL_LOAD_ADDR;
kernel_size = load_image_targphys(info->kernel_filename, entry,
- ram_size - KERNEL_LOAD_ADDR);
+ info->ram_size - KERNEL_LOAD_ADDR);
is_linux = 1;
}
if (kernel_size < 0) {
@@ -371,7 +371,8 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
initrd_size = load_image_targphys(info->initrd_filename,
info->loader_start
+ INITRD_LOAD_ADDR,
- ram_size - INITRD_LOAD_ADDR);
+ info->ram_size
+ - INITRD_LOAD_ADDR);
if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initrd '%s'\n",
info->initrd_filename);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v2 3/6] hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity
2012-07-16 13:24 [Qemu-devel] [PATCH v2 0/6] arm_boot/vexpress-a15: Support >4GB of RAM Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 1/6] hw/arm_boot.c: Make ram_size a uint64_t Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 2/6] hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct Peter Maydell
@ 2012-07-16 13:24 ` Peter Maydell
2012-07-18 12:28 ` Peter Crosthwaite
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 4/6] device_tree: Add support for reading device tree properties Peter Maydell
` (2 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2012-07-16 13:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Crosthwaite, patches
The legacy ATAGS format for passing information to the kernel only
allows RAM sizes which fit in 32 bits; enforce this restriction
rather than silently doing something weird.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm_boot.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 29ae324..af71ed6 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -399,6 +399,12 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
bootloader[5] = dtb_start;
} else {
bootloader[5] = info->loader_start + KERNEL_ARGS_ADDR;
+ if (info->ram_size >= (1ULL << 32)) {
+ fprintf(stderr, "qemu: RAM size must be less than 4GB to boot"
+ " Linux kernel using ATAGS (try passing a device tree"
+ " using -dtb)\n");
+ exit(1);
+ }
}
bootloader[6] = entry;
for (n = 0; n < sizeof(bootloader) / 4; n++) {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v2 4/6] device_tree: Add support for reading device tree properties
2012-07-16 13:24 [Qemu-devel] [PATCH v2 0/6] arm_boot/vexpress-a15: Support >4GB of RAM Peter Maydell
` (2 preceding siblings ...)
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 3/6] hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity Peter Maydell
@ 2012-07-16 13:24 ` Peter Maydell
2012-07-18 12:30 ` Peter Crosthwaite
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 5/6] hw/arm_boot.c: Support DTBs which use 64 bit addresses Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 6/6] hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard Peter Maydell
5 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2012-07-16 13:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Crosthwaite, patches
Add support for reading device tree properties (both generic
and single-cell ones) to QEMU's convenience wrapper layer.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
device_tree.c | 30 ++++++++++++++++++++++++++++++
device_tree.h | 4 ++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/device_tree.c b/device_tree.c
index b366fdd..d7a9b6b 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -178,6 +178,36 @@ int qemu_devtree_setprop_string(void *fdt, const char *node_path,
return r;
}
+const void *qemu_devtree_getprop(void *fdt, const char *node_path,
+ const char *property, int *lenp)
+{
+ int len;
+ const void *r;
+ if (!lenp) {
+ lenp = &len;
+ }
+ r = fdt_getprop(fdt, findnode_nofail(fdt, node_path), property, lenp);
+ if (!r) {
+ fprintf(stderr, "%s: Couldn't get %s/%s: %s\n", __func__,
+ node_path, property, fdt_strerror(*lenp));
+ exit(1);
+ }
+ return r;
+}
+
+uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path,
+ const char *property)
+{
+ int len;
+ const uint32_t *p = qemu_devtree_getprop(fdt, node_path, property, &len);
+ if (len != 4) {
+ fprintf(stderr, "%s: %s/%s not 4 bytes long (not a cell?)\n",
+ __func__, node_path, property);
+ exit(1);
+ }
+ return be32_to_cpu(*p);
+}
+
uint32_t qemu_devtree_get_phandle(void *fdt, const char *path)
{
uint32_t r;
diff --git a/device_tree.h b/device_tree.h
index 2244270..f7a3e6c 100644
--- a/device_tree.h
+++ b/device_tree.h
@@ -28,6 +28,10 @@ int qemu_devtree_setprop_string(void *fdt, const char *node_path,
int qemu_devtree_setprop_phandle(void *fdt, const char *node_path,
const char *property,
const char *target_node_path);
+const void *qemu_devtree_getprop(void *fdt, const char *node_path,
+ const char *property, int *lenp);
+uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path,
+ const char *property);
uint32_t qemu_devtree_get_phandle(void *fdt, const char *path);
uint32_t qemu_devtree_alloc_phandle(void *fdt);
int qemu_devtree_nop_node(void *fdt, const char *node_path);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v2 5/6] hw/arm_boot.c: Support DTBs which use 64 bit addresses
2012-07-16 13:24 [Qemu-devel] [PATCH v2 0/6] arm_boot/vexpress-a15: Support >4GB of RAM Peter Maydell
` (3 preceding siblings ...)
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 4/6] device_tree: Add support for reading device tree properties Peter Maydell
@ 2012-07-16 13:24 ` Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 6/6] hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard Peter Maydell
5 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2012-07-16 13:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Crosthwaite, patches
Support the case where the device tree blob specifies that
#address-cells and #size-cells are greater than 1. (This
is needed for device trees which can handle 64 bit physical
addresses and thus total RAM sizes over 4GB.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
---
hw/arm_boot.c | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index af71ed6..a6e9143 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -216,11 +216,12 @@ static void set_kernel_args_old(const struct arm_boot_info *info)
static int load_dtb(target_phys_addr_t addr, const struct arm_boot_info *binfo)
{
#ifdef CONFIG_FDT
- uint32_t mem_reg_property[] = { cpu_to_be32(binfo->loader_start),
- cpu_to_be32(binfo->ram_size) };
+ uint32_t *mem_reg_property;
+ uint32_t mem_reg_propsize;
void *fdt = NULL;
char *filename;
int size, rc;
+ uint32_t acells, scells, hival;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, binfo->dtb_filename);
if (!filename) {
@@ -236,8 +237,36 @@ static int load_dtb(target_phys_addr_t addr, const struct arm_boot_info *binfo)
}
g_free(filename);
+ acells = qemu_devtree_getprop_cell(fdt, "/", "#address-cells");
+ scells = qemu_devtree_getprop_cell(fdt, "/", "#size-cells");
+ if (acells == 0 || scells == 0) {
+ fprintf(stderr, "dtb file invalid (#address-cells or #size-cells 0)\n");
+ return -1;
+ }
+
+ mem_reg_propsize = acells + scells;
+ mem_reg_property = g_new0(uint32_t, mem_reg_propsize);
+ mem_reg_property[acells - 1] = cpu_to_be32(binfo->loader_start);
+ hival = cpu_to_be32(binfo->loader_start >> 32);
+ if (acells > 1) {
+ mem_reg_property[acells - 2] = hival;
+ } else if (hival != 0) {
+ fprintf(stderr, "qemu: dtb file not compatible with "
+ "RAM start address > 4GB\n");
+ exit(1);
+ }
+ mem_reg_property[acells + scells - 1] = cpu_to_be32(binfo->ram_size);
+ hival = cpu_to_be32(binfo->ram_size >> 32);
+ if (scells > 1) {
+ mem_reg_property[acells + scells - 2] = hival;
+ } else if (hival != 0) {
+ fprintf(stderr, "qemu: dtb file not compatible with "
+ "RAM size > 4GB\n");
+ exit(1);
+ }
+
rc = qemu_devtree_setprop(fdt, "/memory", "reg", mem_reg_property,
- sizeof(mem_reg_property));
+ mem_reg_propsize * sizeof(uint32_t));
if (rc < 0) {
fprintf(stderr, "couldn't set /memory/reg\n");
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v2 6/6] hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard
2012-07-16 13:24 [Qemu-devel] [PATCH v2 0/6] arm_boot/vexpress-a15: Support >4GB of RAM Peter Maydell
` (4 preceding siblings ...)
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 5/6] hw/arm_boot.c: Support DTBs which use 64 bit addresses Peter Maydell
@ 2012-07-16 13:24 ` Peter Maydell
5 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2012-07-16 13:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Crosthwaite, patches
Now that we have LPAE support and can handle passing 64 bit
RAM sizes to Linux via the device tree, we can lift the
restriction in the Versatile Express A15 daughterboard model
on not having more than 2GB of RAM. Allow up to 30GB, which
is the maximum that can fit in the address map before running
into the (unmodelled) aliases of the first 2GB.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/vexpress.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/vexpress.c b/hw/vexpress.c
index 8072c5a..b2dc8a5 100644
--- a/hw/vexpress.c
+++ b/hw/vexpress.c
@@ -284,9 +284,16 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard,
cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
}
- if (ram_size > 0x80000000) {
- fprintf(stderr, "vexpress-a15: cannot model more than 2GB RAM\n");
- exit(1);
+ {
+ /* We have to use a separate 64 bit variable here to avoid the gcc
+ * "comparison is always false due to limited range of data type"
+ * warning if we are on a host where ram_addr_t is 32 bits.
+ */
+ uint64_t rsz = ram_size;
+ if (rsz > (30ULL * 1024 * 1024 * 1024)) {
+ fprintf(stderr, "vexpress-a15: cannot model more than 30GB RAM\n");
+ exit(1);
+ }
}
memory_region_init_ram(ram, "vexpress.highmem", ram_size);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/6] hw/arm_boot.c: Make ram_size a uint64_t
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 1/6] hw/arm_boot.c: Make ram_size a uint64_t Peter Maydell
@ 2012-07-18 12:25 ` Peter Crosthwaite
0 siblings, 0 replies; 10+ messages in thread
From: Peter Crosthwaite @ 2012-07-18 12:25 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
On Mon, Jul 16, 2012 at 11:24 PM, Peter Maydell
<peter.maydell@linaro.org> wrote:
> Make the RAM size in arm_boot_info a uint64_t so it can express
> the larger RAM sizes that may be seen in LPAE systems.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
> ---
> hw/arm-misc.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/arm-misc.h b/hw/arm-misc.h
> index 1f96229..bdd8fec 100644
> --- a/hw/arm-misc.h
> +++ b/hw/arm-misc.h
> @@ -25,7 +25,7 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
>
> /* arm_boot.c */
> struct arm_boot_info {
> - int ram_size;
> + uint64_t ram_size;
> const char *kernel_filename;
> const char *kernel_cmdline;
> const char *initrd_filename;
> --
> 1.7.5.4
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH v2 3/6] hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 3/6] hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity Peter Maydell
@ 2012-07-18 12:28 ` Peter Crosthwaite
0 siblings, 0 replies; 10+ messages in thread
From: Peter Crosthwaite @ 2012-07-18 12:28 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
On Mon, Jul 16, 2012 at 11:24 PM, Peter Maydell
<peter.maydell@linaro.org> wrote:
> The legacy ATAGS format for passing information to the kernel only
> allows RAM sizes which fit in 32 bits; enforce this restriction
> rather than silently doing something weird.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
> ---
> hw/arm_boot.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/hw/arm_boot.c b/hw/arm_boot.c
> index 29ae324..af71ed6 100644
> --- a/hw/arm_boot.c
> +++ b/hw/arm_boot.c
> @@ -399,6 +399,12 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
> bootloader[5] = dtb_start;
> } else {
> bootloader[5] = info->loader_start + KERNEL_ARGS_ADDR;
> + if (info->ram_size >= (1ULL << 32)) {
> + fprintf(stderr, "qemu: RAM size must be less than 4GB to boot"
> + " Linux kernel using ATAGS (try passing a device tree"
> + " using -dtb)\n");
> + exit(1);
> + }
> }
> bootloader[6] = entry;
> for (n = 0; n < sizeof(bootloader) / 4; n++) {
> --
> 1.7.5.4
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH v2 4/6] device_tree: Add support for reading device tree properties
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 4/6] device_tree: Add support for reading device tree properties Peter Maydell
@ 2012-07-18 12:30 ` Peter Crosthwaite
0 siblings, 0 replies; 10+ messages in thread
From: Peter Crosthwaite @ 2012-07-18 12:30 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
On Mon, Jul 16, 2012 at 11:24 PM, Peter Maydell
<peter.maydell@linaro.org> wrote:
> Add support for reading device tree properties (both generic
> and single-cell ones) to QEMU's convenience wrapper layer.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
> ---
> device_tree.c | 30 ++++++++++++++++++++++++++++++
> device_tree.h | 4 ++++
> 2 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/device_tree.c b/device_tree.c
> index b366fdd..d7a9b6b 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -178,6 +178,36 @@ int qemu_devtree_setprop_string(void *fdt, const char *node_path,
> return r;
> }
>
> +const void *qemu_devtree_getprop(void *fdt, const char *node_path,
> + const char *property, int *lenp)
> +{
> + int len;
> + const void *r;
> + if (!lenp) {
> + lenp = &len;
> + }
> + r = fdt_getprop(fdt, findnode_nofail(fdt, node_path), property, lenp);
> + if (!r) {
> + fprintf(stderr, "%s: Couldn't get %s/%s: %s\n", __func__,
> + node_path, property, fdt_strerror(*lenp));
> + exit(1);
> + }
> + return r;
> +}
> +
> +uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path,
> + const char *property)
> +{
> + int len;
> + const uint32_t *p = qemu_devtree_getprop(fdt, node_path, property, &len);
> + if (len != 4) {
> + fprintf(stderr, "%s: %s/%s not 4 bytes long (not a cell?)\n",
> + __func__, node_path, property);
> + exit(1);
> + }
> + return be32_to_cpu(*p);
> +}
> +
> uint32_t qemu_devtree_get_phandle(void *fdt, const char *path)
> {
> uint32_t r;
> diff --git a/device_tree.h b/device_tree.h
> index 2244270..f7a3e6c 100644
> --- a/device_tree.h
> +++ b/device_tree.h
> @@ -28,6 +28,10 @@ int qemu_devtree_setprop_string(void *fdt, const char *node_path,
> int qemu_devtree_setprop_phandle(void *fdt, const char *node_path,
> const char *property,
> const char *target_node_path);
> +const void *qemu_devtree_getprop(void *fdt, const char *node_path,
> + const char *property, int *lenp);
> +uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path,
> + const char *property);
> uint32_t qemu_devtree_get_phandle(void *fdt, const char *path);
> uint32_t qemu_devtree_alloc_phandle(void *fdt);
> int qemu_devtree_nop_node(void *fdt, const char *node_path);
> --
> 1.7.5.4
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-07-18 12:30 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-16 13:24 [Qemu-devel] [PATCH v2 0/6] arm_boot/vexpress-a15: Support >4GB of RAM Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 1/6] hw/arm_boot.c: Make ram_size a uint64_t Peter Maydell
2012-07-18 12:25 ` Peter Crosthwaite
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 2/6] hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 3/6] hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity Peter Maydell
2012-07-18 12:28 ` Peter Crosthwaite
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 4/6] device_tree: Add support for reading device tree properties Peter Maydell
2012-07-18 12:30 ` Peter Crosthwaite
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 5/6] hw/arm_boot.c: Support DTBs which use 64 bit addresses Peter Maydell
2012-07-16 13:24 ` [Qemu-devel] [PATCH v2 6/6] hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).