From 4883513061c7bbcb805cd310b82ab6abb546b1aa Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Fri, 1 Jul 2011 11:45:32 +0000 Subject: ArmPlatformPkg/PlatformPei: Generate a library from the PEI Module In the aim to reuse the Platform Pei features in a PrePi module (use to skip the PEI Core), this module has been divided into two files: - PlatformPeiLib: declare the platform HOBs - PlatformPeim: PEIM wrapper for the library git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11951 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/PlatformPei/PlatformPei.c | 97 --------------------------- ArmPlatformPkg/PlatformPei/PlatformPei.inf | 62 ----------------- ArmPlatformPkg/PlatformPei/PlatformPeiLib.c | 35 ++++++++++ ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf | 53 +++++++++++++++ ArmPlatformPkg/PlatformPei/PlatformPeim.c | 95 ++++++++++++++++++++++++++ ArmPlatformPkg/PlatformPei/PlatformPeim.inf | 63 +++++++++++++++++ 6 files changed, 246 insertions(+), 159 deletions(-) delete mode 100644 ArmPlatformPkg/PlatformPei/PlatformPei.c delete mode 100644 ArmPlatformPkg/PlatformPei/PlatformPei.inf create mode 100755 ArmPlatformPkg/PlatformPei/PlatformPeiLib.c create mode 100755 ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf create mode 100755 ArmPlatformPkg/PlatformPei/PlatformPeim.c create mode 100755 ArmPlatformPkg/PlatformPei/PlatformPeim.inf diff --git a/ArmPlatformPkg/PlatformPei/PlatformPei.c b/ArmPlatformPkg/PlatformPei/PlatformPei.c deleted file mode 100644 index 3ccbbfd2d7..0000000000 --- a/ArmPlatformPkg/PlatformPei/PlatformPei.c +++ /dev/null @@ -1,97 +0,0 @@ -/** @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. -* -**/ - -// -// The package level header files this module uses -// -#include -// -// The protocols, PPI and GUID defintions for this module -// -#include -#include -// -// The Library classes this module consumes -// -#include -#include -#include -#include -#include - - -// -// Module globals -// -EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = { - (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), - &gEfiPeiMasterBootModePpiGuid, - NULL -}; - -EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = { - (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), - &gEfiPeiBootInRecoveryModePpiGuid, - NULL -}; - -EFI_STATUS -EFIAPI -InitializePlatformPeim ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -/*++ - -Routine Description: - - - -Arguments: - - FileHandle - Handle of the file being invoked. - PeiServices - Describes the list of possible PEI Services. - -Returns: - - Status - EFI_SUCCESS if the boot mode could be set - ---*/ -{ - EFI_STATUS Status; - UINTN BootMode; - - DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n")); - - // Initialize the platform specific controllers - ArmPlatformNormalInitialize (); - - BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize)); - - BuildFvHob (PcdGet32(PcdNormalFvBaseAddress), PcdGet32(PcdNormalFvSize)); - - BootMode = ArmPlatformGetBootMode (); - Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode); - ASSERT_EFI_ERROR (Status); - - Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode); - ASSERT_EFI_ERROR (Status); - - if (BootMode == BOOT_IN_RECOVERY_MODE) { - Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode); - ASSERT_EFI_ERROR (Status); - } - - return Status; -} diff --git a/ArmPlatformPkg/PlatformPei/PlatformPei.inf b/ArmPlatformPkg/PlatformPei/PlatformPei.inf deleted file mode 100644 index bbc5f1a028..0000000000 --- a/ArmPlatformPkg/PlatformPei/PlatformPei.inf +++ /dev/null @@ -1,62 +0,0 @@ -#/** @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. -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PlatformPei - FILE_GUID = 2ad0fc59-2314-4bf3-8633-13fa22a624a0 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - - ENTRY_POINT = InitializePlatformPeim - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - PlatformPei.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - -[LibraryClasses] - PeimEntryPoint - DebugLib - HobLib - ArmPlatformLib - -[Ppis] - gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED - gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED - -[FixedPcd] - gArmTokenSpaceGuid.PcdNormalFdBaseAddress - gArmTokenSpaceGuid.PcdNormalFdSize - - gArmTokenSpaceGuid.PcdNormalFvBaseAddress - gArmTokenSpaceGuid.PcdNormalFvSize - - gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize - gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize - -[depex] - TRUE - diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeiLib.c b/ArmPlatformPkg/PlatformPei/PlatformPeiLib.c new file mode 100755 index 0000000000..d4faa6258e --- /dev/null +++ b/ArmPlatformPkg/PlatformPei/PlatformPeiLib.c @@ -0,0 +1,35 @@ +/** @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 + +#include +#include +#include + +EFI_STATUS +EFIAPI +PlatformPeim ( + VOID + ) +{ + // Initialize the platform specific controllers + ArmPlatformNormalInitialize (); + + BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize)); + + BuildFvHob (PcdGet32(PcdNormalFvBaseAddress), PcdGet32(PcdNormalFvSize)); + + return EFI_SUCCESS; +} diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf b/ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf new file mode 100755 index 0000000000..74fdcc8c42 --- /dev/null +++ b/ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf @@ -0,0 +1,53 @@ +#/** @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. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmPlatformPeiLib + FILE_GUID = 49d37060-70b5-11e0-aa2d-0002a5d5c51b + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + LIBRARY_CLASS = PlatformPeiLib + +[Sources] + PlatformPeiLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + DebugLib + HobLib + ArmPlatformLib + +[Ppis] + gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED + gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED + +[FixedPcd] + gArmTokenSpaceGuid.PcdNormalFdBaseAddress + gArmTokenSpaceGuid.PcdNormalFdSize + + gArmTokenSpaceGuid.PcdNormalFvBaseAddress + gArmTokenSpaceGuid.PcdNormalFvSize + + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize + +[depex] + TRUE diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeim.c b/ArmPlatformPkg/PlatformPei/PlatformPeim.c new file mode 100755 index 0000000000..9599a7a747 --- /dev/null +++ b/ArmPlatformPkg/PlatformPei/PlatformPeim.c @@ -0,0 +1,95 @@ +/** @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 + +// +// The protocols, PPI and GUID defintions for this module +// +#include +#include +// +// The Library classes this module consumes +// +#include +#include +#include +#include + +EFI_STATUS +EFIAPI +InitializePlatformPeim ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ); + +// +// Module globals +// +EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiMasterBootModePpiGuid, + NULL +}; + +EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiBootInRecoveryModePpiGuid, + NULL +}; + +/*++ + +Routine Description: + + + +Arguments: + + FileHandle - Handle of the file being invoked. + PeiServices - Describes the list of possible PEI Services. + +Returns: + + Status - EFI_SUCCESS if the boot mode could be set + +--*/ +EFI_STATUS +EFIAPI +InitializePlatformPeim ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + UINTN BootMode; + + DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n")); + + PlatformPeim (); + + BootMode = ArmPlatformGetBootMode (); + Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode); + ASSERT_EFI_ERROR (Status); + + Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode); + ASSERT_EFI_ERROR (Status); + + if (BootMode == BOOT_IN_RECOVERY_MODE) { + Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode); + ASSERT_EFI_ERROR (Status); + } + + return Status; +} diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeim.inf b/ArmPlatformPkg/PlatformPei/PlatformPeim.inf new file mode 100755 index 0000000000..2a7c09389a --- /dev/null +++ b/ArmPlatformPkg/PlatformPei/PlatformPeim.inf @@ -0,0 +1,63 @@ +#/** @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. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PlatformPei + FILE_GUID = 2ad0fc59-2314-4bf3-8633-13fa22a624a0 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + + ENTRY_POINT = InitializePlatformPeim + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM +# + +[Sources] + PlatformPeim.c + PlatformPeiLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + PeimEntryPoint + DebugLib + HobLib + ArmPlatformLib + +[Ppis] + gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED + gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED + +[FixedPcd] + gArmTokenSpaceGuid.PcdNormalFdBaseAddress + gArmTokenSpaceGuid.PcdNormalFdSize + + gArmTokenSpaceGuid.PcdNormalFvBaseAddress + gArmTokenSpaceGuid.PcdNormalFvSize + + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize + +[Depex] + TRUE + -- cgit v1.2.3