2 Generic PeiStatusCode Module.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 Module Name: PeiStatusCode.c
17 #include "PeiStatusCode.h"
19 EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi
= {
23 EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor
= {
24 EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
,
25 &gEfiPeiStatusCodePpiGuid
,
30 Report status code to all supported device.
35 @param CodeType Indicates the type of status code being reported.
36 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
37 @param Value Describes the current status of a hardware or software entity.
38 This includes information about the class and subclass that is used to classify the entity
39 as well as an operation. For progress codes, the operation is the current activity.
40 For error codes, it is the exception. For debug codes, it is not defined at this time.
41 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
42 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
43 @param Instance The enumeration of a hardware or software entity within the system.
44 A system may contain multiple entities that match a class/subclass pairing.
45 The instance differentiates between them. An instance of 0 indicates that instance
46 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
47 @param CallerId This optional parameter may be used to identify the caller.
48 This parameter allows the status code driver to apply different rules to different callers.
49 @param Data This optional parameter may be used to pass additional data.
50 Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
51 The contents of this data type may have additional GUID-specific data. The standard GUIDs and
52 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
54 @return Always return EFI_SUCCESS.
60 IN CONST EFI_PEI_SERVICES
**PeiServices
,
61 IN EFI_STATUS_CODE_TYPE CodeType
,
62 IN EFI_STATUS_CODE_VALUE Value
,
64 IN CONST EFI_GUID
*CallerId OPTIONAL
,
65 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
68 if (FeaturePcdGet (PcdStatusCodeUseSerial
)) {
69 SerialStatusCodeReportWorker (
77 if (FeaturePcdGet (PcdStatusCodeUseMemory
)) {
78 MemoryStatusCodeReportWorker (
84 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
85 OemHookStatusCodeReport (
90 (EFI_STATUS_CODE_DATA
*)Data
98 Initialize PEI status codes and publish the status code
101 @param FileHandle Handle of the file being invoked.
102 @param PeiServices Describes the list of possible PEI Services.
104 @return The function always returns success.
108 PeiStatusCodeDriverEntry (
109 IN EFI_PEI_FILE_HANDLE FileHandle
,
110 IN CONST EFI_PEI_SERVICES
**PeiServices
116 // Dispatch initialization request to sub-statuscode-devices.
117 // If enable UseSerial, then initialize serial port.
118 // if enable UseMemory, then initialize memory status code worker.
119 // if enable UseOEM, then initialize Oem status code.
121 if (FeaturePcdGet (PcdStatusCodeUseSerial
)) {
122 Status
= SerialPortInitialize();
123 ASSERT_EFI_ERROR (Status
);
125 if (FeaturePcdGet (PcdStatusCodeUseMemory
)) {
126 Status
= MemoryStatusCodeInitializeWorker ();
127 ASSERT_EFI_ERROR (Status
);
129 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
130 Status
= OemHookStatusCodeInitialize ();
131 ASSERT_EFI_ERROR (Status
);
135 // Install PeiStatusCodePpi.
136 // PeiServices use this Ppi to output status code.
138 Status
= PeiServicesInstallPpi (&mStatusCodePpiDescriptor
);
139 ASSERT_EFI_ERROR (Status
);