diff options
Diffstat (limited to 'Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib')
6 files changed, 520 insertions, 0 deletions
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeBoardInitLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeBoardInitLib.c new file mode 100644 index 0000000000..13c623c640 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeBoardInitLib.c @@ -0,0 +1,84 @@ +/** @file
+
+Copyright (c) 2017, 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 that 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 <Library/BoardInitLib.h>
+#include <Library/MultiBoardInitSupportLib.h>
+#include <Library/PcdLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+EFI_STATUS
+EFIAPI
+BoardInitAfterPciEnumeration (
+ VOID
+ )
+{
+ BOARD_NOTIFICATION_INIT_FUNC *BoardNotificationInit;
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gBoardNotificationInitGuid,
+ NULL,
+ (VOID **)&BoardNotificationInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardNotificationInit->BoardInitAfterPciEnumeration != NULL) {
+ return BoardNotificationInit->BoardInitAfterPciEnumeration ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+BoardInitReadyToBoot (
+ VOID
+ )
+{
+ BOARD_NOTIFICATION_INIT_FUNC *BoardNotificationInit;
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gBoardNotificationInitGuid,
+ NULL,
+ (VOID **)&BoardNotificationInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardNotificationInit->BoardInitReadyToBoot != NULL) {
+ return BoardNotificationInit->BoardInitReadyToBoot ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+BoardInitEndOfFirmware (
+ VOID
+ )
+{
+ BOARD_NOTIFICATION_INIT_FUNC *BoardNotificationInit;
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gBoardNotificationInitGuid,
+ NULL,
+ (VOID **)&BoardNotificationInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardNotificationInit->BoardInitEndOfFirmware != NULL) {
+ return BoardNotificationInit->BoardInitEndOfFirmware ();
+ }
+ }
+ return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeMultiBoardInitSupportLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeMultiBoardInitSupportLib.c new file mode 100644 index 0000000000..f7a4c5b5a1 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeMultiBoardInitSupportLib.c @@ -0,0 +1,39 @@ +/** @file
+
+Copyright (c) 2017, 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 that 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 <Library/BoardInitLib.h>
+#include <Library/MultiBoardInitSupportLib.h>
+#include <Library/PcdLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+EFI_STATUS
+EFIAPI
+RegisterBoardNotificationInit (
+ IN BOARD_NOTIFICATION_INIT_FUNC *BoardNotificationInit
+ )
+{
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+
+ Handle = NULL;
+ Status = gBS->InstallProtocolInterface (
+ &Handle,
+ &gBoardNotificationInitGuid,
+ EFI_NATIVE_INTERFACE,
+ BoardNotificationInit
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeMultiBoardInitSupportLib.inf b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeMultiBoardInitSupportLib.inf new file mode 100644 index 0000000000..188c98db0a --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeMultiBoardInitSupportLib.inf @@ -0,0 +1,42 @@ +## @file
+# Component information file for Board Init Library
+#
+# Copyright (c) 2017, 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.
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DxeMultiBoardInitSupportLib
+ FILE_GUID = 4790240A-F86D-4E91-BA4C-7E24B9AC393B
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = MultiBoardInitSupportLib
+ LIBRARY_CLASS = BoardInitLib
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ DebugLib
+ UefiBootServicesTableLib
+
+[Packages]
+ MinPlatformPkg/MinPlatformPkg.dec
+ MdePkg/MdePkg.dec
+
+[Sources]
+ DxeMultiBoardInitSupportLib.c
+ DxeBoardInitLib.c
+
+[Guids]
+ gBoardNotificationInitGuid
+
+[Pcd]
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiBoardInitLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiBoardInitLib.c new file mode 100644 index 0000000000..9bfe1551fb --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiBoardInitLib.c @@ -0,0 +1,229 @@ +/** @file
+
+Copyright (c) 2017, 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 that 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 <Library/BoardInitLib.h>
+#include <Library/MultiBoardInitSupportLib.h>
+#include <Library/PcdLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PeiServicesLib.h>
+
+EFI_STATUS
+EFIAPI
+BoardDetect (
+ VOID
+ )
+{
+ BOARD_DETECT_FUNC *BoardDetectFunc;
+ UINTN Index;
+ EFI_STATUS Status;
+
+ for (Index = 0; ; Index++) {
+ Status = PeiServicesLocatePpi(
+ &gBoardDetectGuid,
+ Index,
+ NULL,
+ (VOID **)&BoardDetectFunc
+ );
+ if (EFI_ERROR(Status)) {
+ break;
+ }
+ if (BoardDetectFunc->BoardDetect != NULL) {
+ BoardDetectFunc->BoardDetect ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+BoardDebugInit (
+ VOID
+ )
+{
+ BOARD_PRE_MEM_INIT_FUNC *BoardPreMemInit;
+ EFI_STATUS Status;
+
+ Status = PeiServicesLocatePpi(
+ &gBoardPreMemInitGuid,
+ 0,
+ NULL,
+ (VOID **)&BoardPreMemInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardPreMemInit->BoardDebugInit != NULL) {
+ return BoardPreMemInit->BoardDebugInit ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_BOOT_MODE
+EFIAPI
+BoardBootModeDetect (
+ VOID
+ )
+{
+ BOARD_PRE_MEM_INIT_FUNC *BoardPreMemInit;
+ EFI_STATUS Status;
+
+ Status = PeiServicesLocatePpi(
+ &gBoardPreMemInitGuid,
+ 0,
+ NULL,
+ (VOID **)&BoardPreMemInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardPreMemInit->BoardBootModeDetect != NULL) {
+ return BoardPreMemInit->BoardBootModeDetect ();
+ }
+ }
+ return BOOT_WITH_FULL_CONFIGURATION;
+}
+
+EFI_STATUS
+EFIAPI
+BoardInitBeforeMemoryInit (
+ VOID
+ )
+{
+ BOARD_PRE_MEM_INIT_FUNC *BoardPreMemInit;
+ EFI_STATUS Status;
+
+ Status = PeiServicesLocatePpi(
+ &gBoardPreMemInitGuid,
+ 0,
+ NULL,
+ (VOID **)&BoardPreMemInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardPreMemInit->BoardInitBeforeMemoryInit != NULL) {
+ return BoardPreMemInit->BoardInitBeforeMemoryInit ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+BoardInitAfterMemoryInit (
+ VOID
+ )
+{
+ BOARD_PRE_MEM_INIT_FUNC *BoardPreMemInit;
+ EFI_STATUS Status;
+
+ Status = PeiServicesLocatePpi(
+ &gBoardPreMemInitGuid,
+ 0,
+ NULL,
+ (VOID **)&BoardPreMemInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardPreMemInit->BoardInitAfterMemoryInit != NULL) {
+ return BoardPreMemInit->BoardInitAfterMemoryInit ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+BoardInitBeforeTempRamExit (
+ VOID
+ )
+{
+ BOARD_PRE_MEM_INIT_FUNC *BoardPreMemInit;
+ EFI_STATUS Status;
+
+ Status = PeiServicesLocatePpi(
+ &gBoardPreMemInitGuid,
+ 0,
+ NULL,
+ (VOID **)&BoardPreMemInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardPreMemInit->BoardInitBeforeTempRamExit != NULL) {
+ return BoardPreMemInit->BoardInitBeforeTempRamExit ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+BoardInitAfterTempRamExit (
+ VOID
+ )
+{
+ BOARD_PRE_MEM_INIT_FUNC *BoardPreMemInit;
+ EFI_STATUS Status;
+
+ Status = PeiServicesLocatePpi(
+ &gBoardPreMemInitGuid,
+ 0,
+ NULL,
+ (VOID **)&BoardPreMemInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardPreMemInit->BoardInitAfterTempRamExit != NULL) {
+ return BoardPreMemInit->BoardInitAfterTempRamExit ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+BoardInitBeforeSiliconInit (
+ VOID
+ )
+{
+ BOARD_POST_MEM_INIT_FUNC *BoardPostMemInit;
+ EFI_STATUS Status;
+
+ Status = PeiServicesLocatePpi(
+ &gBoardPostMemInitGuid,
+ 0,
+ NULL,
+ (VOID **)&BoardPostMemInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardPostMemInit->BoardInitBeforeSiliconInit != NULL) {
+ return BoardPostMemInit->BoardInitBeforeSiliconInit ();
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+BoardInitAfterSiliconInit (
+ VOID
+ )
+{
+ BOARD_POST_MEM_INIT_FUNC *BoardPostMemInit;
+ EFI_STATUS Status;
+
+ Status = PeiServicesLocatePpi(
+ &gBoardPostMemInitGuid,
+ 0,
+ NULL,
+ (VOID **)&BoardPostMemInit
+ );
+ if (!EFI_ERROR(Status)) {
+ if (BoardPostMemInit->BoardInitAfterSiliconInit != NULL) {
+ return BoardPostMemInit->BoardInitAfterSiliconInit ();
+ }
+ }
+ return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiMultiBoardInitSupportLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiMultiBoardInitSupportLib.c new file mode 100644 index 0000000000..2056782181 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiMultiBoardInitSupportLib.c @@ -0,0 +1,82 @@ +/** @file
+
+Copyright (c) 2017, 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 that 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 <Library/BoardInitLib.h>
+#include <Library/MultiBoardInitSupportLib.h>
+#include <Library/PcdLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PeiServicesLib.h>
+
+EFI_STATUS
+EFIAPI
+RegisterBoardDetect (
+ IN BOARD_DETECT_FUNC *BoardDetect
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *PpiListBoardDetect;
+
+ PpiListBoardDetect = AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (PpiListBoardDetect != NULL);
+
+ PpiListBoardDetect->Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
+ PpiListBoardDetect->Guid = &gBoardDetectGuid;
+ PpiListBoardDetect->Ppi = BoardDetect;
+
+ Status = PeiServicesInstallPpi (PpiListBoardDetect);
+ ASSERT_EFI_ERROR(Status);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+RegisterBoardPreMemInit (
+ IN BOARD_PRE_MEM_INIT_FUNC *BoardPreMemInit
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *PpiListBoardInitPreMem;
+
+ PpiListBoardInitPreMem = AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (PpiListBoardInitPreMem != NULL);
+
+ PpiListBoardInitPreMem->Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
+ PpiListBoardInitPreMem->Guid = &gBoardPreMemInitGuid;
+ PpiListBoardInitPreMem->Ppi = BoardPreMemInit;
+
+ Status = PeiServicesInstallPpi (PpiListBoardInitPreMem);
+ ASSERT_EFI_ERROR(Status);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+RegisterBoardPostMemInit (
+ IN BOARD_POST_MEM_INIT_FUNC *BoardPostMemInit
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *PpiListBoardInitPostMem;
+
+ PpiListBoardInitPostMem = AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (PpiListBoardInitPostMem != NULL);
+
+ PpiListBoardInitPostMem->Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
+ PpiListBoardInitPostMem->Guid = &gBoardPostMemInitGuid;
+ PpiListBoardInitPostMem->Ppi = BoardPostMemInit;
+
+ Status = PeiServicesInstallPpi (PpiListBoardInitPostMem);
+ ASSERT_EFI_ERROR(Status);
+ return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiMultiBoardInitSupportLib.inf b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiMultiBoardInitSupportLib.inf new file mode 100644 index 0000000000..de769bf504 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiMultiBoardInitSupportLib.inf @@ -0,0 +1,44 @@ +## @file
+# Component information file for Board Init Library
+#
+# Copyright (c) 2017, 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.
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PeiMultiBoardInitSupportLib
+ FILE_GUID = E0238683-D3FD-4D97-8874-37C6157E2906
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = MultiBoardInitSupportLib
+ LIBRARY_CLASS = BoardInitLib
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ DebugLib
+
+[Packages]
+ MinPlatformPkg/MinPlatformPkg.dec
+ MdePkg/MdePkg.dec
+
+[Sources]
+ PeiMultiBoardInitSupportLib.c
+ PeiBoardInitLib.c
+
+[Guids]
+ gBoardDetectGuid
+ gBoardPreMemInitGuid
+ gBoardPostMemInitGuid
+ gBoardNotificationInitGuid
+
+[Pcd]
|