From patchwork Fri May 29 12:33:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 49166 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 0315F218EC for ; Fri, 29 May 2015 12:34:14 +0000 (UTC) Received: by wibbk2 with SMTP id bk2sf5769495wib.2 for ; Fri, 29 May 2015 05:34:13 -0700 (PDT) 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=A93qMxnJFuObKBThJAJUd8U8XgEJDdHnbiK+WomebVc=; b=mgko7A+RygGadRT+Tnd+avCMqlsjJ3lgGmCQf8B89tRPhuFs8bvqKlDyUpfGUEHZGS h9VJFUrojaNqMNtzLkXY2HAmvKldR54cuKbuwK+MVqSRHg3URIN71qPlzIhUJ9c6iaNg j3bDkuZGWEIbHt10mVTb4ehK6X5EV0QyNZmKZzKs1E6E4lEz5Z5p9YY5E1Tno0iiWBWb 1JrmaZvFjISLNn9EKTV1JhOFkL6bLSA+fNRiOqgL2+gGcXQDTdi47FkIJE49equkJB7K 2gAxucaRytgAVjBPWq5h/eWdt2EQ+w0GAVNUdQtx4Wioyh8Dv713vx2zMYijX0Dw+GEy +xLQ== X-Gm-Message-State: ALoCoQnzrWNnSXUBq4Rm9VjuFKcYr5Q3HH3StwgFQV0NghgU8GrCTB4KRF73dGxHH1bUtITZsUZV X-Received: by 10.112.166.137 with SMTP id zg9mr7207020lbb.11.1432902853235; Fri, 29 May 2015 05:34:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.100 with SMTP id z4ls277308laz.57.gmail; Fri, 29 May 2015 05:34:13 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr7910321lad.56.1432902853084; Fri, 29 May 2015 05:34:13 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id js14si4556884lab.166.2015.05.29.05.34.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2015 05:34:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by labko7 with SMTP id ko7so50989982lab.2 for ; Fri, 29 May 2015 05:34:12 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr7752267lbc.88.1432902852647; Fri, 29 May 2015 05:34:12 -0700 (PDT) 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.108.230 with SMTP id hn6csp290726lbb; Fri, 29 May 2015 05:34:11 -0700 (PDT) X-Received: by 10.43.141.196 with SMTP id jf4mr14687497icc.80.1432902850691; Fri, 29 May 2015 05:34:10 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id g82si1400652ioe.85.2015.05.29.05.34.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 29 May 2015 05:34:10 -0700 (PDT) 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-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YyJU7-00039x-6c; Fri, 29 May 2015 12:33:59 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YyJU6-00039o-Lf for edk2-devel@lists.sourceforge.net; Fri, 29 May 2015 12:33:58 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.175 as permitted sender) client-ip=209.85.212.175; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f175.google.com; Received: from mail-wi0-f175.google.com ([209.85.212.175]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YyJU4-0003vF-MN for edk2-devel@lists.sourceforge.net; Fri, 29 May 2015 12:33:58 +0000 Received: by wicmc15 with SMTP id mc15so14766030wic.1 for ; Fri, 29 May 2015 05:33:50 -0700 (PDT) X-Received: by 10.194.143.75 with SMTP id sc11mr14560505wjb.62.1432902830695; Fri, 29 May 2015 05:33:50 -0700 (PDT) Received: from localhost.localdomain ([109.112.79.182]) by mx.google.com with ESMTPSA id ex5sm2953226wib.2.2015.05.29.05.33.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 May 2015 05:33:49 -0700 (PDT) From: Ard Biesheuvel To: lersek@redhat.com, olivier.martin@arm.com, leif.lindholm@linaro.org, edk2-devel@lists.sourceforge.net Date: Fri, 29 May 2015 14:33:36 +0200 Message-Id: <1432902820-18721-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432902820-18721-1-git-send-email-ard.biesheuvel@linaro.org> References: <1432902820-18721-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: 1YyJU4-0003vF-MN Subject: [edk2] [PATCH 3/7] ArmPkg: split off ArmGicArchLib from ArmGicLib 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.44 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 The current implementation of ArmGicGetSupportedArchRevision () that is used by all ARM platforms is entirely stateless (in order to support being executed from flash) so it needs to interrogate the hardware for the supported GIC revision upon each invocation. However, this statelessness is only needed for SEC type modules; in all other cases, we could easily determine the GIC revision once, and store the result in a global variable. In preparation of having separate early and normal versions, this patch introduces the ArmGicArchLib library class and default implementation, and moves the existing ArmGicGetSupportedArchRevision () into it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/ArmPkg.dec | 1 + ArmPkg/ArmPkg.dsc | 1 + ArmPkg/Drivers/ArmGic/ArmGicLib.inf | 3 +- ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf | 3 +- ArmPkg/Include/Library/ArmGicArchLib.h | 33 ++++++++++++ ArmPkg/Include/Library/ArmGicLib.h | 14 +---- ArmPkg/{Drivers/ArmGic => Library/ArmGicArchLib}/AArch64/ArmGicArchLib.c | 0 ArmPkg/{Drivers/ArmGic => Library/ArmGicArchLib}/Arm/ArmGicArchLib.c | 0 ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf | 33 ++++++++++++ ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc | 1 + ArmPlatformPkg/ArmPlatformPkg.dsc | 1 + ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc | 1 + ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 1 + ArmVirtPkg/ArmVirt.dsc.inc | 1 + 14 files changed, 76 insertions(+), 17 deletions(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index b30de9152c13..bf7278b50815 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -38,6 +38,7 @@ UncachedMemoryAllocationLib|Include/Library/UncachedMemoryAllocationLib.h DefaultExceptionHandlerLib|Include/Library/DefaultExceptionHandlerLib.h ArmDisassemblerLib|Include/Library/ArmDisassemblerLib.h + ArmGicArchLib|Include/Library/ArmGicArchLib.h [Guids.common] gArmTokenSpaceGuid = { 0xBB11ECFE, 0x820F, 0x4968, { 0xBB, 0xA6, 0xF7, 0x6A, 0xFE, 0x30, 0x25, 0x96 } } diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc index 6959fde22c12..36eb394a2e37 100644 --- a/ArmPkg/ArmPkg.dsc +++ b/ArmPkg/ArmPkg.dsc @@ -66,6 +66,7 @@ CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf index 2ae3fd31e892..047adac85ff4 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf @@ -27,18 +27,17 @@ GicV2/ArmGicV2NonSecLib.c [Sources.ARM] - Arm/ArmGicArchLib.c GicV3/Arm/ArmGicV3.S | GCC GicV3/Arm/ArmGicV3.asm | RVCT [Sources.AARCH64] - AArch64/ArmGicArchLib.c GicV3/AArch64/ArmGicV3.S [LibraryClasses] ArmLib DebugLib IoLib + ArmGicArchLib [Packages] ArmPkg/ArmPkg.dec diff --git a/ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf b/ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf index 7d4e49e4b96f..fc2e1bc01efe 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf +++ b/ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf @@ -27,12 +27,10 @@ GicV2/ArmGicV2SecLib.c [Sources.ARM] - Arm/ArmGicArchLib.c GicV3/Arm/ArmGicV3.S | GCC GicV3/Arm/ArmGicV3.asm | RVCT [Sources.AARCH64] - AArch64/ArmGicArchLib.c GicV3/AArch64/ArmGicV3.S [Packages] @@ -45,6 +43,7 @@ ArmLib DebugLib IoLib + ArmGicArchLib [Pcd] gArmPlatformTokenSpaceGuid.PcdCoreCount diff --git a/ArmPkg/Include/Library/ArmGicArchLib.h b/ArmPkg/Include/Library/ArmGicArchLib.h new file mode 100644 index 000000000000..e6964a2d5790 --- /dev/null +++ b/ArmPkg/Include/Library/ArmGicArchLib.h @@ -0,0 +1,33 @@ +/** @file +* +* Copyright (c) 2015, Linaro Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __ARM_GIC_ARCH_LIB_H__ +#define __ARM_GIC_ARCH_LIB_H__ + +// +// GIC definitions +// +typedef enum { + ARM_GIC_ARCH_REVISION_2, + ARM_GIC_ARCH_REVISION_3 +} ARM_GIC_ARCH_REVISION; + + +ARM_GIC_ARCH_REVISION +EFIAPI +ArmGicGetSupportedArchRevision ( + VOID + ); + +#endif diff --git a/ArmPkg/Include/Library/ArmGicLib.h b/ArmPkg/Include/Library/ArmGicLib.h index e3db9c0d250f..10c4a9d72eb2 100644 --- a/ArmPkg/Include/Library/ArmGicLib.h +++ b/ArmPkg/Include/Library/ArmGicLib.h @@ -15,13 +15,7 @@ #ifndef __ARMGIC_H #define __ARMGIC_H -// -// GIC definitions -// -typedef enum { - ARM_GIC_ARCH_REVISION_2, - ARM_GIC_ARCH_REVISION_3 -} ARM_GIC_ARCH_REVISION; +#include // // GIC Distributor @@ -103,12 +97,6 @@ typedef enum { // Bit Mask for #define ARM_GIC_ICCIAR_ACKINTID 0x3FF -ARM_GIC_ARCH_REVISION -EFIAPI -ArmGicGetSupportedArchRevision ( - VOID - ); - UINTN EFIAPI ArmGicGetInterfaceIdentification ( diff --git a/ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c b/ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c similarity index 100% rename from ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c rename to ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c diff --git a/ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c b/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c similarity index 100% rename from ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c rename to ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c diff --git a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf new file mode 100644 index 000000000000..d71b2adc3027 --- /dev/null +++ b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf @@ -0,0 +1,33 @@ +#/* @file +# Copyright (c) 2015, Linaro Ltd. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmGicArchLib + FILE_GUID = cd67f41a-26e9-4482-90c9-a9aff803382a + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmGicArchLib + +[Sources.ARM] + Arm/ArmGicArchLib.c + +[Sources.AARCH64] + AArch64/ArmGicArchLib.c + +[Packages] + MdePkg/MdePkg.dec + ArmPkg/ArmPkg.dec + +[LibraryClasses] + ArmGicLib diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc index 4cfb913b8ed3..0859bc31ff00 100644 --- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc +++ b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc @@ -78,6 +78,7 @@ ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc index f9f217cd61fd..be31025d9bd0 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dsc +++ b/ArmPlatformPkg/ArmPlatformPkg.dsc @@ -78,6 +78,7 @@ ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc index 9f5b384c85bd..19de3816ae5c 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc @@ -61,6 +61,7 @@ ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc index 00dfbec74fb1..84e2a9987f7d 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc @@ -67,6 +67,7 @@ ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index 51b1079003df..900d5c3d9dd0 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -71,6 +71,7 @@ ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf