From patchwork Tue Jul 16 12:25:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 18380 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 60A1925E5C for ; Tue, 16 Jul 2013 12:54:22 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id e11sf815762wgh.4 for ; Tue, 16 Jul 2013 05:54:21 -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=9hbvSewgq0gLe1dnovbzPc8PKp1+mtOyRNWCqpWRm1U=; b=hvJad4/mkrkBoZ2QfboWMkJOPKPX3LIOC09arqbtijvTXPFfHacOaSIjVv0oIhSjpm fPqODalvS8KypNN0ZR9BFaFFmq+cz2B/wcS6OwU8xJN+keqRdDMeijA/EIXtJyCpOJ07 yWrY8BisHqm9E7fK87cuYZLZItnY4LS+IW5bgI0GOgJaKnnd8aCoS6ntS35f27xoTnsY 03rqbDAiCBWZBw+SVgWhU/Bz+KSHd9yCSN8Nwo1jIyZU/cMgAGmz9pqv2Naq06oW2IRM cS8ZrX4i/46U4TvYtByucRBXaubvNLGZ5nT81oe4i4SRBJvtltgUEHCpgSclGHaFw7pS 6LdQ== X-Received: by 10.180.207.44 with SMTP id lt12mr828453wic.5.1373979261473; Tue, 16 Jul 2013 05:54:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.20.236 with SMTP id q12ls884965wie.22.canary; Tue, 16 Jul 2013 05:54:21 -0700 (PDT) X-Received: by 10.194.123.199 with SMTP id mc7mr1126570wjb.35.1373979261192; Tue, 16 Jul 2013 05:54:21 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id uu4si546397wjc.89.2013.07.16.05.54.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Jul 2013 05:54:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jz10so449869veb.31 for ; Tue, 16 Jul 2013 05:54:20 -0700 (PDT) X-Received: by 10.58.187.4 with SMTP id fo4mr398675vec.55.1373979260128; Tue, 16 Jul 2013 05:54:20 -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.220.149.77 with SMTP id s13csp118526vcv; Tue, 16 Jul 2013 05:54:19 -0700 (PDT) X-Received: by 10.194.9.70 with SMTP id x6mr1150413wja.19.1373979257767; Tue, 16 Jul 2013 05:54:17 -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 hr3si549620wib.40.2013.07.16.05.54.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 16 Jul 2013 05:54:17 -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 1Uz4Jd-0007XV-LH; Tue, 16 Jul 2013 13:25:13 +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 , Peter Crosthwaite Subject: [PATCH v3 6/8] arm/boot: Allow boards to modify the FDT blob Date: Tue, 16 Jul 2013 13:25:10 +0100 Message-Id: <1373977512-28932-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1373977512-28932-1-git-send-email-peter.maydell@linaro.org> References: <1373977512-28932-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQk5Qd//zcbvJfWwDgDJv2NdmKOwklfxsV6sn9ZLcwYY9gg/hK8drrfXWqV9kivfvkqyviSj X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.172 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 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;