From patchwork Thu Jun 27 13:04:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 255059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C1F7B2C00A6 for ; Thu, 27 Jun 2013 23:04:48 +1000 (EST) Received: from localhost ([::1]:56217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsBsU-00083T-CD for incoming@patchwork.ozlabs.org; Thu, 27 Jun 2013 09:04:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsBsC-00083C-LT for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:04:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsBs6-0000dH-J9 for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:04:28 -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]:58224 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsBs6-0000d8-C7 for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:04:22 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1UsBs0-00012J-Fm; Thu, 27 Jun 2013 14:04:16 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2013 14:04:13 +0100 Message-Id: <1372338255-3934-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1372338255-3934-1-git-send-email-peter.maydell@linaro.org> References: <1372338255-3934-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Anthony Liguori , patches@linaro.org, Alexander Graf , David Gibson , kvmarm@lists.cs.columbia.edu, KONRAD Frederic Subject: [Qemu-devel] [PATCH 6/8] arm/boot: Allow boards to modify the FDT blob X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 eb9a864..77d548c 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -293,6 +293,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;