From patchwork Thu Aug 11 10:08:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 73729 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp27418qga; Thu, 11 Aug 2016 03:09:10 -0700 (PDT) X-Received: by 10.67.3.197 with SMTP id by5mr15539102pad.119.1470910143924; Thu, 11 Aug 2016 03:09:03 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id yu2si2500954pac.273.2016.08.11.03.09.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Aug 2016 03:09:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8201F1A1E31; Thu, 11 Aug 2016 03:09:03 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EE76D1A1E31 for ; Thu, 11 Aug 2016 03:09:01 -0700 (PDT) Received: by mail-wm0-x22e.google.com with SMTP id i5so5108892wmg.0 for ; Thu, 11 Aug 2016 03:09:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xeQ7qHrynP1bfr5/IXrfRgIacT57A7imyJ0CZxfVDcA=; b=KgpbOvMku9blagiBuCxPz221XEnQ6EwuskNII/O37LojlIn+r6OrbD3Luugqz3U130 etBMellzwOXOap1DaUl4qU2Kqiz+85ygiDp7MRhzRK5NeXGQhshdUMlYWNZF0oyD7OnY MSlcI9CPL3TojIPgHmE5kmLr10rz4M6IaCDwE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xeQ7qHrynP1bfr5/IXrfRgIacT57A7imyJ0CZxfVDcA=; b=IxaFMHArui1wl9N6dzjR2WGJvxDgpISls9kCOoj8aT60PwLkppV40YhvYNXCx08U+C MNcKpFoLHWwuinyWxWp2+KLgLM8qeTiFMscNU88EDlHi+eOfrbajPEHX6Dcz7sIzXhWM wWD0CGNUdu4y24wFuMesE9iro1+8dWa3JIvUpmqZLcKijIYegcz8+uQ7ZKo4G2m+on7A IPZmaqaFwU8t2CskmUD6qsxqlV6+39sOOhjpKWQOiiawkMMqCIwiByQKbkqIzObsD4TB JDWkDQwg8ORBDs8IpAOo/8vbzW8xkACp8eq4eM8N95E4/InaoW2mdh/LhABH7G2PMikF 0+OQ== X-Gm-Message-State: AEkoouuFV+3YrBBPizm/5VEQssMKLFiZH4/AB17Ekksgx5B7XAoP+R7kE930RncMqqaaWQ7m X-Received: by 10.28.140.5 with SMTP id o5mr7798406wmd.13.1470910140280; Thu, 11 Aug 2016 03:09:00 -0700 (PDT) Received: from localhost.localdomain (46.red-81-37-107.dynamicip.rima-tde.net. [81.37.107.46]) by smtp.gmail.com with ESMTPSA id p83sm2402873wma.18.2016.08.11.03.08.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Aug 2016 03:08:59 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Thu, 11 Aug 2016 12:08:18 +0200 Message-Id: <1470910101-20322-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470910101-20322-1-git-send-email-ard.biesheuvel@linaro.org> References: <1470910101-20322-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 3/6] Platforms/Styx: remove unused AmdStyxSecLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc | 1 - Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/GicV3.S | 73 -------- Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/StyxBoot.S | 182 -------------------- Platforms/AMD/Styx/Library/AmdStyxSecLib/AmdStyxSecLib.inf | 50 ------ Platforms/AMD/Styx/Library/AmdStyxSecLib/StyxSec.c | 96 ----------- Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc | 1 - 6 files changed, 403 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc index 6b9446a1387d..01ad69708237 100644 --- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc +++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc @@ -154,7 +154,6 @@ DEFINE DO_KCS = 0 PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64LibSec.inf - ArmPlatformSecLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/AmdStyxSecLib/AmdStyxSecLib.inf ArmPlatformLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf diff --git a/Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/GicV3.S b/Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/GicV3.S deleted file mode 100644 index 617a6ff0cff0..000000000000 --- a/Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/GicV3.S +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) 2013-2014, ARM Limited. All rights reserved.
-// Copyright (c) 2014 - 2016, AMD Inc. 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. -// -//** -// Derived from: -// ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/GicV3.S -// -//** - - -#include - -// Register definitions used by GCC for GICv3 access. -// These are defined by ARMCC, so keep them in the GCC specific code for now. -#define ICC_SRE_EL2 S3_4_C12_C9_5 -#define ICC_SRE_EL3 S3_6_C12_C12_5 -#define ICC_CTLR_EL1 S3_0_C12_C12_4 -#define ICC_CTLR_EL3 S3_6_C12_C12_4 -#define ICC_PMR_EL1 S3_0_C4_C6_0 - -.text -.align 3 - -GCC_ASM_EXPORT(InitializeGicV3) - -/* Initialize GICv3 to expose it as a GICv2 as UEFI does not support GICv3 yet */ -ASM_PFX(InitializeGicV3): - // We have a GICv3. UEFI still uses the GICv2 mode. We must do enough setup - // to allow Linux to use GICv3 if it chooses. - - // In order to setup NS side we need to enable it first. - mrs x0, scr_el3 - orr x0, x0, #1 - msr scr_el3, x0 - - // Enable SRE at EL3 and ICC_SRE_EL2 access - mov x0, #((1 << 3) | (1 << 0)) // Enable | SRE - mrs x1, ICC_SRE_EL3 - orr x1, x1, x0 - msr ICC_SRE_EL3, x1 - isb - - // Enable SRE at EL2 and ICC_SRE_EL1 access.. - mrs x1, ICC_SRE_EL2 - orr x1, x1, x0 - msr ICC_SRE_EL2, x1 - isb - - // Configure CPU interface - msr ICC_CTLR_EL3, xzr - isb - msr ICC_CTLR_EL1, xzr - isb - - // The MemoryMap view and Register view may not be consistent, So Set PMR again. - mov w1, #1 << 7 // allow NS access to GICC_PMR - msr ICC_PMR_EL1, x1 - isb - - // Remove the SCR.NS bit - mrs x0, scr_el3 - bic x0, x0, #1 - msr scr_el3, x0 - ret diff --git a/Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/StyxBoot.S b/Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/StyxBoot.S deleted file mode 100644 index c9e316366eb6..000000000000 --- a/Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/StyxBoot.S +++ /dev/null @@ -1,182 +0,0 @@ -// -// Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
-// Copyright (c) 2014 - 2016, AMD Inc. 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. -// -//** -// Derived from: -// ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMBoot.S -// -//** - -#include -#include -#include -#include - -.text -.align 3 - -GCC_ASM_EXPORT(ArmPlatformSecBootAction) -GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit) -GCC_ASM_EXPORT(ArmSecMpCoreSecondariesWrite) -GCC_ASM_EXPORT(ArmSecMpCoreSecondariesRead) - -/** - Call at the beginning of the platform boot up - - This function allows the firmware platform to do extra actions at the early - stage of the platform power up. - - Note: This function must be implemented in assembler as there is no stack set up yet - -**/ -ASM_PFX(ArmPlatformSecBootAction): - /* - * Cortex-A57 Errata - */ - // Enable CPUECTLR.SMPEN for SMP - mrs x13, s3_1_c15_c2_1 // Read CPUECTLR - bfi x13, x1, #6, #1 // Set bit 6; SMPEN: Allow PE to receive IC and TLB operations broadcast from others - msr s3_1_c15_c2_1, x13 - isb - - /* - * NIC400 initialization. - * - * Setting all registers to unsecure. - */ - movz x1, #0xFFFF, LSL #16 - movk x1, #0xFFFF - - // NIC400 Bot VDD - movz x0, #0xE1B0, LSL #16 - movk x0, #0x0008 - str w1, [x0] - movk x0, #0x000C - str w1, [x0] - movk x0, #0x0010 - str w1, [x0] - movk x0, #0x0014 - str w1, [x0] - movk x0, #0x0018 - str w1, [x0] - movk x0, #0x0020 - str w1, [x0] - movk x0, #0x0024 - str w1, [x0] - movk x0, #0x0028 - str w1, [x0] - movk x0, #0x002C - str w1, [x0] - movk x0, #0x0030 - str w1, [x0] - movk x0, #0x0038 - str w1, [x0] - movk x0, #0x001C - str w1, [x0] - - // NIC400 Top VDD - movz x0, #0xE1C0, LSL #16 - movk x0, #0x0010 - str w1, [x0] - movk x0, #0x0014 - str w1, [x0] - movk x0, #0x0018 - str w1, [x0] - - // NIC400 TOP VDDN - movz x0, #0xE1D0, LSL #16 - movk x0, #0x0008 - str w1, [x0] - movk x0, #0x000C - str w1, [x0] - movk x0, #0x0010 - str w1, [x0] - movk x0, #0x0014 - str w1, [x0] - movk x0, #0x0018 - str w1, [x0] - movk x0, #0x0020 - str w1, [x0] - movk x0, #0x0024 - str w1, [x0] - movk x0, #0x002C - str w1, [x0] - movk x0, #0x0030 - str w1, [x0] - -# 0000_1111_0111_1111_0000_0001_0000_0001 (0x0F7F0101): -# |||| |||| |||| |||| |||| |||| |||| |||| -# |||| |||| |||| |||| |||| |||| |||| |||+- 0: CLIENTPD (1) -# |||| |||| |||| |||| |||| |||| |||| ||+-- 1: GFRE (0) -# |||| |||| |||| |||| |||| |||| |||| |+--- 2: GFIE (0) -# |||| |||| |||| |||| |||| |||| |||| +---- 3: Reserved (0) -# |||| |||| |||| |||| |||| |||| |||| -# |||| |||| |||| |||| |||| |||| |||+ ----- 4: GCFGFRE (0) -# |||| |||| |||| |||| |||| |||| ||+- ----- 5: GCFGFIE (0) -# |||| |||| |||| |||| |||| |||| ++-- ----- 6-7: Reserved (0) -# |||| |||| |||| |||| |||| |||| -# |||| |||| |||| |||| |||| |||| ---- ----- 8: STALLD (1) -# |||| |||| |||| |||| |||| ||+- ---- ----- 9: GSE (0) -# |||| |||| |||| |||| |||| |+-- ---- ----- 10: USFCFG (0) -# |||| |||| |||| |||| |||| +--- ---- ----- 11: VMIDPNE (0) -# |||| |||| |||| |||| |||| -# |||| |||| |||| |||| |||+ ---- ---- ----- 12: PTM (0) -# |||| |||| |||| |||| ||+- ---- ---- ----- 13: FB (0) -# |||| |||| |||| |||| ++-- ---- ---- ----- 14-15: BSU (0) -# |||| |||| |||| |||| -# |||| |||| |||| ++++ ---- ---- ---- ----- 16-19: MEMATTR (F) -# |||| |||| |||| -# |||| |||| |||+ ---- ---- ---- ---- ----- 20: MTCFG (1) -# |||| |||| ||+- ---- ---- ---- ---- ----- 21: SMCFCFG (1) -# |||| |||| ++-- ---- ---- ---- ---- ----- 22-23: SHCFG (1) -# |||| |||| -# |||| ||++ ---- ---- ---- ---- ---- ----- 24-25: RACFG (3) -# |||| ++-- ---- ---- ---- ---- ---- ----- 26-27: WACFG (3) -# |||| -# ||++ ---- ---- ---- ---- ---- ---- ----- 28-29: NSCFG (0) -# ++-- ---- ---- ---- ---- ---- ---- ----- 30-31: Reserved (0) - - // Workaround for A0, force the memory attributes - ldr x0, =0xE0200000 // SMMU_SCR0 - ldr w1, =0x0F7F0101 - str w1, [x0, #0] - - ldr x0, =0xE0200400 // SMMU_NSCR0 - ldr w1, =0x0F7F0101 - str w1, [x0, #0] - ret - -/** - Initialize the memory where the initial stacks will reside - - This memory can contain the initial stacks (Secure and Secure Monitor stacks). - In some platform, this region is already initialized and the implementation of this function can - do nothing. This memory can also represent the Secure RAM. - This function is called before the satck has been set up. Its implementation must ensure the stack - pointer is not used (probably required to use assembly language) - -**/ -ASM_PFX(ArmPlatformSecBootMemoryInit): - // The SMC does not need to be initialized for RTSM - ret - -/* Write the flag register used to start Secondary cores */ -ASM_PFX(ArmSecMpCoreSecondariesWrite): - // Write to the CPU Mailbox - ret - -/* Read the flag register used to start Secondary cores */ -ASM_PFX(ArmSecMpCoreSecondariesRead): - // Return the value from the CPU Mailbox - mov x0, #0 - ret - diff --git a/Platforms/AMD/Styx/Library/AmdStyxSecLib/AmdStyxSecLib.inf b/Platforms/AMD/Styx/Library/AmdStyxSecLib/AmdStyxSecLib.inf deleted file mode 100644 index 9f0823746378..000000000000 --- a/Platforms/AMD/Styx/Library/AmdStyxSecLib/AmdStyxSecLib.inf +++ /dev/null @@ -1,50 +0,0 @@ -#/* @file -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-# Copyright (c) 2014 - 2016, AMD Inc. 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. -# -#*/ -#/** -# Derived from: -# ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = AmdStyxSecLib - FILE_GUID = af95afa9-fc3f-47b4-9237-d024305cd2e2 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmPlatformSecLib - -[Packages] - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - -[LibraryClasses] - IoLib - ArmLib - SerialPortLib - -[Sources.common] - StyxSec.c - -[Sources.AARCH64] - AArch64/StyxBoot.S | GCC - AArch64/GicV3.S | GCC - -[FixedPcd] - gArmTokenSpaceGuid.PcdFvBaseAddress - gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase diff --git a/Platforms/AMD/Styx/Library/AmdStyxSecLib/StyxSec.c b/Platforms/AMD/Styx/Library/AmdStyxSecLib/StyxSec.c deleted file mode 100644 index e5ff4ed3a87e..000000000000 --- a/Platforms/AMD/Styx/Library/AmdStyxSecLib/StyxSec.c +++ /dev/null @@ -1,96 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-* Copyright (c) 2014 - 2016, AMD Inc. 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. -* -**/ -/** - Derived from: - ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c - -**/ - -#include -#include -#include -#include -#include - -#include -#include - - -// Initialize GICv3 to expose it as a GICv2 as UEFI does not support GICv3 yet -VOID -InitializeGicV3 ( - VOID - ); - -/** - Initialize the Secure peripherals and memory regions - - If Trustzone is supported by your platform then this function makes the required initialization - of the secure peripherals and memory regions. - -**/ -VOID -ArmPlatformSecTrustzoneInit ( - IN UINTN MpId - ) -{ - // No TZPC or TZASC on RTSM to initialize -} - -/** - Initialize controllers that must setup at the early stage - - Some peripherals must be initialized in Secure World. - For example, some L2x0 requires to be initialized in Secure World - -**/ -RETURN_STATUS -ArmPlatformSecInitialize ( - IN UINTN MpId - ) -{ - UINT32 Identification; - - // If it is not the primary core then there is nothing to do - if (!ArmPlatformIsPrimaryCore (MpId)) { - return RETURN_SUCCESS; - } - - // Read the GIC Identification Register - Identification = MmioRead32 (FixedPcdGet64(PcdGicInterruptInterfaceBase) + ARM_GIC_ICCIIDR); - - // Check if we are GICv3 - if (ARM_GIC_ICCIIDR_GET_ARCH_VERSION(Identification) >= 0x3) { - InitializeGicV3 (); - } - - return RETURN_SUCCESS; -} - -/** - Call before jumping to Normal World - - This function allows the firmware platform to do extra actions before - jumping to the Normal World - -**/ -VOID -ArmPlatformSecExtraAction ( - IN UINTN MpId, - OUT UINTN* JumpAddress - ) -{ - *JumpAddress = PcdGet64(PcdFvBaseAddress); -} diff --git a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc index 0f8dd814ad15..81409b8f37ef 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc +++ b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc @@ -161,7 +161,6 @@ DEFINE DO_KCS = 1 PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64LibSec.inf - ArmPlatformSecLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/AmdStyxSecLib/AmdStyxSecLib.inf ArmPlatformLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf