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: 18152 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f200.google.com (mail-gh0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4171D23910 for ; Thu, 27 Jun 2013 13:04:24 +0000 (UTC) Received: by mail-gh0-f200.google.com with SMTP id 10sf947336ghy.3 for ; Thu, 27 Jun 2013 06:04:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=zJu68O6mKu+zMLNjxbdLR73Wn6WWPaIxucRsL3aBwIE=; b=JtRqlOhYyRdxpAzoEOxseiuPyu9qSdI2ZjkUfvIGP9U250IwTlGRZ5snPfxHgxkwc8 yrxJwy0UGK6lC1xvKrKeekV+dwuUfGXO78lM7Y+MsQZVRb+DRz+bWJncqytsP7TSp7Um UgUI+UzmAz65uP34c8UbpuUuuugp2zLBzGNrOe268WGLBZasjq2OPwhJ59S3AHhwf+Lk 6uQJqEd0+pe0lwl4R/nHXwPJW0M0RhOapx2yFsOIIOpBKP1crxVhQ8n96GXPlK+BqqM/ H2MA9NRSTJTTRWR8I2kx9exBIy0UuJj1UpFlZu+qoeFqQGDFgOkERastwbJ5q40W0IEz iwZw== X-Received: by 10.58.75.169 with SMTP id d9mr949168vew.14.1372338263394; Thu, 27 Jun 2013 06:04:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.14.71 with SMTP id n7ls599912qec.2.gmail; Thu, 27 Jun 2013 06:04:23 -0700 (PDT) X-Received: by 10.220.16.137 with SMTP id o9mr3388066vca.41.1372338263183; Thu, 27 Jun 2013 06:04:23 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id ia10si758776vdb.51.2013.06.27.06.04.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Jun 2013 06:04:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id 10so599560vbe.33 for ; Thu, 27 Jun 2013 06:04:23 -0700 (PDT) X-Received: by 10.52.27.172 with SMTP id u12mr2884618vdg.64.1372338263065; Thu, 27 Jun 2013 06:04:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp147623veb; Thu, 27 Jun 2013 06:04:22 -0700 (PDT) X-Received: by 10.180.206.70 with SMTP id lm6mr15903561wic.50.1372338261741; Thu, 27 Jun 2013 06:04:21 -0700 (PDT) Received: from mnementh.archaic.org.uk (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]) by mx.google.com with ESMTPS id r3si1005906wjw.75.2013.06.27.06.04.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 27 Jun 2013 06:04:21 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; 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 Cc: patches@linaro.org, kvmarm@lists.cs.columbia.edu, Anthony Liguori , Alexander Graf , KONRAD Frederic , David Gibson Subject: [PATCH 6/8] arm/boot: Allow boards to modify the FDT blob 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-Gm-Message-State: ALoCoQk+CCvnYMjTzwKngOEjsvxJ6IJGMejo3VnHR3I813dXeT7s7GUYWGGxtkHM1EI/2ExUWIYs X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;