+++ /dev/null
-/** @file\r
- Status code PEIM which produces Status Code PPI.\r
-\r
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "StatusCodePei.h"\r
-\r
-EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {\r
- ReportDispatcher\r
- };\r
-\r
-EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {\r
- EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
- &gEfiPeiStatusCodePpiGuid,\r
- &mStatusCodePpi\r
- };\r
-\r
-/**\r
- Publishes an interface that allows PEIMs to report status codes.\r
-\r
- This function implements EFI_PEI_PROGRESS_CODE_PPI.ReportStatusCode().\r
- It publishes an interface that allows PEIMs to report status codes.\r
-\r
- @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
- @param CodeType Indicates the type of status code being reported.\r
- @param Value Describes the current status of a hardware or\r
- software entity. This includes information about the class and\r
- subclass that is used to classify the entity as well as an operation.\r
- For progress codes, the operation is the current activity.\r
- For error codes, it is the exception.For debug codes,it is not defined at this time.\r
- @param Instance The enumeration of a hardware or software entity within\r
- the system. A system may contain multiple entities that match a class/subclass\r
- pairing. The instance differentiates between them. An instance of 0 indicates\r
- that instance information is unavailable, not meaningful, or not relevant.\r
- Valid instance numbers start with 1.\r
- @param CallerId This optional parameter may be used to identify the caller.\r
- This parameter allows the status code driver to apply different rules to\r
- different callers.\r
- @param Data This optional parameter may be used to pass additional data.\r
-\r
- @retval EFI_SUCCESS The function completed successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ReportDispatcher (\r
- IN CONST EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_STATUS_CODE_TYPE CodeType,\r
- IN EFI_STATUS_CODE_VALUE Value,\r
- IN UINT32 Instance,\r
- IN CONST EFI_GUID *CallerId OPTIONAL,\r
- IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
- )\r
-{\r
- if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
- SerialStatusCodeReportWorker (\r
- CodeType,\r
- Value,\r
- Instance,\r
- CallerId,\r
- Data\r
- );\r
- }\r
- if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
- MemoryStatusCodeReportWorker (\r
- CodeType,\r
- Value,\r
- Instance\r
- );\r
- }\r
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
- //\r
- // Call OEM hook status code library API to report status code to OEM device\r
- //\r
- OemHookStatusCodeReport (\r
- CodeType,\r
- Value,\r
- Instance,\r
- (EFI_GUID *)CallerId,\r
- (EFI_STATUS_CODE_DATA *)Data\r
- );\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Entry point of Status Code PEIM.\r
-\r
- This function is the entry point of this Status Code PEIM.\r
- It initializes supported status code devices according to PCD settings,\r
- and installs Status Code PPI.\r
-\r
- @param FileHandle Handle of the file being invoked.\r
- @param PeiServices Describes the list of possible PEI Services.\r
-\r
- @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PeiStatusCodeDriverEntry (\r
- IN EFI_PEI_FILE_HANDLE FileHandle,\r
- IN CONST EFI_PEI_SERVICES **PeiServices\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Dispatch initialization request to sub-statuscode-devices.\r
- // If enable UseSerial, then initialize serial port.\r
- // if enable UseMemory, then initialize memory status code worker.\r
- // if enable UseOEM, then initialize Oem status code.\r
- //\r
- if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
- Status = SerialPortInitialize();\r
- ASSERT_EFI_ERROR (Status);\r
- }\r
- if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
- Status = MemoryStatusCodeInitializeWorker ();\r
- ASSERT_EFI_ERROR (Status);\r
- }\r
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
- Status = OemHookStatusCodeInitialize ();\r
- ASSERT_EFI_ERROR (Status);\r
- }\r
-\r
- //\r
- // Install Status Code PPI.\r
- // It serves the PEI Service ReportStatusCode.\r
- //\r
- Status = PeiServicesInstallPpi (&mStatusCodePpiDescriptor);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r