From 878ddf1fc3540a715f63594ed22b6929e881afb4 Mon Sep 17 00:00:00 2001 From: bbahnsen Date: Fri, 21 Apr 2006 22:54:32 +0000 Subject: Initial import. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524 --- EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c | 150 +++++++++++++++++++ EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs | 28 ++++ EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h | 111 ++++++++++++++ .../Pei/MonoStatusCode/Nt32/MonoStatusCode.mbd | 44 ++++++ .../Pei/MonoStatusCode/Nt32/MonoStatusCode.msa | 70 +++++++++ .../Pei/MonoStatusCode/Nt32/PlatformStatusCode.c | 162 +++++++++++++++++++++ EdkNt32Pkg/Pei/MonoStatusCode/Nt32/build.xml | 47 ++++++ 7 files changed, 612 insertions(+) create mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c create mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs create mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h create mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/Nt32/MonoStatusCode.mbd create mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/Nt32/MonoStatusCode.msa create mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/Nt32/PlatformStatusCode.c create mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/Nt32/build.xml (limited to 'EdkNt32Pkg/Pei/MonoStatusCode') diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c new file mode 100644 index 0000000000..27c73f576e --- /dev/null +++ b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c @@ -0,0 +1,150 @@ +/*++ + +Copyright (c) 2006, Intel Corporation +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. + +Module Name: + + MonoStatusCode.c + +Abstract: + + PEIM to provide the status code functionality, to aid in system debug. + It includes output to 0x80 port and/or to serial port. + This PEIM is monolithic. Different platform should provide different library. + +--*/ + +#include "MonoStatusCode.h" + +// +// Module globals +// +// +EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = { PlatformReportStatusCode }; + +EFI_PEI_PPI_DESCRIPTOR mPpiListStatusCode = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiStatusCodePpiGuid, + &mStatusCodePpi +}; + +// +// Function implemenations +// +EFI_STATUS +EFIAPI +TranslateDxeStatusCodeToPeiStatusCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID * CallerId, + IN EFI_STATUS_CODE_DATA * Data OPTIONAL + ) +/*++ + +Routine Description: + + Translate from a DXE status code interface into a PEI-callable + interface, making the PEI the least common denominator.. + +Arguments: + + Same as DXE ReportStatusCode RT service + +Returns: + + None + +--*/ +{ + return PlatformReportStatusCode (NULL, CodeType, Value, Instance, CallerId, Data); +} + +EFI_STATUS +EFIAPI +InitializeDxeReportStatusCode ( + IN EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Build a hob describing the status code listener that has been installed. + This will be used by DXE code until a runtime status code listener is + installed. + +Arguments: + + PeiServices - General purpose services available to every PEIM. + +Returns: + + Status - EFI_SUCCESS if the interface could be successfully + installed + +--*/ +{ + VOID *Instance; + VOID *HobData; + + Instance = (VOID *) (UINTN) TranslateDxeStatusCodeToPeiStatusCode; + + HobData = BuildGuidDataHob ( + &gEfiStatusCodeRuntimeProtocolGuid, + &Instance, + sizeof (VOID *) + ); + + ASSERT (HobData != NULL); + return EFI_SUCCESS; +} + +VOID +EFIAPI +InitializeMonoStatusCode ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Initialize the platform status codes and publish the platform status code + PPI. + +Arguments: + + FfsHeader - FV this PEIM was loaded from. + PeiServices - General purpose services available to every PEIM. + +Returns: + + Status - EFI_SUCCESS + +--*/ +{ + EFI_STATUS Status; + + // + // Initialize status code listeners. + // + PlatformInitializeStatusCode (FfsHeader, PeiServices); + + // + // Publish the status code capability to other modules + // + Status = (*PeiServices)->InstallPpi (PeiServices, &mPpiListStatusCode); + + ASSERT_EFI_ERROR (Status); + + DEBUG ((EFI_D_ERROR, "\nMono Status Code PEIM Loaded\n")); + + return ; +} diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs new file mode 100644 index 0000000000..3c86da0c63 --- /dev/null +++ b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs @@ -0,0 +1,28 @@ +/*++ + +Copyright (c) 2006, Intel Corporation +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. + +Module Name: + + MonoStatusCode.dxs + +Abstract: + + Dependency expression file for monolithic Status Code PEIM. + +--*/ +#include +#include + +DEPENDENCY_START + TRUE +DEPENDENCY_END + + diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h new file mode 100644 index 0000000000..38a9022558 --- /dev/null +++ b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h @@ -0,0 +1,111 @@ +/*++ + +Copyright (c) 2006, Intel Corporation +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. + +Module Name: + + MonoStatusCode.h + +Abstract: + + Monolithic single PEIM to provide the status code functionality. + The PEIM is a blend of libraries that correspond to the different status code + listeners that a platform installs. + +--*/ + +#ifndef _MONO_STATUS_CODE_H_ +#define _MONO_STATUS_CODE_H_ + +// +// Platform specific function Declarations. These must be implemented in a +// subdirectory named PlatformName in a file named PlatformStatusCode.c. +// See D845GRG\PlatformStatusCode.c for an example of a simple status code +// implementation. +// See Nt32\PlatformStatusCode.c for an example of a status code implementation +// that relocates itself into memory. +// +// +// This is the driver entry point and must be defined. +// +EFI_STATUS +EFIAPI +InstallMonoStatusCode ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +; + +// +// This is the platform function to initialize the listeners desired by the +// platform. +// +VOID +PlatformInitializeStatusCode ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +; + +// +// This is the platform function that calls all of the listeners desired by the +// platform. +// +EFI_STATUS +EFIAPI +PlatformReportStatusCode ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID * CallerId, + IN EFI_STATUS_CODE_DATA * Data OPTIONAL + ) +; + +// +// Platform independent function Declarations +// +// +// Initialize the status code listeners and publish the status code PPI. +// +VOID +EFIAPI +InitializeMonoStatusCode ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +; + +// +// Convert a DXE status code call into a PEI status code call. +// +EFI_STATUS +EFIAPI +TranslateDxeStatusCodeToPeiStatusCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID * CallerId, + IN EFI_STATUS_CODE_DATA * Data OPTIONAL + ) +; + +// +// Publish a HOB that contains the listener to be used by DXE. +// +EFI_STATUS +EFIAPI +InitializeDxeReportStatusCode ( + IN EFI_PEI_SERVICES **PeiServices + ) +; + +#endif diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/MonoStatusCode.mbd b/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/MonoStatusCode.mbd new file mode 100644 index 0000000000..f48b4c7f0e --- /dev/null +++ b/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/MonoStatusCode.mbd @@ -0,0 +1,44 @@ + + + + + MonoStatusCode + 1501614E-0E6C-4ef4-8B8F-C276CDFB646F + 0 + FIX ME! + Copyright (c) 2004-2006, Intel Corporation + + 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. + + 2006-03-14 17:04 + 2006-03-19 15:17 + + + PeiReportStatusCodeLib + BaseDebugLibReportStatusCode + BaseLib + PeiMemoryLib + PeiServicesTablePointerLib + PeiHobLib + PeimEntryPoint + EdkMemoryStatusCodeLib + PeiCoreLib + + + _ModuleEntryPoint + + diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/MonoStatusCode.msa b/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/MonoStatusCode.msa new file mode 100644 index 0000000000..a1e96c7bf9 --- /dev/null +++ b/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/MonoStatusCode.msa @@ -0,0 +1,70 @@ + + + + + MonoStatusCode + PEIM + PE32_PEIM + 1501614E-0E6C-4ef4-8B8F-C276CDFB646F + 0 + Component description file for DiskIo module. + FIX ME! + Copyright (c) 2004-2006, Intel Corporation + + 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. + + 0 + 2006-03-14 17:04 + 2006-03-19 15:17 + + + DebugLib + PeimEntryPoint + EdkMemoryStatusCodeLib + HobLib + + + ..\MonoStatusCode.c + ..\MonoStatusCode.h + PlatformStatusCode.c + ..\MonoStatusCode.dxs + + + MdePkg + EdkModulePkg + EdkNt32Pkg + + + StatusCode + + + + TranslateDxeStatusCodeToPeiStatusCode + gEfiStatusCodeRuntimeProtocolGuid + 0xd2b2b828, 0x826, 0x48a7, 0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24, 0xf0 + + + + StatusCode + FvFileLoader + + + + InstallMonoStatusCode + + + diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/PlatformStatusCode.c b/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/PlatformStatusCode.c new file mode 100644 index 0000000000..9d1a57b2ee --- /dev/null +++ b/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/PlatformStatusCode.c @@ -0,0 +1,162 @@ +/*++ + +Copyright (c) 2006, Intel Corporation +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. + +Module Name: + + PlatformStatusCode.c + +Abstract: + + Contains NT32 specific implementations required to use status codes. + +--*/ + +#include "../MonoStatusCode.h" + + +BOOLEAN gRunningFromMemory = FALSE; +// +// Platform definitions +// +EFI_PEI_REPORT_STATUS_CODE mSecReportStatusCode = NULL; + +extern EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi; + +// +// Function implementations +// +EFI_STATUS +EFIAPI +PlatformReportStatusCode ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID * CallerId, + IN EFI_STATUS_CODE_DATA * Data OPTIONAL + ) +/*++ + +Routine Description: + + Call all status code listeners in the MonoStatusCode. + +Arguments: + + Same as ReportStatusCode service + +Returns: + + EFI_SUCCESS Always returns success. + +--*/ +{ + mSecReportStatusCode (PeiServices, CodeType, Value, Instance, CallerId, Data); + MemoryReportStatusCode (CodeType, Value, Instance, CallerId, Data); + return EFI_SUCCESS; +} + +VOID +PlatformInitializeStatusCode ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Initialize the status code listeners. This consists of locating the + listener produced by SecMain.exe. + +Arguments: + + FfsHeader - FV this PEIM was loaded from. + PeiServices - General purpose services available to every PEIM. + +Returns: + + None + +--*/ +{ + EFI_STATUS Status; + EFI_PEI_PROGRESS_CODE_PPI *ReportStatusCodePpi; + EFI_PEI_PPI_DESCRIPTOR *ReportStatusCodeDescriptor; + + // + // Cache the existing status code listener installed by the SEC core. + // We should actually do a heap allocate, install a PPI, etc, but since we + // know that we are running from a DLL, we can use global variables, and + // directly update the status code PPI descriptor + // + // + // Locate SEC status code PPI + // + Status = (*PeiServices)->LocatePpi ( + PeiServices, + &gEfiPeiStatusCodePpiGuid, + 0, + &ReportStatusCodeDescriptor, + &ReportStatusCodePpi + ); + if (EFI_ERROR (Status)) { + return ; + } + + mSecReportStatusCode = ReportStatusCodePpi->ReportStatusCode; + ReportStatusCodeDescriptor->Ppi = &mStatusCodePpi; + + // + // Always initialize memory status code listener. + // + MemoryStatusCodeInitialize (FfsHeader, PeiServices); + +} + +EFI_STATUS +EFIAPI +InstallMonoStatusCode ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Install the PEIM. Publish the DXE callback as well. + +Arguments: + + FfsHeader - FV this PEIM was loaded from. + PeiServices - General purpose services available to every PEIM. + +Returns: + + EFI_SUCCESS The function always returns success. + +--*/ +{ + if (!gRunningFromMemory) { + // + // First pass, running from flash, initialize everything + // + InitializeMonoStatusCode (FfsHeader, PeiServices); + } else { + // + // Second pass, running from memory, initialize memory listener and + // publish the DXE listener in a HOB. + // + MemoryStatusCodeInitialize (FfsHeader, PeiServices); + InitializeDxeReportStatusCode (PeiServices); + } + + return EFI_SUCCESS; +} diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/build.xml b/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/build.xml new file mode 100644 index 0000000000..e6c8551241 --- /dev/null +++ b/EdkNt32Pkg/Pei/MonoStatusCode/Nt32/build.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3