diff options
author | Guo Mang <mang.guo@intel.com> | 2016-12-23 13:29:05 +0800 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2017-05-09 13:02:58 +0800 |
commit | 9df74a78f9e89ae0fba4ea87b84bb66568a3ae24 (patch) | |
tree | ca6aa8c642d4a88106b27c483b9d05a49477fbce /Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c | |
parent | 63b4452feae23b01db9996f3e547a5300fb884a3 (diff) | |
download | edk2-platforms-9df74a78f9e89ae0fba4ea87b84bb66568a3ae24.tar.xz |
BroxtonPlatformPkg: Add Board/MinnowBoard3/BoardInitPostMem
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c')
-rw-r--r-- | Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c new file mode 100644 index 0000000000..0291d150f4 --- /dev/null +++ b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c @@ -0,0 +1,122 @@ +/** @file
+ Board Init driver.
+
+ Copyright (c) 2010 - 2016, 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.
+
+**/
+
+#include <PiPei.h>
+#include <Library/PeiServicesLib.h>
+#include <Library/PcdLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Guid/PlatformInfo_Aplk.h>
+#include <Ppi/BoardInitSignalling.h>
+#include "BoardInit.h"
+#include "BoardInitMiscs.h"
+
+EFI_STATUS
+EFIAPI
+MinnowBoard3PostMemInitCallback (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+
+static EFI_PEI_NOTIFY_DESCRIPTOR mMinnowBoard3PostMemNotifyList = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gBoardPostMemInitStartGuid,
+ MinnowBoard3PostMemInitCallback
+};
+
+static EFI_PEI_PPI_DESCRIPTOR mMinnowBoard3PostMemDonePpi = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gBoardPostMemInitDoneGuid,
+ NULL
+};
+
+EFI_STATUS
+EFIAPI
+MinnowBoard3PostMemInitCallback (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ EFI_STATUS Status;
+ VOID *Instance;
+ UINT8 BoardId;
+ UINT8 FabId;
+
+ Status = PeiServicesLocatePpi (
+ &gBoardPostMemInitDoneGuid,
+ 0,
+ NULL,
+ &Instance
+ );
+ if (!EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "Minnow Board 3 Post Mem Init callback: Skip\n"));
+ return EFI_SUCCESS;
+ }
+
+ BoardId = (UINT8) PcdGet8 (PcdBoardId);
+ FabId = (UINT8) PcdGet8 (PcdFabId);
+ DEBUG ((EFI_D_INFO, "PostMemInit: BoardId == 0x%X, FabId == 0x%X\n", BoardId, FabId));
+ if (BoardId != (UINT8) BOARD_ID_MINNOW) {
+ DEBUG ((EFI_D_INFO, "Minnow Board 3 Post Mem Init callback: Skip\n"));
+ return EFI_SUCCESS;
+ }
+
+ DEBUG ((EFI_D_INFO, "Minnow Board 3 Post Mem Init callback\n"));
+
+ //
+ // Set init function PCD
+ //
+ PcdSet64 (PcdBoardPostMemInitFunc, (UINT64) (UINTN) MultiPlatformInfoInit);
+
+ //
+ // Add init steps here
+ //
+ //
+ // Install a flag signalling a board's post mem init is done
+ //
+ Status = PeiServicesInstallPpi (&mMinnowBoard3PostMemDonePpi);
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ This function performs Board initialization in Pre-Memory.
+
+ @retval EFI_SUCCESS The PPI is installed and initialized.
+ @retval EFI ERRORS The PPI is not successfully installed.
+ @retval EFI_OUT_OF_RESOURCES No enough resoruces (such as out of memory).
+
+**/
+EFI_STATUS
+EFIAPI
+MinnowBoard3InitConstructor (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "MinnowBoard3 Post Mem Init Constructor \n"));
+
+ DEBUG ((EFI_D_INFO, "Notify on Post Mem Init Start PPI \n"));
+ Status = PeiServicesNotifyPpi (&mMinnowBoard3PostMemNotifyList);
+
+ return Status;
+}
+
|