+++ /dev/null
-#------------------------------------------------------------------------------ \r
-#\r
-# ARM EB Entry point. Reset vector in FV header will brach to\r
-# _ModuleEntryPoint. \r
-#\r
-# We use crazy macros, like LoadConstantToReg, since Xcode assembler \r
-# does not support = assembly syntax for ldr.\r
-#\r
-# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-#\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
-#include <Library/PcdLib.h>\r
-#include <ArmEb/ArmEb.h>\r
-\r
-.text\r
-.align 3\r
-\r
-.globl ASM_PFX(CEntryPoint)\r
-.globl ASM_PFX(_ModuleEntryPoint)\r
-\r
-ASM_PFX(_ModuleEntryPoint):\r
- \r
- // Turn off remapping NOR to 0. We can now use DRAM in low memory\r
- // CAN'T DO THIS HERE -- BRANCH FROM RESET VECTOR IS RELATIVE AND REMAINS IN REMAPPED NOR\r
- //MmioOr32 (EB_SP810_CTRL_BASE ,BIT8) \r
-\r
- // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r
- mrc p15, 0, r0, c1, c0, 2\r
- orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)\r
- mcr p15, 0, r0, c1, c0, 2\r
- mov r0, #0x40000000 // Set EN bit in FPEXC\r
- mcr p10,#0x7,r0,c8,c0,#0 // msr FPEXC,r0 in ARM assembly\r
- \r
- // Set CPU vectors to 0 (which is currently flash)\r
- LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base\r
- mcr p15, 0, r0, c12, c0, 0\r
- isb // Sync changes to control registers\r
-\r
- //\r
- // Set stack based on PCD values. Need to do it this way to make C code work \r
- // when it runs from FLASH. \r
- // \r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2 \r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3 \r
- add r4, r2, r3\r
- mov r13, r4\r
-\r
- // Call C entry point\r
- LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1 \r
- LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0 \r
- blx ASM_PFX(CEntryPoint) \r
-\r
-ShouldNeverGetHere:\r
- // _CEntryPoint should never return \r
- b ShouldNeverGetHere\r
-\r
- \r
+++ /dev/null
-//------------------------------------------------------------------------------ \r
-//\r
-// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-//\r
-// This program and the accompanying materials\r
-// are licensed and made available under the terms and conditions of the BSD License\r
-// which accompanies this distribution. The full text of the license may be found at\r
-// http://opensource.org/licenses/bsd-license.php\r
-//\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-//------------------------------------------------------------------------------\r
-\r
-#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
-#include <Library/PcdLib.h>\r
-#include <ArmEb/ArmEb.h>\r
-#include <AutoGen.h>\r
-\r
- INCLUDE AsmMacroIoLib.inc\r
- \r
- IMPORT CEntryPoint\r
- EXPORT _ModuleEntryPoint\r
- \r
- PRESERVE8\r
- AREA ModuleEntryPoint, CODE, READONLY\r
- \r
-\r
-StartupAddr DCD CEntryPoint\r
-\r
-_ModuleEntryPoint\r
- \r
- // Turn off remapping NOR to 0. We can now use DRAM in low memory\r
- // CAN'T DO THIS HERE -- BRANCH FROM RESET VECTOR IS RELATIVE AND REMAINS IN REMAPPED NOR\r
- //MmioOr32 (0x10001000 ,BIT8) //EB_SP810_CTRL_BASE\r
-\r
- // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r
- mrc p15, 0, r0, c1, c0, 2\r
- orr r0, r0, #0x00f00000 // Enable VFP access (V* instructions)\r
- mcr p15, 0, r0, c1, c0, 2\r
- mov r0, #0x40000000 // Set EN bit in FPEXC\r
- mcr p10,#0x7,r0,c8,c0,#0 // msr FPEXC,r0 in ARM assembly\r
- \r
- // Set CPU vectors to 0 (which is currently flash)\r
- LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base\r
- mcr p15, 0, r0, c12, c0, 0\r
- isb // Sync changes to control registers\r
-\r
- //\r
- // Set stack based on PCD values. Need to do it this way to make C code work \r
- // when it runs from FLASH. \r
- // \r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2 \r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3 \r
- add r4, r2, r3\r
- mov r13, r4\r
- \r
- LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1 \r
- LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0 \r
-\r
- // move sec startup address into a data register\r
- // ensure we're jumping to FV version of the code (not boot remapped alias)\r
- ldr r4, StartupAddr\r
-\r
- // jump to SEC C code\r
- blx r4\r
- \r
- // Call C entry point\r
- // THIS DOESN'T WORK, WE NEED A LONG JUMP\r
- \r
- // blx CEntryPoint \r
-\r
-ShouldNeverGetHere\r
- // _CEntryPoint should never return \r
- b ShouldNeverGetHere\r
- \r
- END\r
-\r
-\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
- \r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <PiPei.h>\r
-\r
-#include <Library/ArmLib.h>\r
-#include <Library/PrePiLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-// DDR attributes\r
-#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK\r
-#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED\r
-\r
-// SoC registers. L3 interconnects\r
-#define SOC_REGISTERS_L3_PHYSICAL_BASE 0x68000000\r
-#define SOC_REGISTERS_L3_PHYSICAL_LENGTH 0x08000000\r
-#define SOC_REGISTERS_L3_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE\r
-\r
-// SoC registers. L4 interconnects\r
-#define SOC_REGISTERS_L4_PHYSICAL_BASE 0x48000000\r
-#define SOC_REGISTERS_L4_PHYSICAL_LENGTH 0x08000000\r
-#define SOC_REGISTERS_L4_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE\r
-\r
-VOID\r
-InitCache (\r
- IN UINT32 MemoryBase,\r
- IN UINT32 MemoryLength\r
- )\r
-{\r
- UINT32 CacheAttributes;\r
- ARM_MEMORY_REGION_DESCRIPTOR MemoryTable[5];\r
- VOID *TranslationTableBase;\r
- UINTN TranslationTableSize;\r
-\r
- if (FeaturePcdGet(PcdCacheEnable) == TRUE) {\r
- CacheAttributes = DDR_ATTRIBUTES_CACHED;\r
- } else {\r
- CacheAttributes = DDR_ATTRIBUTES_UNCACHED;\r
- }\r
-\r
- // DDR\r
- MemoryTable[0].PhysicalBase = MemoryBase;\r
- MemoryTable[0].VirtualBase = MemoryBase;\r
- MemoryTable[0].Length = MemoryLength;\r
- MemoryTable[0].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)CacheAttributes;\r
-\r
- // SOC Registers. L3 interconnects\r
- MemoryTable[1].PhysicalBase = SOC_REGISTERS_L3_PHYSICAL_BASE;\r
- MemoryTable[1].VirtualBase = SOC_REGISTERS_L3_PHYSICAL_BASE;\r
- MemoryTable[1].Length = SOC_REGISTERS_L3_PHYSICAL_LENGTH;\r
- MemoryTable[1].Attributes = SOC_REGISTERS_L3_ATTRIBUTES;\r
- \r
- // SOC Registers. L4 interconnects\r
- MemoryTable[2].PhysicalBase = SOC_REGISTERS_L4_PHYSICAL_BASE;\r
- MemoryTable[2].VirtualBase = SOC_REGISTERS_L4_PHYSICAL_BASE;\r
- MemoryTable[2].Length = SOC_REGISTERS_L4_PHYSICAL_LENGTH;\r
- MemoryTable[2].Attributes = SOC_REGISTERS_L4_ATTRIBUTES;\r
-\r
- // End of Table\r
- MemoryTable[3].PhysicalBase = 0;\r
- MemoryTable[3].VirtualBase = 0;\r
- MemoryTable[3].Length = 0;\r
- MemoryTable[3].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;\r
- \r
- ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize);\r
- \r
- BuildMemoryAllocationHob ((EFI_PHYSICAL_ADDRESS)(UINTN)TranslationTableBase, TranslationTableSize, EfiBootServicesData);\r
-}\r
+++ /dev/null
-/** @file\r
- LZMA Decompress Library header file\r
-\r
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __LZMA_DECOMPRESS_H___\r
-#define __LZMA_DECOMPRESS_H___\r
-\r
-/**\r
- Examines a GUIDed section and returns the size of the decoded buffer and the\r
- size of an scratch buffer required to actually decode the data in a GUIDed section.\r
-\r
- Examines a GUIDed section specified by InputSection. \r
- If GUID for InputSection does not match the GUID that this handler supports,\r
- then RETURN_UNSUPPORTED is returned. \r
- If the required information can not be retrieved from InputSection,\r
- then RETURN_INVALID_PARAMETER is returned.\r
- If the GUID of InputSection does match the GUID that this handler supports,\r
- then the size required to hold the decoded buffer is returned in OututBufferSize,\r
- the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field\r
- from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute.\r
- \r
- If InputSection is NULL, then ASSERT().\r
- If OutputBufferSize is NULL, then ASSERT().\r
- If ScratchBufferSize is NULL, then ASSERT().\r
- If SectionAttribute is NULL, then ASSERT().\r
-\r
-\r
- @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.\r
- @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required\r
- if the buffer specified by InputSection were decoded.\r
- @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space\r
- if the buffer specified by InputSection were decoded.\r
- @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes\r
- field of EFI_GUID_DEFINED_SECTION in the PI Specification.\r
-\r
- @retval RETURN_SUCCESS The information about InputSection was returned.\r
- @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.\r
- @retval RETURN_INVALID_PARAMETER The information can not be retrieved from the section specified by InputSection.\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-LzmaGuidedSectionGetInfo (\r
- IN CONST VOID *InputSection,\r
- OUT UINT32 *OutputBufferSize,\r
- OUT UINT32 *ScratchBufferSize,\r
- OUT UINT16 *SectionAttribute\r
- );\r
-\r
-/**\r
- Decompress a LZAM compressed GUIDed section into a caller allocated output buffer.\r
- \r
- Decodes the GUIDed section specified by InputSection. \r
- If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned. \r
- If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned.\r
- If the GUID of InputSection does match the GUID that this handler supports, then InputSection\r
- is decoded into the buffer specified by OutputBuffer and the authentication status of this\r
- decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the\r
- data in InputSection, then OutputBuffer is set to point at the data in InputSection. Otherwise,\r
- the decoded data will be placed in caller allocated buffer specified by OutputBuffer.\r
- \r
- If InputSection is NULL, then ASSERT().\r
- If OutputBuffer is NULL, then ASSERT().\r
- If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().\r
- If AuthenticationStatus is NULL, then ASSERT().\r
-\r
-\r
- @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.\r
- @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation. \r
- @param[out] ScratchBuffer A caller allocated buffer that may be required by this function\r
- as a scratch buffer to perform the decode operation. \r
- @param[out] AuthenticationStatus \r
- A pointer to the authentication status of the decoded output buffer.\r
- See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI\r
- section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must\r
- never be set by this handler.\r
-\r
- @retval RETURN_SUCCESS The buffer specified by InputSection was decoded.\r
- @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.\r
- @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded.\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-LzmaGuidedSectionExtraction (\r
- IN CONST VOID *InputSection,\r
- OUT VOID **OutputBuffer,\r
- OUT VOID *ScratchBuffer, OPTIONAL\r
- OUT UINT32 *AuthenticationStatus\r
- );\r
- \r
-#endif // __LZMADECOMPRESS_H__\r
-\r
+++ /dev/null
-#------------------------------------------------------------------------------ \r
-#\r
-# ARM EB Entry point. Reset vector in FV header will brach to\r
-# _ModuleEntryPoint. \r
-#\r
-# We use crazy macros, like LoadConstantToReg, since Xcode assembler \r
-# does not support = assembly syntax for ldr.\r
-#\r
-# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-#\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
-#include <Library/PcdLib.h>\r
-#include <ArmEb/ArmEb.h>\r
-\r
-.text\r
-.align 3\r
-\r
-.globl ASM_PFX(CEntryPoint)\r
-.globl ASM_PFX(_ModuleEntryPoint)\r
-\r
-ASM_PFX(_ModuleEntryPoint):\r
- \r
- // Turn off remapping NOR to 0. We can now use DRAM in low memory\r
- // CAN'T DO THIS HERE -- BRANCH FROM RESET VECTOR IS RELATIVE AND REMAINS IN REMAPPED NOR\r
- //MmioOr32 (EB_SP810_CTRL_BASE ,BIT8) \r
-\r
- // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r
- mrc p15, 0, r0, c1, c0, 2\r
- orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)\r
- mcr p15, 0, r0, c1, c0, 2\r
- mov r0, #0x40000000 // Set EN bit in FPEXC\r
- mcr p10,#0x7,r0,c8,c0,#0 // msr FPEXC,r0 in ARM assembly\r
- \r
- // Set CPU vectors to 0 (which is currently flash)\r
- LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base\r
- mcr p15, 0, r0, c12, c0, 0\r
- isb // Sync changes to control registers\r
-\r
- //\r
- // Set stack based on PCD values. Need to do it this way to make C code work \r
- // when it runs from FLASH. \r
- // \r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2 \r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3 \r
- add r4, r2, r3\r
- mov r13, r4\r
-\r
- // Call C entry point\r
- LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1 \r
- LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0 \r
- blx ASM_PFX(CEntryPoint) \r
-\r
-ShouldNeverGetHere:\r
- // _CEntryPoint should never return \r
- b ShouldNeverGetHere\r
-\r
- \r
+++ /dev/null
-//------------------------------------------------------------------------------ \r
-//\r
-// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-//\r
-// This program and the accompanying materials\r
-// are licensed and made available under the terms and conditions of the BSD License\r
-// which accompanies this distribution. The full text of the license may be found at\r
-// http://opensource.org/licenses/bsd-license.php\r
-//\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-//------------------------------------------------------------------------------\r
-\r
-#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
-#include <Library/PcdLib.h>\r
-#include <ArmEb/ArmEb.h>\r
-#include <AutoGen.h>\r
-\r
- INCLUDE AsmMacroIoLib.inc\r
- \r
- IMPORT CEntryPoint\r
- EXPORT _ModuleEntryPoint\r
- \r
- PRESERVE8\r
- AREA ModuleEntryPoint, CODE, READONLY\r
- \r
-\r
-StartupAddr DCD CEntryPoint\r
-\r
-_ModuleEntryPoint\r
- \r
- // Turn off remapping NOR to 0. We can now use DRAM in low memory\r
- // CAN'T DO THIS HERE -- BRANCH FROM RESET VECTOR IS RELATIVE AND REMAINS IN REMAPPED NOR\r
- //MmioOr32 (0x10001000 ,BIT8) //EB_SP810_CTRL_BASE\r
-\r
- // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r
- mrc p15, 0, r0, c1, c0, 2\r
- orr r0, r0, #0x00f00000 // Enable VFP access (V* instructions)\r
- mcr p15, 0, r0, c1, c0, 2\r
- mov r0, #0x40000000 // Set EN bit in FPEXC\r
- mcr p10,#0x7,r0,c8,c0,#0 // msr FPEXC,r0 in ARM assembly\r
- \r
- // Set CPU vectors to 0 (which is currently flash)\r
- LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base\r
- mcr p15, 0, r0, c12, c0, 0\r
- isb // Sync changes to control registers\r
-\r
- //\r
- // Set stack based on PCD values. Need to do it this way to make C code work \r
- // when it runs from FLASH. \r
- // \r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2 \r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3 \r
- add r4, r2, r3\r
- mov r13, r4\r
- \r
- LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1 \r
- LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0 \r
-\r
- // move sec startup address into a data register\r
- // ensure we're jumping to FV version of the code (not boot remapped alias)\r
- ldr r4, StartupAddr\r
-\r
- // jump to SEC C code\r
- blx r4\r
- \r
- // Call C entry point\r
- // THIS DOESN'T WORK, WE NEED A LONG JUMP\r
- \r
- // blx CEntryPoint \r
-\r
-ShouldNeverGetHere\r
- // _CEntryPoint should never return \r
- b ShouldNeverGetHere\r
- \r
- END\r
-\r
-\r
+++ /dev/null
-/** @file\r
- C Entry point for the SEC. First C code after the reset vector.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
- \r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <PiPei.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/PrePiLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/IoLib.h>\r
-#include <Library/ArmLib.h>\r
-#include <Library/PeCoffGetEntryPointLib.h>\r
-#include <Library/DebugAgentLib.h>\r
-\r
-#include <Ppi/GuidedSectionExtraction.h>\r
-#include <Guid/LzmaDecompress.h>\r
-\r
-#include <ArmEb/ArmEb.h>\r
-\r
-#include "LzmaDecompress.h"\r
-\r
-VOID\r
-EFIAPI \r
-_ModuleEntryPoint(\r
- VOID\r
- );\r
-\r
-CHAR8 *\r
-DeCygwinPathIfNeeded (\r
- IN CHAR8 *Name\r
- );\r
-\r
-RETURN_STATUS\r
-EFIAPI\r
-SerialPortInitialize (\r
- VOID\r
- );\r
- \r
- \r
-VOID\r
-UartInit (\r
- VOID\r
- )\r
-{\r
- // SEC phase needs to run library constructors by hand.\r
- // This assumes we are linked agains the SerialLib\r
- // In non SEC modules the init call is in autogenerated code.\r
- SerialPortInitialize ();\r
-}\r
-\r
-VOID\r
-TimerInit (\r
- VOID\r
- )\r
-{\r
- // configure SP810 to use 1MHz clock and disable\r
- MmioAndThenOr32 (EB_SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER2_EN, SP810_SYS_CTRL_TIMER2_TIMCLK);\r
- // Enable\r
- MmioOr32 (EB_SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER2_EN);\r
-\r
- // configure timer 2 for one shot operation, 32 bits, no prescaler, and interrupt disabled\r
- MmioOr32 (EB_SP804_TIMER2_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_ONESHOT | SP804_TIMER_CTRL_32BIT | SP804_PRESCALE_DIV_1);\r
-\r
- // preload the timer count register\r
- MmioWrite32 (EB_SP804_TIMER2_BASE + SP804_TIMER_LOAD_REG, 1);\r
-\r
- // enable the timer\r
- MmioOr32 (EB_SP804_TIMER2_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_ENABLE);\r
-}\r
-\r
-\r
-VOID\r
-InitCache (\r
- IN UINT32 MemoryBase,\r
- IN UINT32 MemoryLength\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-ExtractGuidedSectionLibConstructor (\r
- VOID\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-LzmaDecompressLibConstructor (\r
- VOID\r
- );\r
-\r
-\r
-VOID\r
-CEntryPoint (\r
- IN VOID *MemoryBase,\r
- IN UINTN MemorySize,\r
- IN VOID *StackBase,\r
- IN UINTN StackSize\r
- )\r
-{\r
- VOID *HobBase;\r
-\r
- // HOB list is at bottom of stack area\r
- // Stack grows from top-to-bottom towards HOB list\r
- HobBase = (VOID *)StackBase;\r
- CreateHobList (MemoryBase, MemorySize, HobBase, StackBase);\r
-\r
- // Turn off remapping NOR to 0. We can will now see DRAM in low memory\r
- MmioOr32 (0x10001000 ,BIT8); //EB_SP810_CTRL_BASE\r
-\r
- // Enable program flow prediction, if supported.\r
- ArmEnableBranchPrediction ();\r
-\r
- // Initialize CPU cache\r
- InitCache ((UINT32)MemoryBase, (UINT32)MemorySize);\r
-\r
- // Add memory allocation hob for relocated FD\r
- BuildMemoryAllocationHob (FixedPcdGet32(PcdEmbeddedFdBaseAddress), FixedPcdGet32(PcdEmbeddedFdSize), EfiBootServicesData);\r
-\r
- // Add the FVs to the hob list\r
- BuildFvHob (PcdGet32(PcdFlashFvMainBase), PcdGet32(PcdFlashFvMainSize));\r
-\r
- // Start talking\r
- UartInit ();\r
-\r
- InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC, NULL, NULL);\r
- SaveAndSetDebugTimerInterrupt (TRUE);\r
-\r
- DEBUG ((EFI_D_ERROR, "UART Enabled\n"));\r
-\r
- // Start up a free running timer so that the timer lib will work\r
- TimerInit ();\r
-\r
- // SEC phase needs to run library constructors by hand.\r
- ExtractGuidedSectionLibConstructor ();\r
- LzmaDecompressLibConstructor ();\r
-\r
- // Build HOBs to pass up our version of stuff the DXE Core needs to save space\r
- BuildPeCoffLoaderHob ();\r
- BuildExtractSectionHob (\r
- &gLzmaCustomDecompressGuid,\r
- LzmaGuidedSectionGetInfo,\r
- LzmaGuidedSectionExtraction\r
- );\r
-\r
- // Assume the FV that contains the SEC (our code) also contains a compressed FV.\r
- DecompressFirstFv ();\r
-\r
- // Load the DXE Core and transfer control to it\r
- LoadDxeCoreFromFv (NULL, 0);\r
- \r
- // DXE Core should always load and never return\r
- ASSERT (FALSE);\r
-}\r
-\r
+++ /dev/null
-
-#/** @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 = ArmEBSec
- FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
-
-
-[Sources.ARM]
- ModuleEntryPoint.S | GCC
- ModuleEntryPoint.asm | RVCT
-
-[Sources.ARM]
- Sec.c
- Cache.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
- ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEbPkg.dec
-
-
-[LibraryClasses]
- BaseLib
- DebugLib
- ArmLib
- IoLib
- ExtractGuidedSectionLib
- LzmaDecompressLib
- PeCoffGetEntryPointLib
- DebugAgentLib
-
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
-
-[FixedPcd]
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
- gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress
- gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize
- gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase
- gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize
- gEmbeddedTokenSpaceGuid.PcdPrePiStackSize
- gEmbeddedTokenSpaceGuid.PcdPrePiStackBase
- gEmbeddedTokenSpaceGuid.PcdMemoryBase
- gEmbeddedTokenSpaceGuid.PcdMemorySize
-
-
- gArmTokenSpaceGuid.PcdCpuVectorBaseAddress
-
-