From patchwork Fri Jan 23 15:02:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 43652 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 73282218DB for ; Fri, 23 Jan 2015 15:03:53 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf1696951wiv.0 for ; Fri, 23 Jan 2015 07:03:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=zhWZjGtksgXA6WBk0mTksv213L/xCQuXv6E4l7vUA7Q=; b=SSBzcin56ol99aUu904mCeI1evafQhtOM9mJ+QHkp4y4zKUIWq+NedndNrgGpXfe4+ I2bRr87JIu3edtZZWklCvrwfcCFxwAS1WL+8DrtreVojVrgqkIHhTv5KZi1y0pmievMG LKgfujoGDu5/crIIgXV2kZGUQBozyVu/Af5CRQDNNXN8msxk0AeDT/yNis6/xDaBTgSH MNAkXiKwf83t+rQCx86sraeosgb1wzPFn3HZtDeDOaiY/iTPXn8Tr0mhf+kQ6mo0aUz0 QLvitaRxAPR8/21ZxBTykYkcUvch1ipm7Ndm96RaUnYzCutFme+54B4qiMFO4byHONep 7UIg== X-Gm-Message-State: ALoCoQk2zsJV0oXJ1JsU9Y47Lu0L0v9VfjrHodP3360/RF/g7YDBGPwVq4RVr70HdRenlD3TR+uG X-Received: by 10.180.37.107 with SMTP id x11mr357527wij.5.1422025432769; Fri, 23 Jan 2015 07:03:52 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.161.198 with SMTP id xu6ls274256lab.86.gmail; Fri, 23 Jan 2015 07:03:52 -0800 (PST) X-Received: by 10.112.235.194 with SMTP id uo2mr7692304lbc.57.1422025432598; Fri, 23 Jan 2015 07:03:52 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id r5si1540347lah.125.2015.01.23.07.03.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jan 2015 07:03:52 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id gd6so7746590lab.4 for ; Fri, 23 Jan 2015 07:03:52 -0800 (PST) X-Received: by 10.152.197.5 with SMTP id iq5mr7852254lac.6.1422025432311; Fri, 23 Jan 2015 07:03:52 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp282951lbb; Fri, 23 Jan 2015 07:03:51 -0800 (PST) X-Received: by 10.50.143.44 with SMTP id sb12mr2296509igb.3.1422025430696; Fri, 23 Jan 2015 07:03:50 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id y10si1078287igl.26.2015.01.23.07.03.50 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 23 Jan 2015 07:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YEflt-0007l6-V6; Fri, 23 Jan 2015 15:03:41 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YEfls-0007l1-La for edk2-devel@lists.sourceforge.net; Fri, 23 Jan 2015 15:03:40 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.47 as permitted sender) client-ip=74.125.82.47; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f47.google.com; Received: from mail-wg0-f47.google.com ([74.125.82.47]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YEflo-0001r2-JS for edk2-devel@lists.sourceforge.net; Fri, 23 Jan 2015 15:03:40 +0000 Received: by mail-wg0-f47.google.com with SMTP id n12so7989559wgh.6 for ; Fri, 23 Jan 2015 07:03:30 -0800 (PST) X-Received: by 10.180.91.44 with SMTP id cb12mr3570187wib.0.1422025410554; Fri, 23 Jan 2015 07:03:30 -0800 (PST) Received: from ards-macbook-pro.local ([197.129.136.117]) by mx.google.com with ESMTPSA id pl1sm2176036wic.16.2015.01.23.07.03.27 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 07:03:29 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com, roy.franz@linaro.org, leif.lindholm@linaro.org, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, anthony.perard@citrix.com, christoffer.dall@linaro.org, xen-devel@lists.xen.org, ilias.biris@linaro.org Date: Fri, 23 Jan 2015 15:02:51 +0000 Message-Id: <1422025390-8036-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422025390-8036-1-git-send-email-ard.biesheuvel@linaro.org> References: <1422025390-8036-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1YEflo-0001r2-JS Subject: [edk2] [PATCH v1 02/21] ArmVirtualizationPkg: add GICv3 detection to VirtFdtDxe X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This adds support for detecting the presence of a GICv3 interrupt controller from the device tree, and recording its distributor base address in a PCD. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c index 4e4f608923d3..8953f78f5fe4 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c +++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c @@ -46,6 +46,7 @@ typedef enum { PropertyTypeTimer, PropertyTypePsci, PropertyTypeFwCfg, + PropertyTypeGicV3, } PROPERTY_TYPE; typedef struct { @@ -62,6 +63,7 @@ STATIC CONST PROPERTY CompatibleProperties[] = { { PropertyTypeTimer, "arm,armv8-timer" }, { PropertyTypePsci, "arm,psci-0.2" }, { PropertyTypeFwCfg, "qemu,fw-cfg-mmio" }, + { PropertyTypeGicV3, "arm,gic-v3" }, { PropertyTypeUnknown, "" } }; @@ -256,6 +258,23 @@ InitializeVirtFdtDxe ( DEBUG ((EFI_D_INFO, "Found GIC @ 0x%Lx/0x%Lx\n", DistBase, CpuBase)); break; + case PropertyTypeGicV3: + // + // The GIC v3 DT binding describes a series of at least 3 physical base + // addresses, but we are only interested in the first one, which is the + // distributor interface. (We use the system register CPU interface, not + // the MMIO one) + // + ASSERT (Len >= 16); + + DistBase = fdt64_to_cpu (((UINT64 *)RegProp)[0]); + ASSERT (DistBase < MAX_UINT32); + + PcdSet32 (PcdGicDistributorBase, (UINT32)DistBase); + + DEBUG ((EFI_D_INFO, "Found GIC v3 distributor @ 0x%Lx\n", DistBase)); + break; + case PropertyTypeRtc: ASSERT (Len == 16);