From patchwork Mon Jan 26 19:03:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 43776 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2588220D5D for ; Mon, 26 Jan 2015 19:04:19 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf121003wiv.2 for ; Mon, 26 Jan 2015 11:04:18 -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=WJuJedtoN4NXAgwQQ07HYNvewd5ATb992Xx7sVaNTXc=; b=g8pzJX9ji5gsVHuL0NRax28go5Jt/hstQgdp5DMugaKLbBsSK08l6yhvU2qHHiStTb ozXp8/45Q36hJUls+nR53kvudJbNDdOEpQdmWlIP2SqNHEQrMMWdV/H/koHtB8pLd+wr iDW+OZkBrumZIoCoMW26FeLLqZXNdPHPw36YvJmEsBvUDxEdUGwzbn+fidccS2Fxr+bw k9V4in7c/GzdsRe7fJvdjAVgoZhK0n3HO0LUWFynwD3TwgddGM+hmByLz8CCpFUXNzw7 3Ag+yFhl/L1Z7HIdb8uEP9eymFy+A7G7KYF2/FOkF1dif+YHWx2Gco/EhgirfBc9YKa1 dS+A== X-Gm-Message-State: ALoCoQmNGhzyf8GKc0jawP3ChotQFwvG3WZdzl2HvVK/KZtaVqLR+xUTGP2qkRSgLyrmqOD5PE4p X-Received: by 10.112.148.198 with SMTP id tu6mr2758768lbb.3.1422299058418; Mon, 26 Jan 2015 11:04:18 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.71 with SMTP id k7ls557517laf.9.gmail; Mon, 26 Jan 2015 11:04:18 -0800 (PST) X-Received: by 10.112.236.41 with SMTP id ur9mr22988731lbc.44.1422299058270; Mon, 26 Jan 2015 11:04:18 -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 c8si7559218lbb.103.2015.01.26.11.04.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:18 -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 gd6so9369860lab.4 for ; Mon, 26 Jan 2015 11:04:18 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr22979827lal.29.1422299058175; Mon, 26 Jan 2015 11:04:18 -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.35.133 with SMTP id h5csp870253lbj; Mon, 26 Jan 2015 11:04:17 -0800 (PST) X-Received: by 10.42.151.197 with SMTP id f5mr3863312icw.27.1422299056612; Mon, 26 Jan 2015 11:04:16 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id pq5si8618343icb.2.2015.01.26.11.04.14 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:16 -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-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YFoxA-0002q7-D2; Mon, 26 Jan 2015 19:04:04 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YFox8-0002po-Gx for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:04:02 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.48 as permitted sender) client-ip=74.125.82.48; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f48.google.com; Received: from mail-wg0-f48.google.com ([74.125.82.48]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YFox9-00071L-8E for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:04:04 +0000 Received: by mail-wg0-f48.google.com with SMTP id x12so10742579wgg.7 for ; Mon, 26 Jan 2015 11:03:58 -0800 (PST) X-Received: by 10.194.175.69 with SMTP id by5mr46726808wjc.32.1422299038389; Mon, 26 Jan 2015 11:03:58 -0800 (PST) Received: from ards-macbook-pro.local ([197.129.8.190]) by mx.google.com with ESMTPSA id fo17sm15471007wjc.19.2015.01.26.11.03.55 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:03:57 -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: Mon, 26 Jan 2015 19:03:06 +0000 Message-Id: <1422299011-2409-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422299011-2409-1-git-send-email-ard.biesheuvel@linaro.org> References: <1422299011-2409-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: 1YFox9-00071L-8E Subject: [edk2] [PATCH v2 04/29] 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 Reviewed-by: Olivier Martin Acked-by: Laszlo Ersek Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/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 1d44f9ba02b3..31164905d34e 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);