ArmPkg/Drivers/PL390Gic/PL390GicSecLib.inf
ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
+
+ ArmPkg/Application/LinuxLoader/LinuxAtagLoader.inf
+ ArmPkg/Application/LinuxLoader/LinuxFdtLoader.inf
#\r
gVariableRuntimeDxeFileGuid = { 0xcbd2e4d5, 0x7068, 0x4ff5, { 0xb4, 0x62, 0x98, 0x22, 0xb4, 0xad, 0x8d, 0x60 } }\r
\r
+ ## Include/Guid/ArmGlobalVariableHob.h\r
+ gArmGlobalVariableGuid = { 0xc3253c90, 0xa24f, 0x4599, { 0xa6, 0x64, 0x1f, 0x88, 0x13, 0x77, 0x8f, 0xc9} }\r
+\r
+[Ppis]\r
+ ## Include/Ppi/ArmGlobalVariable.h\r
+ gArmGlobalVariablePpiGuid = { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 0xcd, 0x92, 0x53, 0xe2, 0xe7} }\r
+\r
[PcdsFeatureFlag.common]\r
# Set this PCD to TRUE to map NORFlash at 0x0. FALSE means the DRAM is mapped at 0x0.\r
gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping|FALSE|BOOLEAN|0x00000012\r
gArmPlatformTokenSpaceGuid.PcdPeiServicePtrGlobalOffset|0x0|UINT32|0x00000017\r
gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset|0x0|UINT32|0x00000018\r
\r
+ # Size to reserve in the primary core stack for SEC Global Variables\r
+ gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize|0x0|UINT32|0x00000031\r
+\r
#\r
# ARM Primecells\r
#\r
--- /dev/null
+/** @file
+*
+* Copyright (c) 2011, ARM Limited. All rights reserved.
+*
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#ifndef __ARM_GLOBAL_VARIABLE_GUID_H__
+#define __ARM_GLOBAL_VARIABLE_GUID_H__
+
+#define ARM_HOB_GLOBAL_VARIABLE_GUID \
+ { 0xc3253c90, 0xa24f, 0x4599, { 0xa6, 0x64, 0x1f, 0x88, 0x13, 0x77, 0x8f, 0xc9} };
+
+extern EFI_GUID gArmGlobalVariableGuid;
+
+///
+/// Describes all memory ranges used during the HOB producer
+/// phase that exist outside the HOB list. This HOB type
+/// describes how memory is used, not the physical attributes of memory.
+///
+typedef struct {
+ ///
+ /// The Guid HOB header. Header.HobType = EFI_HOB_TYPE_GUID_EXTENSION
+ /// and Header.Name = gArmGlobalVariableGuid
+ ///
+ EFI_HOB_GUID_TYPE Header;
+
+ ///
+ /// The base address of memory allocated by this HOB. Type
+ /// EFI_PHYSICAL_ADDRESS is defined in AllocatePages() in the UEFI 2.0
+ /// specification.
+ ///
+ EFI_PHYSICAL_ADDRESS GlobalVariableBase;
+
+ ///
+ /// The length in bytes of memory allocated by this HOB.
+ ///
+ UINT32 GlobalVariableSize;
+} ARM_HOB_GLOBAL_VARIABLE;
+
+#endif
--- /dev/null
+/** @file
+*
+* Copyright (c) 2011, ARM Limited. All rights reserved.
+*
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#ifndef __ARM_PLATFORM_GLOBAL_VARIABLE_LIB_H_
+#define __ARM_PLATFORM_GLOBAL_VARIABLE_LIB_H_
+
+VOID
+ArmPlatformGetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ );
+
+VOID
+ArmPlatformSetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ );
+
+#endif
+
--- /dev/null
+/** @file\r
+*\r
+* Copyright (c) 2011, ARM Limited. All rights reserved.\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
+#ifndef __ARM_GLOBAL_VARIABLE_H__\r
+#define __ARM_GLOBAL_VARIABLE_H__\r
+\r
+#define ARM_GLOBAL_VARIABLE_PPI_GUID \\r
+ { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 0xcd, 0x92, 0x53, 0xe2, 0xe7} }\r
+\r
+\r
+/**\r
+ This service of the EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into\r
+ permanent memory.\r
+\r
+ @param PeiServices Pointer to the PEI Services Table.\r
+ @param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the\r
+ Temporary RAM contents.\r
+ @param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the\r
+ Temporary RAM contents.\r
+ @param CopySize Amount of memory to migrate from temporary to permanent memory.\r
+\r
+ @retval EFI_SUCCESS The data was successfully returned.\r
+ @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when\r
+ TemporaryMemoryBase > PermanentMemoryBase.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * ARM_GLOBAL_VARIABLE_GET_MEMORY) (\r
+ OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase\r
+);\r
+\r
+///\r
+/// This service abstracts the ability to migrate contents of the platform early memory store.\r
+/// Note: The name EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI is different from the current PI 1.2 spec.\r
+/// This PPI was optional.\r
+///\r
+typedef struct {\r
+ ARM_GLOBAL_VARIABLE_GET_MEMORY GetGlobalVariableMemory;\r
+} ARM_GLOBAL_VARIABLE_PPI;\r
+\r
+extern EFI_GUID gArmGlobalVariablePpiGuid;\r
+\r
+#endif\r
--- /dev/null
+/** @file
+*
+* Copyright (c) 2011, ARM Limited. All rights reserved.
+*
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include <PiDxe.h>
+#include <Library/ArmPlatformGlobalVariableLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+
+#include <Guid/ArmGlobalVariableHob.h>
+
+UINTN mGlobalVariableBase = 0;
+
+RETURN_STATUS
+EFIAPI
+ArmPlatformGlobalVariableConstructor (
+ VOID
+ )
+{
+ ARM_HOB_GLOBAL_VARIABLE *Hob;
+
+ Hob = GetFirstGuidHob (&gArmGlobalVariableGuid);
+ ASSERT (Hob != NULL);
+
+ mGlobalVariableBase = Hob->GlobalVariableBase;
+
+ return EFI_SUCCESS;
+}
+
+VOID
+ArmPlatformGetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ )
+{
+ if (mGlobalVariableBase == 0) {
+ ArmPlatformGlobalVariableConstructor ();
+ }
+
+ CopyMem (Variable, (VOID*)(mGlobalVariableBase + VariableOffset), VariableSize);
+}
+
+VOID
+ArmPlatformSetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ )
+{
+ if (mGlobalVariableBase == 0) {
+ ArmPlatformGlobalVariableConstructor ();
+ }
+
+ CopyMem ((VOID*)(mGlobalVariableBase + VariableOffset), Variable, VariableSize);
+}
+
--- /dev/null
+#/** @file
+# Timer library implementation
+#
+#
+# Copyright (c) 2011, ARM Ltd. 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 = DxeArmPlatformGlobalVariableLib
+ FILE_GUID = 53fa3cc3-23b7-4ec2-9bfa-30257d7e1135
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ArmPlatformGlobalVariableLib
+
+ CONSTRUCTOR = ArmPlatformGlobalVariableConstructor
+
+[Sources.common]
+ DxeArmPlatformGlobalVariableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ArmPlatformPkg/ArmPlatformPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ HobLib
+
+[Guids]
+ gArmGlobalVariableGuid
+
+[FixedPcd]
+ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
+
--- /dev/null
+/** @file
+*
+* Copyright (c) 2011, ARM Limited. All rights reserved.
+*
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include <Uefi.h>
+#include <Library/ArmPlatformGlobalVariableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PcdLib.h>
+
+//TODO: RemoveMe
+//#include <Library/DebugLib.h>
+
+// Declared by ArmPlatformPkg/PrePi Module
+extern UINTN mGlobalVariableBase;
+
+VOID
+ArmPlatformGetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ )
+{
+ UINTN GlobalVariableBase;
+
+ GlobalVariableBase = PcdGet32 (PcdCPUCoresStackBase) + PcdGet32 (PcdCPUCorePrimaryStackSize) - PcdGet32 (PcdPeiGlobalVariableSize) + VariableOffset;
+
+ if (VariableSize == 4) {
+ *(UINT32*)Variable = ReadUnaligned32 ((CONST UINT32*)(GlobalVariableBase + VariableOffset));
+ } else if (VariableSize == 8) {
+ *(UINT32*)Variable = ReadUnaligned64 ((CONST UINT64*)(GlobalVariableBase + VariableOffset));
+ } else {
+ CopyMem (Variable, (VOID*)(GlobalVariableBase + VariableOffset), VariableSize);
+ }
+
+ //DEBUG((EFI_D_ERROR,"++ GET Offset[%d] = 0x%x\n",VariableOffset,*(UINTN*)Variable));
+}
+
+VOID
+ArmPlatformSetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ )
+{
+ UINTN GlobalVariableBase;
+
+ GlobalVariableBase = PcdGet32 (PcdCPUCoresStackBase) + PcdGet32 (PcdCPUCorePrimaryStackSize) - PcdGet32 (PcdPeiGlobalVariableSize) + VariableOffset;
+
+ if (VariableSize == 4) {
+ WriteUnaligned32 ((UINT32*)(GlobalVariableBase + VariableOffset), *(UINT32*)Variable);
+ } else if (VariableSize == 8) {
+ WriteUnaligned64 ((UINT64*)(GlobalVariableBase + VariableOffset), *(UINT64*)Variable);
+ } else {
+ CopyMem ((VOID*)(GlobalVariableBase + VariableOffset), Variable, VariableSize);
+ }
+
+ //DEBUG((EFI_D_ERROR,"++ SET Offset[%d] = 0x%x\n",VariableOffset,*(UINTN*)Variable));
+}
+
--- /dev/null
+#/** @file
+# Timer library implementation
+#
+#
+# Copyright (c) 2011, ARM Ltd. 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 = PeiArmPlatformGlobalVariableLib
+ FILE_GUID = 3e03daf2-b7b4-45f7-80b2-12aba043391f
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ArmPlatformGlobalVariableLib
+
+[Sources.common]
+ PeiArmPlatformGlobalVariableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ArmPlatformPkg/ArmPlatformPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+
+[FixedPcd]
+ gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
+ gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
+ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
+
--- /dev/null
+/** @file
+*
+* Copyright (c) 2011, ARM Limited. All rights reserved.
+*
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include <Uefi.h>
+#include <Library/ArmPlatformGlobalVariableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PcdLib.h>
+
+#define IS_XIP() ((PcdGet32 (PcdFdBaseAddress) > (PcdGet32 (PcdSystemMemoryBase) + PcdGet32 (PcdSystemMemorySize))) || \
+ ((PcdGet32 (PcdFdBaseAddress) + PcdGet32 (PcdFdSize)) < PcdGet32 (PcdSystemMemoryBase)))
+
+// Declared by ArmPlatformPkg/PrePi Module
+extern UINTN mGlobalVariableBase;
+
+VOID
+ArmPlatformGetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ )
+{
+ UINTN GlobalVariableBase;
+
+ if (IS_XIP()) {
+ // In Case of XIP, we expect the Primary Stack at the top of the System Memory
+ GlobalVariableBase = PcdGet32 (PcdSystemMemoryBase) + PcdGet32 (PcdSystemMemorySize) - PcdGet32 (PcdPeiGlobalVariableSize);
+ } else {
+ GlobalVariableBase = mGlobalVariableBase;
+ }
+
+ if (VariableSize == 4) {
+ *(UINT32*)Variable = ReadUnaligned32 ((CONST UINT32*)(GlobalVariableBase + VariableOffset));
+ } else if (VariableSize == 8) {
+ *(UINT32*)Variable = ReadUnaligned64 ((CONST UINT64*)(GlobalVariableBase + VariableOffset));
+ } else {
+ CopyMem (Variable, (VOID*)(GlobalVariableBase + VariableOffset), VariableSize);
+ }
+}
+
+VOID
+ArmPlatformSetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ )
+{
+ UINTN GlobalVariableBase;
+
+ if (IS_XIP()) {
+ // In Case of XIP, we expect the Primary Stack at the top of the System Memory
+ GlobalVariableBase = PcdGet32 (PcdSystemMemoryBase) + PcdGet32 (PcdSystemMemorySize) - PcdGet32 (PcdPeiGlobalVariableSize);
+ } else {
+ GlobalVariableBase = mGlobalVariableBase;
+ }
+
+ if (VariableSize == 4) {
+ WriteUnaligned32 ((UINT32*)(GlobalVariableBase + VariableOffset), *(UINT32*)Variable);
+ } else if (VariableSize == 8) {
+ WriteUnaligned64 ((UINT64*)(GlobalVariableBase + VariableOffset), *(UINT64*)Variable);
+ } else {
+ CopyMem ((VOID*)(GlobalVariableBase + VariableOffset), Variable, VariableSize);
+ }
+}
+
--- /dev/null
+#/** @file
+# Timer library implementation
+#
+#
+# Copyright (c) 2011, ARM Ltd. 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 = PrePiArmPlatformGlobalVariableLib
+ FILE_GUID = 44d59470-e5e6-4811-af00-33bb573a804b
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ArmPlatformGlobalVariableLib
+
+[Sources.common]
+ PrePiArmPlatformGlobalVariableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ArmPlatformPkg/ArmPlatformPkg.dec
+ ArmPkg/ArmPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+
+[FixedPcd]
+ gArmTokenSpaceGuid.PcdFdBaseAddress
+ gArmTokenSpaceGuid.PcdFdSize
+
+ gArmTokenSpaceGuid.PcdSystemMemoryBase
+ gArmTokenSpaceGuid.PcdSystemMemorySize
+
+ gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
+ gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
+ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
+
--- /dev/null
+/** @file
+*
+* Copyright (c) 2011, ARM Limited. All rights reserved.
+*
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include <Uefi.h>
+#include <Library/ArmPlatformGlobalVariableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PcdLib.h>
+
+//TODO: RemoveMe
+//#include <Library/DebugLib.h>
+
+VOID
+ArmPlatformGetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ )
+{
+ UINTN GlobalVariableBase;
+
+ GlobalVariableBase = PcdGet32 (PcdCPUCoresSecStackBase) + PcdGet32 (PcdCPUCoreSecPrimaryStackSize) - PcdGet32 (PcdSecGlobalVariableSize) + VariableOffset;
+
+ if (VariableSize == 4) {
+ *(UINT32*)Variable = ReadUnaligned32 ((CONST UINT32*)(GlobalVariableBase + VariableOffset));
+ } else if (VariableSize == 8) {
+ *(UINT32*)Variable = ReadUnaligned64 ((CONST UINT64*)(GlobalVariableBase + VariableOffset));
+ } else {
+ CopyMem (Variable, (VOID*)(GlobalVariableBase + VariableOffset), VariableSize);
+ }
+
+ //DEBUG((EFI_D_ERROR,"++ GET Offset[%d] = 0x%x\n",VariableOffset,*(UINTN*)Variable));
+}
+
+VOID
+ArmPlatformSetGlobalVariable (
+ IN UINTN VariableOffset,
+ IN UINTN VariableSize,
+ OUT VOID* Variable
+ )
+{
+ UINTN GlobalVariableBase;
+
+ GlobalVariableBase = PcdGet32 (PcdCPUCoresSecStackBase) + PcdGet32 (PcdCPUCoreSecPrimaryStackSize) - PcdGet32 (PcdSecGlobalVariableSize) + VariableOffset;
+
+ if (VariableSize == 4) {
+ WriteUnaligned32 ((UINT32*)(GlobalVariableBase + VariableOffset), *(UINT32*)Variable);
+ } else if (VariableSize == 8) {
+ WriteUnaligned64 ((UINT64*)(GlobalVariableBase + VariableOffset), *(UINT64*)Variable);
+ } else {
+ CopyMem ((VOID*)(GlobalVariableBase + VariableOffset), Variable, VariableSize);
+ }
+
+ //DEBUG((EFI_D_ERROR,"++ SET Offset[%d] = 0x%x\n",VariableOffset,*(UINTN*)Variable));
+}
+
--- /dev/null
+#/** @file
+# Timer library implementation
+#
+#
+# Copyright (c) 2011, ARM Ltd. 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 = SecArmPlatformGlobalVariableLib
+ FILE_GUID = e01f4944-df86-488b-b89b-79e7a53a3a5d
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ArmPlatformGlobalVariableLib
+
+[Sources.common]
+ SecArmPlatformGlobalVariableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ArmPlatformPkg/ArmPlatformPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+
+[FixedPcd]
+ gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase
+ gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize
+ gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize
+
**/\r
\r
#include <PiPei.h>\r
+#include <Library/ArmPlatformGlobalVariableLib.h>\r
#include <Library/PeiServicesTablePointerLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/PcdLib.h>\r
VOID\r
EFIAPI\r
SetPeiServicesTablePointer (\r
- IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer\r
+ IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer\r
)\r
{\r
- UINTN *PeiPtrLoc;\r
ASSERT (PeiServicesTablePointer != NULL);\r
\r
- PeiPtrLoc = (UINTN *)(UINTN)(PcdGet32 (PcdCPUCoresNonSecStackBase) + \r
- (PcdGet32 (PcdCPUCoresNonSecStackSize) / 2) - \r
- PcdGet32 (PcdPeiGlobalVariableSize) +\r
- PcdGet32 (PcdPeiServicePtrGlobalOffset));\r
- *PeiPtrLoc = (UINTN)PeiServicesTablePointer;\r
+ ArmPlatformSetGlobalVariable (PcdGet32 (PcdPeiServicePtrGlobalOffset), sizeof(EFI_PEI_SERVICES **), &PeiServicesTablePointer);\r
}\r
\r
/**\r
@return The pointer to PeiServices.\r
\r
**/\r
-CONST EFI_PEI_SERVICES **\r
+CONST EFI_PEI_SERVICES**\r
EFIAPI\r
GetPeiServicesTablePointer (\r
VOID\r
)\r
{\r
- UINTN *PeiPtrLoc;\r
+ EFI_PEI_SERVICES **PeiServicesTablePointer;\r
\r
- PeiPtrLoc = (UINTN *)(UINTN)(PcdGet32 (PcdCPUCoresNonSecStackBase) + \r
- (PcdGet32 (PcdCPUCoresNonSecStackSize) / 2) - \r
- PcdGet32 (PcdPeiGlobalVariableSize) +\r
- PcdGet32 (PcdPeiServicePtrGlobalOffset));\r
- return (CONST EFI_PEI_SERVICES **)*PeiPtrLoc;\r
+ ArmPlatformGetGlobalVariable (PcdGet32 (PcdPeiServicePtrGlobalOffset), sizeof(EFI_PEI_SERVICES **), &PeiServicesTablePointer);\r
+\r
+ return (CONST EFI_PEI_SERVICES**)PeiServicesTablePointer;\r
}\r
\r
\r
INF_VERSION = 0x00010005\r
BASE_NAME = PeiServicesTablePointerLib\r
FILE_GUID = 1c747f6b-0a58-49ae-8ea3-0327a4fa10e3\r
- MODULE_TYPE = PEIM\r
+ MODULE_TYPE = BASE\r
VERSION_STRING = 1.0\r
LIBRARY_CLASS = PeiServicesTablePointerLib|PEIM PEI_CORE SEC\r
\r
ArmPlatformPkg/ArmPlatformPkg.dec\r
\r
[LibraryClasses]\r
- DebugLib\r
+ ArmPlatformGlobalVariableLib\r
\r
[Pcd]\r
gArmPlatformTokenSpaceGuid.PcdPeiServicePtrGlobalOffset\r
- gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase\r
- gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize\r
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize\r
- \r
+\r
**/\r
\r
#include <PiPei.h>\r
+#include <Library/ArmPlatformGlobalVariableLib.h>\r
#include <Library/PrePiHobListPointerLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/PcdLib.h>\r
VOID\r
)\r
{\r
- return (VOID *)*(UINTN*)(PcdGet32 (PcdCPUCoresNonSecStackBase) +\r
- PcdGet32 (PcdCPUCoresNonSecStackSize) -\r
- PcdGet32 (PcdPeiGlobalVariableSize) +\r
- PcdGet32 (PcdHobListPtrGlobalOffset));\r
+ VOID* HobList;\r
+\r
+ ArmPlatformGetGlobalVariable (PcdGet32 (PcdHobListPtrGlobalOffset), sizeof(VOID*), &HobList);\r
+\r
+ return HobList;\r
}\r
\r
\r
IN VOID *HobList\r
)\r
{\r
- UINTN* HobListPtr;\r
-\r
- HobListPtr = (UINTN*)(PcdGet32 (PcdCPUCoresNonSecStackBase) +\r
- PcdGet32 (PcdCPUCoresNonSecStackSize) -\r
- PcdGet32 (PcdPeiGlobalVariableSize) +\r
- PcdGet32 (PcdHobListPtrGlobalOffset));\r
-\r
- *HobListPtr = (UINTN)HobList;\r
+ ArmPlatformSetGlobalVariable (PcdGet32 (PcdHobListPtrGlobalOffset), sizeof(VOID*), &HobList);\r
\r
return EFI_SUCCESS;\r
}\r
EmbeddedPkg/EmbeddedPkg.dec\r
\r
[LibraryClasses]\r
+ ArmPlatformGlobalVariableLib\r
\r
[FixedPcd.common]\r
gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset\r
- gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase\r
- gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize\r
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize\r
-
\ No newline at end of file
//\r
// The protocols, PPI and GUID defintions for this module\r
//\r
+#include <Ppi/ArmGlobalVariable.h>\r
#include <Ppi/MasterBootMode.h>\r
#include <Ppi/BootInRecoveryMode.h>\r
+#include <Ppi/GuidedSectionExtraction.h>\r
//\r
// The Library classes this module consumes\r
//\r
+#include <Library/ArmPlatformLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/HobLib.h>\r
#include <Library/PeimEntryPoint.h>\r
+#include <Library/PeiServicesLib.h>\r
#include <Library/PcdLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/ArmPlatformLib.h>\r
+\r
+#include <Guid/ArmGlobalVariableHob.h>\r
\r
EFI_STATUS\r
EFIAPI\r
NULL\r
};\r
\r
+VOID\r
+EFIAPI\r
+BuildGlobalVariableHob (\r
+ IN EFI_PHYSICAL_ADDRESS GlobalVariableBase,\r
+ IN UINT32 GlobalVariableSize\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ ARM_HOB_GLOBAL_VARIABLE *Hob;\r
+\r
+ Status = PeiServicesCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof (ARM_HOB_GLOBAL_VARIABLE), (VOID**)&Hob);\r
+ if (!EFI_ERROR(Status)) {\r
+ CopyGuid (&(Hob->Header.Name), &gArmGlobalVariableGuid);\r
+ Hob->GlobalVariableBase = GlobalVariableBase;\r
+ Hob->GlobalVariableSize = GlobalVariableSize;\r
+ }\r
+}\r
+\r
/*++\r
\r
Routine Description:\r
{\r
EFI_STATUS Status;\r
UINTN BootMode;\r
+ ARM_GLOBAL_VARIABLE_PPI *ArmGlobalVariablePpi;\r
+ EFI_PHYSICAL_ADDRESS GlobalVariableBase;\r
\r
DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));\r
\r
PlatformPeim ();\r
\r
+ Status = PeiServicesLocatePpi (&gArmGlobalVariablePpiGuid, 0, NULL, (VOID**)&ArmGlobalVariablePpi);\r
+ if (!EFI_ERROR(Status)) {\r
+ Status = ArmGlobalVariablePpi->GetGlobalVariableMemory (&GlobalVariableBase);\r
+\r
+ if (!EFI_ERROR(Status)) {\r
+ // Declare the Global Variable HOB\r
+ BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize));\r
+ }\r
+ }\r
+\r
BootMode = ArmPlatformGetBootMode ();\r
Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);\r
ASSERT_EFI_ERROR (Status);\r
[Ppis]\r
gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED\r
gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED\r
+ gArmGlobalVariablePpiGuid\r
+\r
+[Guids]\r
+ gArmGlobalVariableGuid\r
\r
[FixedPcd]\r
gArmTokenSpaceGuid.PcdFdBaseAddress\r
gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize\r
\r
+ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize\r
+ \r
[Depex]\r
TRUE\r
\r
\r
#include "PrePeiCore.h"\r
\r
-extern EFI_PEI_PPI_DESCRIPTOR *gSecPpiTable;\r
-\r
/*\r
* This is the main function for secondary cores. They loop around until a non Null value is written to\r
* SYS_FLAGS register.The SYS_FLAGS register is platform specific.\r
\r
#include "PrePeiCore.h"\r
\r
-extern EFI_PEI_PPI_DESCRIPTOR *gSecPpiTable;\r
-\r
VOID\r
EFIAPI\r
SecondaryMain (\r
*\r
**/\r
\r
-#include <Library/IoLib.h>\r
#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
#include <Library/DebugAgentLib.h>\r
#include <Library/PrintLib.h>\r
#include <Library/ArmLib.h>\r
#include <Library/SerialPortLib.h>\r
+\r
+#include <Ppi/ArmGlobalVariable.h>\r
#include <Chipset/ArmV7.h>\r
\r
#include "PrePeiCore.h"\r
\r
EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = {SecTemporaryRamSupport};\r
+ARM_GLOBAL_VARIABLE_PPI mGlobalVariablePpi = { PrePeiCoreGetGlobalVariableMemory };\r
\r
-EFI_PEI_PPI_DESCRIPTOR gSecPpiTable[] = {\r
+EFI_PEI_PPI_DESCRIPTOR gCommonPpiTable[] = {\r
{\r
- EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
+ EFI_PEI_PPI_DESCRIPTOR_PPI,\r
&gEfiTemporaryRamSupportPpiGuid,\r
&mSecTemporaryRamSupportPpi\r
+ },\r
+ {\r
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
+ &gArmGlobalVariablePpiGuid,\r
+ &mGlobalVariablePpi\r
}\r
};\r
\r
\r
SecSwitchStack((UINTN)(PermanentMemoryBase - TemporaryMemoryBase));\r
\r
+EFI_STATUS\r
+PrePeiCoreGetGlobalVariableMemory (\r
+ OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase\r
+ )\r
+{\r
+ ASSERT (GlobalVariableBase != NULL);\r
+\r
+ *GlobalVariableBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) +\r
+ (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) -\r
+ (UINTN)PcdGet32 (PcdPeiGlobalVariableSize);\r
+\r
return EFI_SUCCESS;\r
}\r
\r
#ifndef __PREPEICORE_H_\r
#define __PREPEICORE_H_\r
\r
+#include <Library/ArmLib.h>\r
+#include <Library/ArmPlatformLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
#include <Library/DebugLib.h>\r
+#include <Library/IoLib.h>\r
#include <Library/PcdLib.h>\r
\r
#include <PiPei.h>\r
IN UINTN CopySize\r
);\r
\r
+EFI_STATUS\r
+PrePeiCoreGetGlobalVariableMemory (\r
+ OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase\r
+ );\r
+\r
VOID\r
SecSwitchStack (\r
INTN StackDelta\r
\r
[Ppis]\r
gEfiTemporaryRamSupportPpiGuid\r
+ gArmGlobalVariablePpiGuid\r
\r
[FeaturePcd]\r
gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores\r
\r
[Ppis]\r
gEfiTemporaryRamSupportPpiGuid\r
+ gArmGlobalVariablePpiGuid\r
\r
[FeaturePcd]\r
gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores\r
PlatformPeiLib\r
MemoryInitPeiLib\r
\r
+[Guids]\r
+ gArmGlobalVariableGuid\r
+\r
[FeaturePcd] \r
gEmbeddedTokenSpaceGuid.PcdCacheEnable\r
gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob\r
gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize\r
\r
gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize\r
- gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset\r
\r
gArmTokenSpaceGuid.PcdGicDistributorBase\r
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase\r
PlatformPeiLib\r
MemoryInitPeiLib\r
\r
+[Guids]\r
+ gArmGlobalVariableGuid\r
+\r
[FeaturePcd] \r
gEmbeddedTokenSpaceGuid.PcdCacheEnable\r
gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob\r
gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize\r
\r
gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize\r
- gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset\r
\r
gArmTokenSpaceGuid.PcdSystemMemoryBase\r
gArmTokenSpaceGuid.PcdSystemMemorySize\r
\r
#include <Ppi/GuidedSectionExtraction.h>\r
#include <Guid/LzmaDecompress.h>\r
+#include <Guid/ArmGlobalVariableHob.h>\r
\r
#include "PrePi.h"\r
#include "LzmaDecompress.h"\r
\r
+#define IS_XIP() ((FixedPcdGet32 (PcdFdBaseAddress) > (FixedPcdGet32 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize))) || \\r
+ ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet32 (PcdSystemMemoryBase)))\r
+\r
+// Not used when PrePi in run in XIP mode\r
+UINTN mGlobalVariableBase = 0;\r
+\r
VOID\r
PrePiCommonExceptionEntry (\r
IN UINT32 Entry,\r
VOID\r
);\r
\r
+VOID\r
+EFIAPI\r
+BuildGlobalVariableHob (\r
+ IN EFI_PHYSICAL_ADDRESS GlobalVariableBase,\r
+ IN UINT32 GlobalVariableSize\r
+ )\r
+{\r
+ ARM_HOB_GLOBAL_VARIABLE *Hob;\r
+\r
+ Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof (ARM_HOB_GLOBAL_VARIABLE));\r
+ ASSERT(Hob != NULL);\r
+\r
+ CopyGuid (&(Hob->Header.Name), &gArmGlobalVariableGuid);\r
+ Hob->GlobalVariableBase = GlobalVariableBase;\r
+ Hob->GlobalVariableSize = GlobalVariableSize;\r
+}\r
+\r
VOID\r
PrePiMain (\r
IN UINTN UefiMemoryBase,\r
UINTN CharCount;\r
UINTN StacksSize;\r
\r
+ // If ensure the FD is either part of the System Memory or totally outside of the System Memory (XIP)\r
+ ASSERT (IS_XIP() || \r
+ ((FixedPcdGet32 (PcdFdBaseAddress) >= FixedPcdGet32 (PcdSystemMemoryBase)) &&\r
+ ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (FixedPcdGet32 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize)))));\r
+\r
// Enable program flow prediction, if supported.\r
ArmEnableBranchPrediction ();\r
\r
// Initialize the Debug Agent for Source Level Debugging\r
InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL);\r
SaveAndSetDebugTimerInterrupt (TRUE);\r
+\r
+ if (!IS_XIP()) {\r
+ mGlobalVariableBase = GlobalVariableBase;\r
+ }\r
\r
// Declare the PI/UEFI memory region\r
HobList = HobConstructor (\r
StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize) + (FixedPcdGet32(PcdClusterCount) * 4 * FixedPcdGet32(PcdCPUCoreSecondaryStackSize));\r
BuildStackHob (StacksBase, StacksSize);\r
\r
+ // Declare the Global Variable HOB\r
+ BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize));\r
+\r
// Set the Boot Mode\r
SetBootMode (ArmPlatformGetBootMode ());\r
\r
gArmTokenSpaceGuid.PcdGicDistributorBase
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
+
+ gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize
\r
[LibraryClasses.common.SEC]\r
ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf\r
+ ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf\r
\r
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r