From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.web08.10540.1608300982939752976 for ; Fri, 18 Dec 2020 06:16:23 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=lJcKeJtw; spf=pass (domain: nuviainc.com, ip: 209.85.128.52, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f52.google.com with SMTP id 3so2729628wmg.4 for ; Fri, 18 Dec 2020 06:16:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lr5QNyep8mxk01Pu2THMEEXS8M7MlGWZkb6Kl+aKzFo=; b=lJcKeJtwNYLFwUS6SOlfvmakdIHwRoN80p4CcYabF1MHu2vEquydAyxjbPe6I2UTgB IbmE4NY5Kw833L7pFf5xRY1oCNI8db6Oo+c+bOVvRcX26dc2DyNXIMQILbhpU1gV3280 uUwZmlHsYSvB0gnvzNHPj3UlidnIxphtpqo4SrY9IA3kaexvkGhx0vRStQSIFKL0UFrM hPNfdbjvh5DyEDqSutbnUMwOI33y70MKqRc/bJwZpcmkvy74XFazbCKhlXoXdiH5G5Fz iq2CHzP6K2aYAKYEPQr6X3Y6HsGHBKyo13M27VIOKllPZBY5dJyWKgxjhPpoQQg2C3Nz EY5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lr5QNyep8mxk01Pu2THMEEXS8M7MlGWZkb6Kl+aKzFo=; b=c9dzqLGnmQ+1aZLrWENXyFeOLpLM0dS87ZU15aRE5aUUrEh9ypqYlJ5flweK53a0vT DGyHA+bEtu7KkUY+6aHpv8itc8jvWC2YBbi8I5yFV9xm7DciNpPPHTvMpxaKTIDNOjd4 eutj+8edvPEtKi16EwRujF0xVO7yvdplT0aQ3iP2LnQqJM/F/t8VY26dSsNXeLQfug3D nbHuXjVduuSQwgANIElgrixc2YYCPeaO8/9ipJVeTT9OEqk3ebpNXl76z44HsHPUJqMu H0MJUUy5ZyG5gYduu2uS9QKZjthxrELNdCvZ0gjlHpgD80tzXk5dzvcYfDQ7thTKj0wP 8WQw== X-Gm-Message-State: AOAM53022Su6ufir8eeioA2YtWigwTqk1/BcL8gCYeVxFCWImmI8vLZv eSRatV9cEVKWbgpj7XDeKVOoJkAZ4chTqvlnPG9RLVyozE/dsDnXbaxZ6oaojRG4bFOU1n3T6rn wa9AHtqaNR6ssZLSkP4xS18LMjCB3agHkrjvJYufZZl6oayZzIIdi2j7rH5p/Uu0cww== X-Google-Smtp-Source: ABdhPJyLXsQbByPpWmPq5q8r+iQQ3lgzNZy/z3yw+1YPHU7f+ECNxuyiffrE0U2rzhc5TGxTXs1zNQ== X-Received: by 2002:a1c:6208:: with SMTP id w8mr4472557wmb.96.1608300981244; Fri, 18 Dec 2020 06:16:21 -0800 (PST) Return-Path: Received: from vanye.hemma.eciton.net (cpc1-cmbg19-2-0-cust915.5-4.cable.virginm.net. [82.27.183.148]) by smtp.gmail.com with ESMTPSA id b12sm18558569wmj.2.2020.12.18.06.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 06:16:20 -0800 (PST) From: "Leif Lindholm" To: devel@edk2.groups.io Cc: Ard Biesheuvel Subject: [PATCH 3/9] ArmPkg: remove duplicated ARM/AArch64 ArmGicArchLib sources Date: Fri, 18 Dec 2020 14:16:11 +0000 Message-Id: <20201218141617.26947-4-leif@nuviainc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218141617.26947-1-leif@nuviainc.com> References: <20201218141617.26947-1-leif@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The ID register access was the only difference between them, so after switching to the ArmHasGicSystemRegisters () helper, there is no longer any need to have separate ARM/AArch64 source files for ArmGicArchLib, so unify them and drop the subdirectories. Cc: Ard Biesheuvel Signed-off-by: Leif Lindholm --- ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf | 7 +-- ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c | 60 -------------------- ArmPkg/Library/ArmGicArchLib/{AArch64 => }/ArmGicArchLib.c | 0 3 files changed, 2 insertions(+), 65 deletions(-) diff --git a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf index 92ac11c2f5e5..bedddff93955 100644 --- a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf +++ b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf @@ -14,11 +14,8 @@ [Defines] LIBRARY_CLASS = ArmGicArchLib|DXE_DRIVER UEFI_DRIVER UEFI_APPLICATION CONSTRUCTOR = ArmGicArchLibInitialize -[Sources.ARM] - Arm/ArmGicArchLib.c - -[Sources.AARCH64] - AArch64/ArmGicArchLib.c +[Sources] + ArmGicArchLib.c [Packages] MdePkg/MdePkg.dec diff --git a/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c b/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c deleted file mode 100644 index 7e7e46e69faa..000000000000 --- a/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c +++ /dev/null @@ -1,60 +0,0 @@ -/** @file -* -* Copyright (c) 2014, ARM Limited. All rights reserved. -* -* SPDX-License-Identifier: BSD-2-Clause-Patent -* -**/ - -#include -#include - -STATIC ARM_GIC_ARCH_REVISION mGicArchRevision; - -RETURN_STATUS -EFIAPI -ArmGicArchLibInitialize ( - VOID - ) -{ - UINT32 IccSre; - - // Ideally we would like to use the GICC IIDR Architecture version here, but - // this does not seem to be very reliable as the implementation could easily - // get it wrong. It is more reliable to check if the GICv3 System Register - // feature is implemented on the CPU. This is also convenient as our GICv3 - // driver requires SRE. If only Memory mapped access is available we try to - // drive the GIC as a v2. - if (ArmHasGicSystemRegisters ()) { - // Make sure System Register access is enabled (SRE). This depends on the - // higher privilege level giving us permission, otherwise we will either - // cause an exception here, or the write doesn't stick in which case we need - // to fall back to the GICv2 MMIO interface. - // Note: We do not need to set ICC_SRE_EL2.Enable because the OS is started - // at the same exception level. - // It is the OS responsibility to set this bit. - IccSre = ArmGicV3GetControlSystemRegisterEnable (); - if (!(IccSre & ICC_SRE_EL2_SRE)) { - ArmGicV3SetControlSystemRegisterEnable (IccSre| ICC_SRE_EL2_SRE); - IccSre = ArmGicV3GetControlSystemRegisterEnable (); - } - if (IccSre & ICC_SRE_EL2_SRE) { - mGicArchRevision = ARM_GIC_ARCH_REVISION_3; - goto Done; - } - } - - mGicArchRevision = ARM_GIC_ARCH_REVISION_2; - -Done: - return RETURN_SUCCESS; -} - -ARM_GIC_ARCH_REVISION -EFIAPI -ArmGicGetSupportedArchRevision ( - VOID - ) -{ - return mGicArchRevision; -} diff --git a/ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.c similarity index 100% rename from ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c rename to ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.c -- 2.20.1