/** @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
+* 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
//\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
IN CONST EFI_PEI_SERVICES **PeiServices\r
);\r
\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformPeim (\r
+ VOID\r
+ );\r
+\r
//\r
// Module globals\r
//\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
- \r
+\r
\r
Arguments:\r
\r
FileHandle - Handle of the file being invoked.\r
PeiServices - Describes the list of possible PEI Services.\r
- \r
+\r
Returns:\r
\r
Status - EFI_SUCCESS if the boot mode could be set\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
+ DEBUG ((EFI_D_LOAD | EFI_D_INFO, "Platform PEIM Loaded\n"));\r
\r
PlatformPeim ();\r
- \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