From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Eh8-00057G-LH for qemu-devel@nongnu.org; Mon, 22 Jul 2013 07:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Eh4-0001Cs-2H for qemu-devel@nongnu.org; Mon, 22 Jul 2013 07:54:26 -0400 Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:1d0::1]:58897 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Eh3-0001CZ-R9 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 07:54:21 -0400 From: Peter Maydell Date: Mon, 22 Jul 2013 12:43:43 +0100 Message-Id: <1374493427-3254-7-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1374493427-3254-1-git-send-email-peter.maydell@linaro.org> References: <1374493427-3254-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 06/10] arm/boot: Allow boards to modify the FDT blob List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, Paul Brook Add a callback hook in arm_boot_info to allow board models to modify the device tree blob if they need to. (The major expected use case is to add virtio-mmio nodes for virtio-mmio transports that exist in QEMU but not in the hardware.) Signed-off-by: Peter Maydell Message-id: 1373977512-28932-7-git-send-email-peter.maydell@linaro.org --- hw/arm/boot.c | 5 +++++ include/hw/arm/arm.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 1780316..9fbe5d2 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -294,6 +294,11 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) goto fail; } } + + if (binfo->modify_dtb) { + binfo->modify_dtb(binfo, fdt); + } + qemu_devtree_dumpdtb(fdt, size); cpu_physical_memory_write(addr, fdt, size); diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h index 7b2b02d..bae87c6 100644 --- a/include/hw/arm/arm.h +++ b/include/hw/arm/arm.h @@ -55,6 +55,10 @@ struct arm_boot_info { const struct arm_boot_info *info); void (*secondary_cpu_reset_hook)(ARMCPU *cpu, const struct arm_boot_info *info); + /* if a board needs to be able to modify a device tree provided by + * the user it should implement this hook. + */ + void (*modify_dtb)(const struct arm_boot_info *info, void *fdt); /* Used internally by arm_boot.c */ int is_linux; hwaddr initrd_start; -- 1.7.9.5