public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well
@ 2016-08-11 10:08 Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 1/6] Platforms/BeagleBoard: remove unreferenced Sec.inf module Ard Biesheuvel
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2016-08-11 10:08 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

This moves the asm files in OpenPlatformPkg to the new ASM_FUNC() macro,
which annotates functions in a way that allows the linker to drop code
that is not actually used anywhere. It is analogous to -ffunction-sections
for GCC.

Since there are some cargo culted asm patterns that are very clunky and
inefficient, clean those up as well (i.e., LoadConstantToReg())

Ard Biesheuvel (6):
  Platforms/BeagleBoard: remove unreferenced Sec.inf module
  Platforms/BeagleBoard/BeagleBoardLib: switch to ASM_FUNC() asm macro
  Platforms/Styx: remove unused AmdStyxSecLib
  Platforms/Styx: switch to ASM_FUNC() asm macro
  Platforms/Hisilicon/ArmPlatformLibPv660: switch to ASM_FUNC() asm
    macro
  Platforms/Marvell/Armada70x0Lib: switch to ASM_FUNC() asm macro

 Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S                      |  44 +--
 Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc                                      |   1 -
 Platforms/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S                            |  58 ++--
 Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf                              |   7 +-
 Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf                           |   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 -
 Platforms/Marvell/Armada/Library/Armada70x0Lib/AArch64/ArmPlatformHelper.S        |  32 +--
 Platforms/TexasInstruments/BeagleBoard/Library/BeagleBoardLib/BeagleBoardHelper.S |  16 +-
 Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.S                 |  85 ------
 Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.asm               |  89 ------
 Platforms/TexasInstruments/BeagleBoard/Sec/Cache.c                                |  80 ------
 Platforms/TexasInstruments/BeagleBoard/Sec/Clock.c                                |  70 -----
 Platforms/TexasInstruments/BeagleBoard/Sec/LzmaDecompress.h                       | 103 -------
 Platforms/TexasInstruments/BeagleBoard/Sec/PadConfiguration.c                     | 282 --------------------
 Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c                                  | 186 -------------
 Platforms/TexasInstruments/BeagleBoard/Sec/Sec.inf                                |  74 -----
 20 files changed, 42 insertions(+), 1488 deletions(-)
 delete mode 100644 Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/GicV3.S
 delete mode 100644 Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/StyxBoot.S
 delete mode 100644 Platforms/AMD/Styx/Library/AmdStyxSecLib/AmdStyxSecLib.inf
 delete mode 100644 Platforms/AMD/Styx/Library/AmdStyxSecLib/StyxSec.c
 delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.S
 delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.asm
 delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Cache.c
 delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Clock.c
 delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/LzmaDecompress.h
 delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/PadConfiguration.c
 delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c
 delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Sec.inf

-- 
2.7.4



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/6] Platforms/BeagleBoard: remove unreferenced Sec.inf module
  2016-08-11 10:08 [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Ard Biesheuvel
@ 2016-08-11 10:08 ` Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 2/6] Platforms/BeagleBoard/BeagleBoardLib: switch to ASM_FUNC() asm macro Ard Biesheuvel
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2016-08-11 10:08 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.S   |  85 ------
 Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.asm |  89 ------
 Platforms/TexasInstruments/BeagleBoard/Sec/Cache.c                  |  80 ------
 Platforms/TexasInstruments/BeagleBoard/Sec/Clock.c                  |  70 -----
 Platforms/TexasInstruments/BeagleBoard/Sec/LzmaDecompress.h         | 103 -------
 Platforms/TexasInstruments/BeagleBoard/Sec/PadConfiguration.c       | 282 --------------------
 Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c                    | 186 -------------
 Platforms/TexasInstruments/BeagleBoard/Sec/Sec.inf                  |  74 -----
 8 files changed, 969 deletions(-)

diff --git a/Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.S b/Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.S
deleted file mode 100644
index b656c1e040c5..000000000000
--- a/Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.S
+++ /dev/null
@@ -1,85 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-#
-# 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.
-#
-#------------------------------------------------------------------------------
-
-#include <AsmMacroIoLib.h>
-#include <Library/PcdLib.h>
-
-.text
-.align 3
-
-.globl ASM_PFX(CEntryPoint)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-
-ASM_PFX(_ModuleEntryPoint):
-
-  //Disable L2 cache
-  mrc     p15, 0, r0, c1, c0, 1   // read Auxiliary Control Register
-  bic     r0, r0, #0x00000002     // disable L2 cache
-  mcr     p15, 0, r0, c1, c0, 1   // store Auxiliary Control Register
-
-  //Enable Strict alignment checking & Instruction cache
-  mrc     p15, 0, r0, c1, c0, 0
-  bic     r0, r0, #0x00002300     /* clear bits 13, 9:8 (--V- --RS) */
-  bic     r0, r0, #0x00000005     /* clear bits 0, 2 (---- -C-M) */
-  orr     r0, r0, #0x00000002     /* set bit 1 (A) Align */
-  orr     r0, r0, #0x00001000     /* set bit 12 (I) enable I-Cache */
-  mcr     p15, 0, r0, c1, c0, 0
-
-  // Enable NEON register in case folks want to use them for optimizations (CopyMem)
-  mrc     p15, 0, r0, c1, c0, 2
-  orr     r0, r0, #0x00f00000   // Enable VPF access (V* instructions)
-  mcr     p15, 0, r0, c1, c0, 2
-  mov     r0, #0x40000000       // Set EN bit in FPEXC
-  mcr     p10,#0x7,r0,c8,c0,#0  // msr     FPEXC,r0 in ARM assembly
-
-
-  // Set CPU vectors to start of DRAM
-  LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base
-  mcr     p15, 0, r0, c12, c0, 0
-  isb                               // Sync changes to control registers
-
-  // Fill vector table with branchs to current pc (jmp $)
-  ldr     r1, ShouldNeverGetHere
-  movs    r2, #0
-FillVectors:
-  str     r1, [r0, r2]
-  adds    r2, r2, #4
-  cmp     r2, #32
-  bne     FillVectors
-
-  /* before we call C code, lets setup the stack pointer in internal RAM */
-stack_pointer_setup:
-
-  //
-  // Set stack based on PCD values. Need to do it this way to make C code work
-  // when it runs from FLASH.
-  //
-  LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2)    /* stack base arg2  */
-  LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3)    /* stack size arg3  */
-  add     r4, r2, r3
-
-  //Enter SVC mode and set up SVC stack pointer
-  mov     r0,#0x13|0x80|0x40
-  msr     CPSR_c,r0
-  mov     r13,r4
-
-  // Call C entry point
-  LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1)    /* memory size arg1          */
-  LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0)    /* memory size arg0         */
-  blx      ASM_PFX(CEntryPoint) /* Assume C code is thumb    */
-
-ShouldNeverGetHere:
-  /* _CEntryPoint should never return */
-  b       ShouldNeverGetHere
-
diff --git a/Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.asm b/Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.asm
deleted file mode 100644
index 63174d4b8437..000000000000
--- a/Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.asm
+++ /dev/null
@@ -1,89 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-//
-// 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.
-//
-//------------------------------------------------------------------------------
-
-#include <AsmMacroIoLib.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-  INCLUDE AsmMacroIoLib.inc
-
-  IMPORT  CEntryPoint
-  EXPORT  _ModuleEntryPoint
-
-  PRESERVE8
-  AREA    ModuleEntryPoint, CODE, READONLY
-
-
-_ModuleEntryPoint
-
-  //Disable L2 cache
-  mrc     p15, 0, r0, c1, c0, 1   // read Auxiliary Control Register
-  bic     r0, r0, #0x00000002     // disable L2 cache
-  mcr     p15, 0, r0, c1, c0, 1   // store Auxiliary Control Register
-
-  //Enable Strict alignment checking & Instruction cache
-  mrc     p15, 0, r0, c1, c0, 0
-  bic     r0, r0, #0x00002300     /* clear bits 13, 9:8 (--V- --RS) */
-  bic     r0, r0, #0x00000005     /* clear bits 0, 2 (---- -C-M) */
-  orr     r0, r0, #0x00000002     /* set bit 1 (A) Align */
-  orr     r0, r0, #0x00001000     /* set bit 12 (I) enable I-Cache */
-  mcr     p15, 0, r0, c1, c0, 0
-
-  // Enable NEON register in case folks want to use them for optimizations (CopyMem)
-  mrc     p15, 0, r0, c1, c0, 2
-  orr     r0, r0, #0x00f00000   // Enable VPF access (V* instructions)
-  mcr     p15, 0, r0, c1, c0, 2
-  mov     r0, #0x40000000       // Set EN bit in FPEXC
-  msr     FPEXC,r0
-
-  // Set CPU vectors to start of DRAM
-  LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base
-  mcr     p15, 0, r0, c12, c0, 0
-  isb                               // Sync changes to control registers
-
-  // Fill vector table with branchs to current pc (jmp $)
-  ldr     r1, ShouldNeverGetHere
-  movs    r2, #0
-FillVectors
-  str     r1, [r0, r2]
-  adds    r2, r2, #4
-  cmp     r2, #32
-  bne     FillVectors
-
-  /* before we call C code, lets setup the stack pointer in internal RAM */
-stack_pointer_setup
-
-  //
-  // Set stack based on PCD values. Need to do it this way to make C code work
-  // when it runs from FLASH.
-  //
-  LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2)    // stack base arg2
-  LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3)    // stack size arg3
-  add     r4, r2, r3
-
-  //Enter SVC mode and set up SVC stack pointer
-  mov     r5,#0x13|0x80|0x40
-  msr     CPSR_c,r5
-  mov     r13,r4
-
-  // Call C entry point
-  LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1)    // memory size arg1
-  LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0)    // memory start arg0
-  blx     CEntryPoint                                     // Assume C code is thumb
-
-ShouldNeverGetHere
-  /* _CEntryPoint should never return */
-  b       ShouldNeverGetHere
-
-  END
-
diff --git a/Platforms/TexasInstruments/BeagleBoard/Sec/Cache.c b/Platforms/TexasInstruments/BeagleBoard/Sec/Cache.c
deleted file mode 100644
index 155043e5dd01..000000000000
--- a/Platforms/TexasInstruments/BeagleBoard/Sec/Cache.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
-  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.
-
-**/
-
-#include <PiPei.h>
-
-#include <Library/ArmLib.h>
-#include <Library/ArmMmuLib.h>
-#include <Library/PrePiLib.h>
-#include <Library/PcdLib.h>
-
-// DDR attributes
-#define DDR_ATTRIBUTES_CACHED                ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-#define DDR_ATTRIBUTES_UNCACHED              ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
-
-// SoC registers. L3 interconnects
-#define SOC_REGISTERS_L3_PHYSICAL_BASE       0x68000000
-#define SOC_REGISTERS_L3_PHYSICAL_LENGTH     0x08000000
-#define SOC_REGISTERS_L3_ATTRIBUTES          ARM_MEMORY_REGION_ATTRIBUTE_DEVICE
-
-// SoC registers. L4 interconnects
-#define SOC_REGISTERS_L4_PHYSICAL_BASE       0x48000000
-#define SOC_REGISTERS_L4_PHYSICAL_LENGTH     0x08000000
-#define SOC_REGISTERS_L4_ATTRIBUTES          ARM_MEMORY_REGION_ATTRIBUTE_DEVICE
-
-VOID
-InitCache (
-  IN  UINT32  MemoryBase,
-  IN  UINT32  MemoryLength
-  )
-{
-  UINT32                        CacheAttributes;
-  ARM_MEMORY_REGION_DESCRIPTOR  MemoryTable[5];
-  VOID                          *TranslationTableBase;
-  UINTN                         TranslationTableSize;
-
-  if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
-    CacheAttributes = DDR_ATTRIBUTES_CACHED;
-  } else {
-    CacheAttributes = DDR_ATTRIBUTES_UNCACHED;
-  }
-
-  // DDR
-  MemoryTable[0].PhysicalBase = MemoryBase;
-  MemoryTable[0].VirtualBase  = MemoryBase;
-  MemoryTable[0].Length       = MemoryLength;
-  MemoryTable[0].Attributes   = (ARM_MEMORY_REGION_ATTRIBUTES)CacheAttributes;
-
-  // SOC Registers. L3 interconnects
-  MemoryTable[1].PhysicalBase = SOC_REGISTERS_L3_PHYSICAL_BASE;
-  MemoryTable[1].VirtualBase  = SOC_REGISTERS_L3_PHYSICAL_BASE;
-  MemoryTable[1].Length       = SOC_REGISTERS_L3_PHYSICAL_LENGTH;
-  MemoryTable[1].Attributes   = SOC_REGISTERS_L3_ATTRIBUTES;
-
-  // SOC Registers. L4 interconnects
-  MemoryTable[2].PhysicalBase = SOC_REGISTERS_L4_PHYSICAL_BASE;
-  MemoryTable[2].VirtualBase  = SOC_REGISTERS_L4_PHYSICAL_BASE;
-  MemoryTable[2].Length       = SOC_REGISTERS_L4_PHYSICAL_LENGTH;
-  MemoryTable[2].Attributes   = SOC_REGISTERS_L4_ATTRIBUTES;
-
-  // End of Table
-  MemoryTable[3].PhysicalBase = 0;
-  MemoryTable[3].VirtualBase  = 0;
-  MemoryTable[3].Length       = 0;
-  MemoryTable[3].Attributes   = (ARM_MEMORY_REGION_ATTRIBUTES)0;
-
-  ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize);
-
-  BuildMemoryAllocationHob((EFI_PHYSICAL_ADDRESS)(UINTN)TranslationTableBase, TranslationTableSize, EfiBootServicesData);
-}
diff --git a/Platforms/TexasInstruments/BeagleBoard/Sec/Clock.c b/Platforms/TexasInstruments/BeagleBoard/Sec/Clock.c
deleted file mode 100644
index 24fdc71c420f..000000000000
--- a/Platforms/TexasInstruments/BeagleBoard/Sec/Clock.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/** @file
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
-  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.
-
-**/
-
-#include <Library/IoLib.h>
-#include <Library/DebugLib.h>
-
-#include <Omap3530/Omap3530.h>
-
-VOID
-ClockInit (
-  VOID
-  )
-{
-  //DPLL1 - DPLL4 are configured part of Configuration header which OMAP3 ROM parses.
-
-  // Enable PLL5 and set to 120 MHz as a reference clock.
-  MmioWrite32 (CM_CLKSEL4_PLL, CM_CLKSEL_PLL_MULT(120) | CM_CLKSEL_PLL_DIV(13));
-  MmioWrite32 (CM_CLKSEL5_PLL, CM_CLKSEL_DIV_120M(1));
-  MmioWrite32 (CM_CLKEN2_PLL, CM_CLKEN_FREQSEL_075_100 | CM_CLKEN_ENABLE);
-
-  // Turn on functional & interface clocks to the USBHOST power domain
-  MmioOr32(CM_FCLKEN_USBHOST, CM_FCLKEN_USBHOST_EN_USBHOST2_ENABLE
-                              | CM_FCLKEN_USBHOST_EN_USBHOST1_ENABLE);
-  MmioOr32(CM_ICLKEN_USBHOST, CM_ICLKEN_USBHOST_EN_USBHOST_ENABLE);
-
-  // Turn on functional & interface clocks to the USBTLL block.
-  MmioOr32(CM_FCLKEN3_CORE, CM_FCLKEN3_CORE_EN_USBTLL_ENABLE);
-  MmioOr32(CM_ICLKEN3_CORE, CM_ICLKEN3_CORE_EN_USBTLL_ENABLE);
-
-  // Turn on functional & interface clocks to MMC1 and I2C1 modules.
-  MmioOr32(CM_FCLKEN1_CORE, CM_FCLKEN1_CORE_EN_MMC1_ENABLE
-                            | CM_FCLKEN1_CORE_EN_I2C1_ENABLE);
-  MmioOr32(CM_ICLKEN1_CORE, CM_ICLKEN1_CORE_EN_MMC1_ENABLE
-                            | CM_ICLKEN1_CORE_EN_I2C1_ENABLE);
-
-  // Turn on functional & interface clocks to various Peripherals.
-  MmioOr32(CM_FCLKEN_PER, CM_FCLKEN_PER_EN_UART3_ENABLE
-                          | CM_FCLKEN_PER_EN_GPT3_ENABLE
-                          | CM_FCLKEN_PER_EN_GPT4_ENABLE
-                          | CM_FCLKEN_PER_EN_GPIO2_ENABLE
-                          | CM_FCLKEN_PER_EN_GPIO3_ENABLE
-                          | CM_FCLKEN_PER_EN_GPIO4_ENABLE
-                          | CM_FCLKEN_PER_EN_GPIO5_ENABLE
-                          | CM_FCLKEN_PER_EN_GPIO6_ENABLE);
-  MmioOr32(CM_ICLKEN_PER, CM_ICLKEN_PER_EN_UART3_ENABLE
-                          | CM_ICLKEN_PER_EN_GPT3_ENABLE
-                          | CM_ICLKEN_PER_EN_GPT4_ENABLE
-                          | CM_ICLKEN_PER_EN_GPIO2_ENABLE
-                          | CM_ICLKEN_PER_EN_GPIO3_ENABLE
-                          | CM_ICLKEN_PER_EN_GPIO4_ENABLE
-                          | CM_ICLKEN_PER_EN_GPIO5_ENABLE
-                          | CM_ICLKEN_PER_EN_GPIO6_ENABLE);
-
-  // Turn on functional & inteface clocks to various wakeup modules.
-  MmioOr32(CM_FCLKEN_WKUP, CM_FCLKEN_WKUP_EN_GPIO1_ENABLE
-                           | CM_FCLKEN_WKUP_EN_WDT2_ENABLE);
-  MmioOr32(CM_ICLKEN_WKUP, CM_ICLKEN_WKUP_EN_GPIO1_ENABLE
-                           | CM_ICLKEN_WKUP_EN_WDT2_ENABLE);
-}
diff --git a/Platforms/TexasInstruments/BeagleBoard/Sec/LzmaDecompress.h b/Platforms/TexasInstruments/BeagleBoard/Sec/LzmaDecompress.h
deleted file mode 100644
index a79ff343d231..000000000000
--- a/Platforms/TexasInstruments/BeagleBoard/Sec/LzmaDecompress.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
-  LZMA Decompress Library header file
-
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-  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 __LZMA_DECOMPRESS_H___
-#define __LZMA_DECOMPRESS_H___
-
-/**
-  Examines a GUIDed section and returns the size of the decoded buffer and the
-  size of an scratch buffer required to actually decode the data in a GUIDed section.
-
-  Examines a GUIDed section specified by InputSection.
-  If GUID for InputSection does not match the GUID that this handler supports,
-  then RETURN_UNSUPPORTED is returned.
-  If the required information can not be retrieved from InputSection,
-  then RETURN_INVALID_PARAMETER is returned.
-  If the GUID of InputSection does match the GUID that this handler supports,
-  then the size required to hold the decoded buffer is returned in OututBufferSize,
-  the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field
-  from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute.
-
-  If InputSection is NULL, then ASSERT().
-  If OutputBufferSize is NULL, then ASSERT().
-  If ScratchBufferSize is NULL, then ASSERT().
-  If SectionAttribute is NULL, then ASSERT().
-
-
-  @param[in]  InputSection       A pointer to a GUIDed section of an FFS formatted file.
-  @param[out] OutputBufferSize   A pointer to the size, in bytes, of an output buffer required
-                                 if the buffer specified by InputSection were decoded.
-  @param[out] ScratchBufferSize  A pointer to the size, in bytes, required as scratch space
-                                 if the buffer specified by InputSection were decoded.
-  @param[out] SectionAttribute   A pointer to the attributes of the GUIDed section. See the Attributes
-                                 field of EFI_GUID_DEFINED_SECTION in the PI Specification.
-
-  @retval  RETURN_SUCCESS            The information about InputSection was returned.
-  @retval  RETURN_UNSUPPORTED        The section specified by InputSection does not match the GUID this handler supports.
-  @retval  RETURN_INVALID_PARAMETER  The information can not be retrieved from the section specified by InputSection.
-
-**/
-RETURN_STATUS
-EFIAPI
-LzmaGuidedSectionGetInfo (
-  IN  CONST VOID  *InputSection,
-  OUT UINT32      *OutputBufferSize,
-  OUT UINT32      *ScratchBufferSize,
-  OUT UINT16      *SectionAttribute
-  );
-
-/**
-  Decompress a LZAM compressed GUIDed section into a caller allocated output buffer.
-
-  Decodes the GUIDed section specified by InputSection.
-  If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned.
-  If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned.
-  If the GUID of InputSection does match the GUID that this handler supports, then InputSection
-  is decoded into the buffer specified by OutputBuffer and the authentication status of this
-  decode operation is returned in AuthenticationStatus.  If the decoded buffer is identical to the
-  data in InputSection, then OutputBuffer is set to point at the data in InputSection.  Otherwise,
-  the decoded data will be placed in caller allocated buffer specified by OutputBuffer.
-
-  If InputSection is NULL, then ASSERT().
-  If OutputBuffer is NULL, then ASSERT().
-  If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().
-  If AuthenticationStatus is NULL, then ASSERT().
-
-
-  @param[in]  InputSection  A pointer to a GUIDed section of an FFS formatted file.
-  @param[out] OutputBuffer  A pointer to a buffer that contains the result of a decode operation.
-  @param[out] ScratchBuffer A caller allocated buffer that may be required by this function
-                            as a scratch buffer to perform the decode operation.
-  @param[out] AuthenticationStatus
-                            A pointer to the authentication status of the decoded output buffer.
-                            See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI
-                            section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must
-                            never be set by this handler.
-
-  @retval  RETURN_SUCCESS            The buffer specified by InputSection was decoded.
-  @retval  RETURN_UNSUPPORTED        The section specified by InputSection does not match the GUID this handler supports.
-  @retval  RETURN_INVALID_PARAMETER  The section specified by InputSection can not be decoded.
-
-**/
-RETURN_STATUS
-EFIAPI
-LzmaGuidedSectionExtraction (
-  IN CONST  VOID    *InputSection,
-  OUT       VOID    **OutputBuffer,
-  OUT       VOID    *ScratchBuffer,        OPTIONAL
-  OUT       UINT32  *AuthenticationStatus
-  );
-
-#endif // __LZMADECOMPRESS_H__
-
diff --git a/Platforms/TexasInstruments/BeagleBoard/Sec/PadConfiguration.c b/Platforms/TexasInstruments/BeagleBoard/Sec/PadConfiguration.c
deleted file mode 100644
index 2dace3bf38b4..000000000000
--- a/Platforms/TexasInstruments/BeagleBoard/Sec/PadConfiguration.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/** @file
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
-  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.
-
-**/
-
-#include <PiPei.h>
-#include <Library/IoLib.h>
-#include <Library/DebugLib.h>
-#include <Omap3530/Omap3530.h>
-
-#define NUM_PINS 238
-
-PAD_CONFIGURATION PadConfigurationTable[NUM_PINS] = {
-  //Pin,           MuxMode,    PullConfig,                      InputEnable
-  { SDRC_D0,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D1,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D2,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D3,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D4,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D5,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D6,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D7,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D8,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D9,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D10,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D11,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D12,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D13,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D14,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D15,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D16,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D17,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D18,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D19,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D20,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D21,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D22,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D23,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D24,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D25,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D26,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D27,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D28,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D29,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D30,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_D31,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_CLK,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_DQS0,     MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_CKE0,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { SDRC_CKE1,     MUXMODE7,   PULL_DISABLED,                INPUT  },
-  { SDRC_DQS1,     MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_DQS2,     MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { SDRC_DQS3,     MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_A1,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A2,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A3,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A4,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A5,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A6,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A7,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A8,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A9,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_A10,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_D0,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D1,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D2,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D3,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D4,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D5,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D6,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D7,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D8,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D9,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D10,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D11,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D12,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D13,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D14,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_D15,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_NCS0,     MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_NCS1,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
-  { GPMC_NCS2,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
-  { GPMC_NCS3,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
-  { GPMC_NCS4,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
-  { GPMC_NCS5,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_NCS6,     MUXMODE1,   PULL_DISABLED,                INPUT  },
-  { GPMC_NCS7,     MUXMODE1,   PULL_UP_SELECTED,             INPUT  },
-  { GPMC_CLK,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_NADV_ALE, MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_NOE,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_NWE,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_NBE0_CLE, MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { GPMC_NBE1,     MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_NWP,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { GPMC_WAIT0,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { GPMC_WAIT1,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { GPMC_WAIT2,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { GPMC_WAIT3,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { DSS_PCLK,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_HSYNC,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_PSYNC,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_ACBIAS,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA0,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA1,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA2,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA3,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA4,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA5,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA6,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA7,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA8,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA9,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA10,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA11,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA12,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA13,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA14,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA15,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA16,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA17,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA18,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA19,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA20,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA21,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA22,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { DSS_DATA23,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { CAM_HS,        MUXMODE0,   PULL_UP_SELECTED,             INPUT },
-  { CAM_VS,        MUXMODE0,   PULL_UP_SELECTED,             INPUT },
-  { CAM_XCLKA,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { CAM_PCLK,      MUXMODE0,   PULL_UP_SELECTED,             INPUT },
-  { CAM_FLD,       MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { CAM_D0,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D1,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D2,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D3,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D4,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D5,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D6,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D7,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D8,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D9,        MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D10,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_D11,       MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CAM_XCLKB,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { CAM_WEN,       MUXMODE4,   PULL_DISABLED,                INPUT  },
-  { CAM_STROBE,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { CSI2_DX0,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CSI2_DY0,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CSI2_DX1,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { CSI2_DY1,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { MCBSP2_FSX,    MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { MCBSP2_CLKX,   MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { MCBSP2_DR,     MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { MCBSP2_DX,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { MMC1_CLK,      MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
-  { MMC1_CMD,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC1_DAT0,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC1_DAT1,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC1_DAT2,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC1_DAT3,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC1_DAT4,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC1_DAT5,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC1_DAT6,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC1_DAT7,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_CLK,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_CMD,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_DAT0,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_DAT1,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_DAT2,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_DAT3,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_DAT4,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_DAT5,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_DAT6,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MMC2_DAT7,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MCBSP3_DX,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { MCBSP3_DR,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { MCBSP3_CLKX,   MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { MCBSP3_FSX,    MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { UART2_CTS,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { UART2_RTS,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { UART2_TX,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { UART2_RX,      MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { UART1_TX,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { UART1_RTS,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { UART1_CTS,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { UART1_RX,      MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { MCBSP4_CLKX,   MUXMODE1,   PULL_DISABLED,                INPUT  },
-  { MCBSP4_DR,     MUXMODE1,   PULL_DISABLED,                INPUT  },
-  { MCBSP4_DX,     MUXMODE1,   PULL_DISABLED,                INPUT  },
-  { MCBSP4_FSX,    MUXMODE1,   PULL_DISABLED,                INPUT  },
-  { MCBSP1_CLKR,   MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { MCBSP1_FSR,    MUXMODE4,   PULL_UP_SELECTED,             OUTPUT },
-  { MCBSP1_DX,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { MCBSP1_DR,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { MCBSP1_CLKS,   MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { MCBSP1_FSX,    MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { MCBSP1_CLKX,   MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { UART3_CTS_RCTX,MUXMODE0,   PULL_UP_SELECTED,                 INPUT  },
-  { UART3_RTS_SD,  MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { UART3_RX_IRRX, MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { UART3_TX_IRTX, MUXMODE0,   PULL_DISABLED,                OUTPUT },
-  { HSUSB0_CLK,    MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_STP,    MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
-  { HSUSB0_DIR,    MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_NXT,    MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_DATA0,  MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_DATA1,  MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_DATA2,  MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_DATA3,  MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_DATA4,  MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_DATA5,  MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_DATA6,  MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { HSUSB0_DATA7,  MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { I2C1_SCL,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { I2C1_SDA,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { I2C2_SCL,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { I2C2_SDA,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { I2C3_SCL,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { I2C3_SDA,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { HDQ_SIO,       MUXMODE4,   PULL_UP_SELECTED,             OUTPUT },
-  { MCSPI1_CLK,    MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MCSPI1_SIMO,   MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { MCSPI1_SOMI,   MUXMODE0,   PULL_DISABLED,                INPUT  },
-  { MCSPI1_CS0,    MUXMODE0,   PULL_UP_SELECTED,                 INPUT  },
-  { MCSPI1_CS1,    MUXMODE0,   PULL_UP_SELECTED,                 OUTPUT },
-  { MCSPI1_CS2,    MUXMODE4,   PULL_DISABLED,                OUTPUT },
-  { MCSPI1_CS3,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { MCSPI2_CLK,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { MCSPI2_SIMO,   MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { MCSPI2_SOMI,   MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { MCSPI2_CS0,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { MCSPI2_CS1,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { SYS_NIRQ,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
-  { SYS_CLKOUT2,   MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_CLK,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },
-  { ETK_CTL,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },
-  { ETK_D0,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D1,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D2,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D3,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D4,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D5,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D6,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D7,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D8,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D9,        MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D10,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },
-  { ETK_D11,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },
-  { ETK_D12,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D13,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D14,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
-  { ETK_D15,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  }
-};
-
-VOID
-PadConfiguration (
-  VOID
-  )
-{
-  UINTN  Index;
-  UINT16 PadConfiguration;
-  UINTN  NumPinsToConfigure = sizeof(PadConfigurationTable)/sizeof(PAD_CONFIGURATION);
-
-  for (Index = 0; Index < NumPinsToConfigure; Index++) {
-    //Set up Pad configuration for particular pin.
-    PadConfiguration =  (PadConfigurationTable[Index].MuxMode << MUXMODE_OFFSET);
-    PadConfiguration |= (PadConfigurationTable[Index].PullConfig << PULL_CONFIG_OFFSET);
-    PadConfiguration |= (PadConfigurationTable[Index].InputEnable << INPUTENABLE_OFFSET);
-
-    //Configure the pin with specific Pad configuration.
-    MmioWrite16(PadConfigurationTable[Index].Pin, PadConfiguration);
-  }
-}
diff --git a/Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c b/Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c
deleted file mode 100644
index 0708396d9792..000000000000
--- a/Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/** @file
-  C Entry point for the SEC. First C code after the reset vector.
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
-  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.
-
-**/
-
-#include <PiPei.h>
-
-#include <Library/DebugLib.h>
-#include <Library/PrePiLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Library/OmapLib.h>
-#include <Library/ArmLib.h>
-#include <Library/PeCoffGetEntryPointLib.h>
-#include <Library/DebugAgentLib.h>
-
-#include <Ppi/GuidedSectionExtraction.h>
-#include <Guid/LzmaDecompress.h>
-#include <Omap3530/Omap3530.h>
-
-#include "LzmaDecompress.h"
-
-VOID
-PadConfiguration (
-  VOID
-  );
-
-VOID
-ClockInit (
-  VOID
-  );
-
-
-VOID
-TimerInit (
-  VOID
-  )
-{
-  UINTN  Timer            = FixedPcdGet32(PcdOmap35xxFreeTimer);
-  UINT32 TimerBaseAddress = TimerBase(Timer);
-
-  // Set source clock for GPT3 & GPT4 to SYS_CLK
-  MmioOr32 (CM_CLKSEL_PER, CM_CLKSEL_PER_CLKSEL_GPT3_SYS | CM_CLKSEL_PER_CLKSEL_GPT4_SYS);
-
-  // Set count & reload registers
-  MmioWrite32 (TimerBaseAddress + GPTIMER_TCRR, 0x00000000);
-  MmioWrite32 (TimerBaseAddress + GPTIMER_TLDR, 0x00000000);
-
-  // Disable interrupts
-  MmioWrite32 (TimerBaseAddress + GPTIMER_TIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_DISABLE | TIER_MAT_IT_DISABLE);
-
-  // Start Timer
-  MmioWrite32 (TimerBaseAddress + GPTIMER_TCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON);
-
-  //Disable OMAP Watchdog timer (WDT2)
-  MmioWrite32 (WDTIMER2_BASE + WSPR, 0xAAAA);
-  DEBUG ((EFI_D_ERROR, "Magic delay to disable watchdog timers properly.\n"));
-  MmioWrite32 (WDTIMER2_BASE + WSPR, 0x5555);
-}
-
-VOID
-UartInit (
-  VOID
-  )
-{
-  UINTN   Uart            = FixedPcdGet32(PcdOmap35xxConsoleUart);
-  UINT32  UartBaseAddress = UartBase(Uart);
-
-  // Set MODE_SELECT=DISABLE before trying to initialize or modify DLL, DLH registers.
-  MmioWrite32 (UartBaseAddress + UART_MDR1_REG, UART_MDR1_MODE_SELECT_DISABLE);
-
-  // Put device in configuration mode.
-  MmioWrite32 (UartBaseAddress + UART_LCR_REG, UART_LCR_DIV_EN_ENABLE);
-
-  // Programmable divisor N = 48Mhz/16/115200 = 26
-  MmioWrite32 (UartBaseAddress + UART_DLL_REG, 3000000/FixedPcdGet64 (PcdUartDefaultBaudRate)); // low divisor
-  MmioWrite32 (UartBaseAddress + UART_DLH_REG,  0); // high divisor
-
-  // Enter into UART operational mode.
-  MmioWrite32 (UartBaseAddress + UART_LCR_REG, UART_LCR_DIV_EN_DISABLE | UART_LCR_CHAR_LENGTH_8);
-
-  // Force DTR and RTS output to active
-  MmioWrite32 (UartBaseAddress + UART_MCR_REG, UART_MCR_RTS_FORCE_ACTIVE | UART_MCR_DTR_FORCE_ACTIVE);
-
-  // Clear & enable fifos
-  MmioWrite32 (UartBaseAddress + UART_FCR_REG, UART_FCR_TX_FIFO_CLEAR | UART_FCR_RX_FIFO_CLEAR | UART_FCR_FIFO_ENABLE);
-
-  // Restore MODE_SELECT
-  MmioWrite32 (UartBaseAddress + UART_MDR1_REG, UART_MDR1_MODE_SELECT_UART_16X);
-}
-
-VOID
-InitCache (
-  IN  UINT32  MemoryBase,
-  IN  UINT32  MemoryLength
-  );
-
-EFI_STATUS
-EFIAPI
-ExtractGuidedSectionLibConstructor (
-  VOID
-  );
-
-EFI_STATUS
-EFIAPI
-LzmaDecompressLibConstructor (
-  VOID
-  );
-
-
-VOID
-CEntryPoint (
-  IN  VOID  *MemoryBase,
-  IN  UINTN MemorySize,
-  IN  VOID  *StackBase,
-  IN  UINTN StackSize
-  )
-{
-  VOID *HobBase;
-
-  // Build a basic HOB list
-  HobBase      = (VOID *)(UINTN)(FixedPcdGet32(PcdEmbeddedFdBaseAddress) + FixedPcdGet32(PcdEmbeddedFdSize));
-  CreateHobList (MemoryBase, MemorySize, HobBase, StackBase);
-
-  //Set up Pin muxing.
-  PadConfiguration ();
-
-  // Set up system clocking
-  ClockInit ();
-
-
-  // Enable program flow prediction, if supported.
-  ArmEnableBranchPrediction ();
-
-  // Initialize CPU cache
-  InitCache ((UINT32)MemoryBase, (UINT32)MemorySize);
-
-  // Add memory allocation hob for relocated FD
-  BuildMemoryAllocationHob (FixedPcdGet32(PcdEmbeddedFdBaseAddress), FixedPcdGet32(PcdEmbeddedFdSize), EfiBootServicesData);
-
-  // Add the FVs to the hob list
-  BuildFvHob (PcdGet32(PcdFlashFvMainBase), PcdGet32(PcdFlashFvMainSize));
-
-  // Start talking
-  UartInit ();
-
-  InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC, NULL, NULL);
-  SaveAndSetDebugTimerInterrupt (TRUE);
-
-  DEBUG ((EFI_D_ERROR, "UART Enabled\n"));
-
-  // Start up a free running timer so that the timer lib will work
-  TimerInit ();
-
-  // SEC phase needs to run library constructors by hand.
-  ExtractGuidedSectionLibConstructor ();
-  LzmaDecompressLibConstructor ();
-
-  // Build HOBs to pass up our version of stuff the DXE Core needs to save space
-  BuildPeCoffLoaderHob ();
-  BuildExtractSectionHob (
-    &gLzmaCustomDecompressGuid,
-    LzmaGuidedSectionGetInfo,
-    LzmaGuidedSectionExtraction
-    );
-
-  // Assume the FV that contains the SEC (our code) also contains a compressed FV.
-  DecompressFirstFv ();
-
-  // Load the DXE Core and transfer control to it
-  LoadDxeCoreFromFv (NULL, 0);
-
-  // DXE Core should always load and never return
-  ASSERT (FALSE);
-}
-
diff --git a/Platforms/TexasInstruments/BeagleBoard/Sec/Sec.inf b/Platforms/TexasInstruments/BeagleBoard/Sec/Sec.inf
deleted file mode 100644
index 5f207d0eef24..000000000000
--- a/Platforms/TexasInstruments/BeagleBoard/Sec/Sec.inf
+++ /dev/null
@@ -1,74 +0,0 @@
-
-#/** @file
-#  SEC - Reset vector code that jumps to C and loads DXE core
-#
-#  Copyright (c) 2008, Apple Inc. All rights reserved.<BR>
-#  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                      = BeagleBoardSec
-  FILE_GUID                      = d959e387-7b91-452c-90e0-a1dbac90ddb8
-  MODULE_TYPE                    = SEC
-  VERSION_STRING                 = 1.0
-
-
-[Sources.ARM]
-  Arm/ModuleEntryPoint.S   | GCC
-  Arm/ModuleEntryPoint.asm | RVCT
-
-[Sources.ARM]
-  Sec.c
-  Cache.c
-  PadConfiguration.c
-  Clock.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  EmbeddedPkg/EmbeddedPkg.dec
-  ArmPkg/ArmPkg.dec
-  OpenPlatformPkg/Chips/TexasInstruments/Omap35xx/Omap35xxPkg.dec
-  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
-  BaseLib
-  DebugLib
-  ArmLib
-  ArmMmuLib
-  IoLib
-  ExtractGuidedSectionLib
-  LzmaDecompressLib
-  OmapLib
-  PeCoffGetEntryPointLib
-  DebugAgentLib
-  MemoryAllocationLib
-  PrePiHobListPointerLib
-
-[FeaturePcd]
-  gEmbeddedTokenSpaceGuid.PcdCacheEnable
-
-[FixedPcd]
-  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
-  gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress
-  gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize
-  gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase
-  gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize
-  gEmbeddedTokenSpaceGuid.PcdPrePiStackSize
-  gEmbeddedTokenSpaceGuid.PcdPrePiStackBase
-  gEmbeddedTokenSpaceGuid.PcdMemoryBase
-  gEmbeddedTokenSpaceGuid.PcdMemorySize
-
-  gOmap35xxTokenSpaceGuid.PcdOmap35xxConsoleUart
-  gOmap35xxTokenSpaceGuid.PcdOmap35xxFreeTimer
-
-  gArmTokenSpaceGuid.PcdCpuVectorBaseAddress
-
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] Platforms/BeagleBoard/BeagleBoardLib: switch to ASM_FUNC() asm macro
  2016-08-11 10:08 [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 1/6] Platforms/BeagleBoard: remove unreferenced Sec.inf module Ard Biesheuvel
@ 2016-08-11 10:08 ` Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 3/6] Platforms/Styx: remove unused AmdStyxSecLib Ard Biesheuvel
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2016-08-11 10:08 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platforms/TexasInstruments/BeagleBoard/Library/BeagleBoardLib/BeagleBoardHelper.S | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/Platforms/TexasInstruments/BeagleBoard/Library/BeagleBoardLib/BeagleBoardHelper.S b/Platforms/TexasInstruments/BeagleBoard/Library/BeagleBoardLib/BeagleBoardHelper.S
index f15792546448..958f0029935c 100644
--- a/Platforms/TexasInstruments/BeagleBoard/Library/BeagleBoardLib/BeagleBoardHelper.S
+++ b/Platforms/TexasInstruments/BeagleBoard/Library/BeagleBoardLib/BeagleBoardHelper.S
@@ -12,34 +12,24 @@
 #
 
 #include <AsmMacroIoLib.h>
-#include <AutoGen.h>
-
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-
-GCC_ASM_IMPORT(ArmReadMpidr)
 
 //UINTN
 //ArmPlatformIsPrimaryCore (
 //  IN UINTN MpId
 //  );
-ASM_PFX(ArmPlatformIsPrimaryCore):
+ASM_FUNC(ArmPlatformIsPrimaryCore)
   // BeagleBoard has a single core. We must always return 1.
   mov   r0, #1
   bx    lr
 
-ASM_PFX(ArmPlatformPeiBootAction):
+ASM_FUNC(ArmPlatformPeiBootAction)
   bx    lr
 
 //UINTN
 //ArmPlatformGetPrimaryCoreMpId (
 //  VOID
 //  );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
   // The BeagleBoard is a uniprocessor platform. The MPIDR of primary core is
   // always the MPIDR of the calling CPU.
   b   ASM_PFX(ArmReadMpidr)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] Platforms/Styx: remove unused AmdStyxSecLib
  2016-08-11 10:08 [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 1/6] Platforms/BeagleBoard: remove unreferenced Sec.inf module Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 2/6] Platforms/BeagleBoard/BeagleBoardLib: switch to ASM_FUNC() asm macro Ard Biesheuvel
@ 2016-08-11 10:08 ` Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 4/6] Platforms/Styx: switch to ASM_FUNC() asm macro Ard Biesheuvel
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2016-08-11 10:08 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 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(-)

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.<BR>
-//  Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
-//
-//  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 <AsmMacroIoLibV8.h>
-
-// 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.<BR>
-//  Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
-//
-//  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 <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <Library/ArmPlatformLib.h>
-#include <AutoGen.h>
-
-.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.<BR>
-#  Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
-#
-#  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.<BR>
-*  Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
-*
-*  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 <Library/IoLib.h>
-#include <Library/ArmGicLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#include <Drivers/PL310L2Cache.h>
-#include <Drivers/SP804Timer.h>
-
-
-// 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
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] Platforms/Styx: switch to ASM_FUNC() asm macro
  2016-08-11 10:08 [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Ard Biesheuvel
                   ` (2 preceding siblings ...)
  2016-08-11 10:08 ` [PATCH 3/6] Platforms/Styx: remove unused AmdStyxSecLib Ard Biesheuvel
@ 2016-08-11 10:08 ` Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 5/6] Platforms/Hisilicon/ArmPlatformLibPv660: " Ard Biesheuvel
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2016-08-11 10:08 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, clean up some inefficient uses of LoadConstantToReg()
and other indirect absolute references (which require runtime relocation).
Since this requires fixed PCDs to be declared as such in the module .inf,
update those as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platforms/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S  | 58 ++++++--------------
 Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf    |  7 ++-
 Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf |  1 +
 3 files changed, 21 insertions(+), 45 deletions(-)

diff --git a/Platforms/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S b/Platforms/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
index 0f9822a86989..a3ac60282706 100644
--- a/Platforms/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
+++ b/Platforms/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
@@ -17,25 +17,8 @@
 #   ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.S
 #
 #**/
-
 #include <AsmMacroIoLibV8.h>
-#include <Base.h>
 #include <Library/ArmLib.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)
 
 PrimaryCoreMpid:  .word    0x0
 PrimaryCoreBoot:  .word    0x0
@@ -44,18 +27,15 @@ PrimaryCoreBoot:  .word    0x0
 //ArmPlatformPeiBootAction (
 //  VOID
 //  );
-ASM_PFX(ArmPlatformPeiBootAction):
+ASM_FUNC(ArmPlatformPeiBootAction)
+  ldr  w0, PrimaryCoreBoot
+  cbnz w0, 1f
+
   // Save the primary CPU MPID
-  ldr  x1, =PrimaryCoreBoot
-  ldrh w0, [x1]
-  cmp  wzr, w0
-  b.ne 1f
   mrs  x0, mpidr_el1
-  ldr  x1, =PrimaryCoreMpid
-  str  w0, [x1]
-  mov  w0, 1
-  ldr  x1, =PrimaryCoreBoot
-  str  w0, [x1]
+  adr  x2, PrimaryCoreMpid
+  mov  w1, #1
+  stp  w0, w1, [x2]
 1:
   ret
 
@@ -63,34 +43,28 @@ ASM_PFX(ArmPlatformPeiBootAction):
 //ArmPlatformGetPrimaryCoreMpId (
 //  VOID
 //  );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
-  ldr   x0, =PrimaryCoreMpid
-  ldrh  w0, [x0]
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
+  ldr   w0, PrimaryCoreMpid
   ret
 
 # IN None
 # OUT x0 = number of cores present in the system
-ASM_PFX(ArmGetCpuCountPerCluster):
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, x0)
-  ldrh  w0, [x0]
+ASM_FUNC(ArmGetCpuCountPerCluster)
+  MOV32 (w0, FixedPcdGet32 (PcdCoreCount))
   ret
 
 //UINTN
 //ArmPlatformIsPrimaryCore (
 //  IN UINTN MpId
 //  );
-ASM_PFX(ArmPlatformIsPrimaryCore):
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
-  ldrh  w1, [x1]
+ASM_FUNC(ArmPlatformIsPrimaryCore)
+  MOV32 (w1, FixedPcdGet32 (PcdArmPrimaryCoreMask))
   and   x0, x0, x1
 
-  ldr   x1, =PrimaryCoreMpid
-  ldrh  w1, [x1]
+  ldr   w1, PrimaryCoreMpid
 
   cmp   w0, w1
-  mov   x0, #1
-  mov   x1, #0
-  csel  x0, x0, x1, eq
+  cset  x0, eq
   ret
 
 //UINTN
@@ -98,7 +72,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
 //  IN UINTN MpId
 //  );
 // With this function: CorePos = (ClusterId * 2) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
+ASM_FUNC(ArmPlatformGetCorePosition)
   and   x1, x0, #ARM_CORE_MASK
   and   x0, x0, #ARM_CLUSTER_MASK
   add   x0, x1, x0, LSR #7
diff --git a/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf b/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf
index c6e42e4482fe..4a6469ee016c 100644
--- a/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf
+++ b/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf
@@ -63,14 +63,15 @@
   gArmTokenSpaceGuid.PcdFvBaseAddress
   gArmTokenSpaceGuid.PcdFdBaseAddress
 
+  gAmdStyxTokenSpaceGuid.PcdTrustedFWMemoryBase
+  gAmdStyxTokenSpaceGuid.PcdTrustedFWMemorySize
+
+[FixedPcd]
   gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
   gArmTokenSpaceGuid.PcdArmPrimaryCore
 
   gArmPlatformTokenSpaceGuid.PcdCoreCount
   gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
 
-  gAmdStyxTokenSpaceGuid.PcdTrustedFWMemoryBase
-  gAmdStyxTokenSpaceGuid.PcdTrustedFWMemorySize
-
 [Depex]
   gAmdStyxPlatInitPpiGuid
diff --git a/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf b/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
index fefd3ee6999b..0b9b6287168d 100644
--- a/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
+++ b/Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
@@ -61,6 +61,7 @@
   gArmTokenSpaceGuid.PcdSystemMemorySize
   gArmTokenSpaceGuid.PcdFvBaseAddress
 
+[FixedPcd]
   gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
   gArmTokenSpaceGuid.PcdArmPrimaryCore
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] Platforms/Hisilicon/ArmPlatformLibPv660: switch to ASM_FUNC() asm macro
  2016-08-11 10:08 [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Ard Biesheuvel
                   ` (3 preceding siblings ...)
  2016-08-11 10:08 ` [PATCH 4/6] Platforms/Styx: switch to ASM_FUNC() asm macro Ard Biesheuvel
@ 2016-08-11 10:08 ` Ard Biesheuvel
  2016-08-11 10:08 ` [PATCH 6/6] Platforms/Marvell/Armada70x0Lib: " Ard Biesheuvel
  2016-08-11 10:25 ` [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Leif Lindholm
  6 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2016-08-11 10:08 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, clean up some inefficient uses of LoadConstantToReg()
(which require runtime relocation).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S | 44 +++++---------------
 1 file changed, 10 insertions(+), 34 deletions(-)

diff --git a/Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S b/Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S
index 3b545f188f64..3422df279c73 100644
--- a/Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S
+++ b/Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S
@@ -16,59 +16,35 @@
 //
 
 #include <AsmMacroIoLibV8.h>
-#include <Base.h>
 #include <Library/ArmLib.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
 
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)
-
-ASM_PFX(ArmPlatformPeiBootAction):
+ASM_FUNC(ArmPlatformPeiBootAction)
   ret
 
 //UINTN
 //ArmPlatformGetPrimaryCoreMpId (
 //  VOID
 //  );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)
-  ldrh   w0, [x0]
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
+  MOV32 (w0, FixedPcdGet32(PcdArmPrimaryCore))
   ret
 
 # IN None
 # OUT x0 = number of cores present in the system
-ASM_PFX(ArmGetCpuCountPerCluster):
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, x0)
-  ldrh  w0, [x0]
+ASM_FUNC(ArmGetCpuCountPerCluster)
+  MOV32 (w0, FixedPcdGet32(PcdCoreCount))
   ret
 
 //UINTN
 //ArmPlatformIsPrimaryCore (
 //  IN UINTN MpId
 //  );
-ASM_PFX(ArmPlatformIsPrimaryCore):
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
-  ldrh  w1, [x1]
+ASM_FUNC(ArmPlatformIsPrimaryCore)
+  MOV32 (w1, FixedPcdGet32(PcdArmPrimaryCoreMask))
   and   x0, x0, x1
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x1)
-  ldrh  w1, [x1]
+  MOV32 (w1, FixedPcdGet32(PcdArmPrimaryCore))
   cmp   w0, w1
-  b.ne  1f
-  mov   x0, #1
-  ret
-1:
-  mov   x0, #0
+  cset  x0, eq
   ret
 
 //UINTN
@@ -76,7 +52,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
 //  IN UINTN MpId
 //  );
 // With this function: CorePos = (ClusterId * 4) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
+ASM_FUNC(ArmPlatformGetCorePosition)
   and   x1, x0, #ARM_CORE_MASK
   and   x0, x0, #ARM_CLUSTER_MASK
   add   x0, x1, x0, LSR #6
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] Platforms/Marvell/Armada70x0Lib: switch to ASM_FUNC() asm macro
  2016-08-11 10:08 [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Ard Biesheuvel
                   ` (4 preceding siblings ...)
  2016-08-11 10:08 ` [PATCH 5/6] Platforms/Hisilicon/ArmPlatformLibPv660: " Ard Biesheuvel
@ 2016-08-11 10:08 ` Ard Biesheuvel
  2016-08-11 10:25 ` [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Leif Lindholm
  6 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2016-08-11 10:08 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, clean up some inefficient uses of LoadConstantToReg()
(which require runtime relocation).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platforms/Marvell/Armada/Library/Armada70x0Lib/AArch64/ArmPlatformHelper.S | 32 +++++---------------
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/Platforms/Marvell/Armada/Library/Armada70x0Lib/AArch64/ArmPlatformHelper.S b/Platforms/Marvell/Armada/Library/Armada70x0Lib/AArch64/ArmPlatformHelper.S
index 4ad435c9d044..9265636ca5cf 100644
--- a/Platforms/Marvell/Armada/Library/Armada70x0Lib/AArch64/ArmPlatformHelper.S
+++ b/Platforms/Marvell/Armada/Library/Armada70x0Lib/AArch64/ArmPlatformHelper.S
@@ -15,18 +15,7 @@
 #include <AsmMacroIoLibV8.h>
 #include <Library/ArmLib.h>
 
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-ASM_PFX(ArmPlatformPeiBootAction):
+ASM_FUNC(ArmPlatformPeiBootAction)
   ret
 
 //UINTN
@@ -34,7 +23,7 @@ ASM_PFX(ArmPlatformPeiBootAction):
 //  IN UINTN MpId
 //  );
 // With this function: CorePos = (ClusterId * 4) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
+ASM_FUNC(ArmPlatformGetCorePosition)
   and   x1, x0, #ARM_CORE_MASK
   and   x0, x0, #ARM_CLUSTER_MASK
   add   x0, x1, x0, LSR #6
@@ -44,23 +33,18 @@ ASM_PFX(ArmPlatformGetCorePosition):
 //ArmPlatformGetPrimaryCoreMpId (
 //  VOID
 //  );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)
-  ldrh  w0, [x0]
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
+  MOV32 (w0, FixedPcdGet32(PcdArmPrimaryCore))
   ret
 
 //UINTN
 //ArmPlatformIsPrimaryCore (
 //  IN UINTN MpId
 //  );
-ASM_PFX(ArmPlatformIsPrimaryCore):
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
-  ldrh  w1, [x1]
+ASM_FUNC(ArmPlatformIsPrimaryCore)
+  MOV32 (w1, FixedPcdGet32(PcdArmPrimaryCoreMask))
   and   x0, x0, x1
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x1)
-  ldrh  w1, [x1]
+  MOV32 (w1, FixedPcdGet32(PcdArmPrimaryCore))
   cmp   w0, w1
-  mov   x0, #1
-  mov   x1, #0
-  csel  x0, x0, x1, eq
+  cset  x0, eq
   ret
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well
  2016-08-11 10:08 [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Ard Biesheuvel
                   ` (5 preceding siblings ...)
  2016-08-11 10:08 ` [PATCH 6/6] Platforms/Marvell/Armada70x0Lib: " Ard Biesheuvel
@ 2016-08-11 10:25 ` Leif Lindholm
  2016-08-11 11:51   ` Ard Biesheuvel
  6 siblings, 1 reply; 9+ messages in thread
From: Leif Lindholm @ 2016-08-11 10:25 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel

On Thu, Aug 11, 2016 at 12:08:15PM +0200, Ard Biesheuvel wrote:
> This moves the asm files in OpenPlatformPkg to the new ASM_FUNC() macro,
> which annotates functions in a way that allows the linker to drop code
> that is not actually used anywhere. It is analogous to -ffunction-sections
> for GCC.
> 
> Since there are some cargo culted asm patterns that are very clunky and
> inefficient, clean those up as well (i.e., LoadConstantToReg())

For the series:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> Ard Biesheuvel (6):
>   Platforms/BeagleBoard: remove unreferenced Sec.inf module
>   Platforms/BeagleBoard/BeagleBoardLib: switch to ASM_FUNC() asm macro
>   Platforms/Styx: remove unused AmdStyxSecLib
>   Platforms/Styx: switch to ASM_FUNC() asm macro
>   Platforms/Hisilicon/ArmPlatformLibPv660: switch to ASM_FUNC() asm
>     macro
>   Platforms/Marvell/Armada70x0Lib: switch to ASM_FUNC() asm macro
> 
>  Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S                      |  44 +--
>  Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc                                      |   1 -
>  Platforms/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S                            |  58 ++--
>  Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf                              |   7 +-
>  Platforms/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf                           |   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 -
>  Platforms/Marvell/Armada/Library/Armada70x0Lib/AArch64/ArmPlatformHelper.S        |  32 +--
>  Platforms/TexasInstruments/BeagleBoard/Library/BeagleBoardLib/BeagleBoardHelper.S |  16 +-
>  Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.S                 |  85 ------
>  Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.asm               |  89 ------
>  Platforms/TexasInstruments/BeagleBoard/Sec/Cache.c                                |  80 ------
>  Platforms/TexasInstruments/BeagleBoard/Sec/Clock.c                                |  70 -----
>  Platforms/TexasInstruments/BeagleBoard/Sec/LzmaDecompress.h                       | 103 -------
>  Platforms/TexasInstruments/BeagleBoard/Sec/PadConfiguration.c                     | 282 --------------------
>  Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c                                  | 186 -------------
>  Platforms/TexasInstruments/BeagleBoard/Sec/Sec.inf                                |  74 -----
>  20 files changed, 42 insertions(+), 1488 deletions(-)
>  delete mode 100644 Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/GicV3.S
>  delete mode 100644 Platforms/AMD/Styx/Library/AmdStyxSecLib/AArch64/StyxBoot.S
>  delete mode 100644 Platforms/AMD/Styx/Library/AmdStyxSecLib/AmdStyxSecLib.inf
>  delete mode 100644 Platforms/AMD/Styx/Library/AmdStyxSecLib/StyxSec.c
>  delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.S
>  delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Arm/ModuleEntryPoint.asm
>  delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Cache.c
>  delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Clock.c
>  delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/LzmaDecompress.h
>  delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/PadConfiguration.c
>  delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c
>  delete mode 100644 Platforms/TexasInstruments/BeagleBoard/Sec/Sec.inf
> 
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well
  2016-08-11 10:25 ` [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Leif Lindholm
@ 2016-08-11 11:51   ` Ard Biesheuvel
  0 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2016-08-11 11:51 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel-01

On 11 August 2016 at 12:25, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Thu, Aug 11, 2016 at 12:08:15PM +0200, Ard Biesheuvel wrote:
>> This moves the asm files in OpenPlatformPkg to the new ASM_FUNC() macro,
>> which annotates functions in a way that allows the linker to drop code
>> that is not actually used anywhere. It is analogous to -ffunction-sections
>> for GCC.
>>
>> Since there are some cargo culted asm patterns that are very clunky and
>> inefficient, clean those up as well (i.e., LoadConstantToReg())
>
> For the series:
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>

Thanks, pushed with a minor tweak to #2 to prevent further breakage
with RVCT (given that the upstream is broken with RVCT to begin with)

-- 
Ard.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-11 11:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-11 10:08 [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Ard Biesheuvel
2016-08-11 10:08 ` [PATCH 1/6] Platforms/BeagleBoard: remove unreferenced Sec.inf module Ard Biesheuvel
2016-08-11 10:08 ` [PATCH 2/6] Platforms/BeagleBoard/BeagleBoardLib: switch to ASM_FUNC() asm macro Ard Biesheuvel
2016-08-11 10:08 ` [PATCH 3/6] Platforms/Styx: remove unused AmdStyxSecLib Ard Biesheuvel
2016-08-11 10:08 ` [PATCH 4/6] Platforms/Styx: switch to ASM_FUNC() asm macro Ard Biesheuvel
2016-08-11 10:08 ` [PATCH 5/6] Platforms/Hisilicon/ArmPlatformLibPv660: " Ard Biesheuvel
2016-08-11 10:08 ` [PATCH 6/6] Platforms/Marvell/Armada70x0Lib: " Ard Biesheuvel
2016-08-11 10:25 ` [PATCH 0/6] Move to ASM_FUNC() macro, and clean up some asm as well Leif Lindholm
2016-08-11 11:51   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox