3 Generic PeiStatusCode Module.
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 Module Name: PeiStatusCode.c
18 #include "PeiStatusCode.h"
21 Report status code to all supported device.
26 @param Type Indicates the type of status code being reported.
27 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
28 @param Value Describes the current status of a hardware or software entity.
29 This includes information about the class and subclass that is used to classify the entity
30 as well as an operation. For progress codes, the operation is the current activity.
31 For error codes, it is the exception. For debug codes, it is not defined at this time.
32 Type EFI_STATUS_CODE_VALUE is defined in ¡°Related Definitions¡± below.
33 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
34 @param Instance The enumeration of a hardware or software entity within the system.
35 A system may contain multiple entities that match a class/subclass pairing.
36 The instance differentiates between them. An instance of 0 indicates that instance
37 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
38 @param CallerId This optional parameter may be used to identify the caller.
39 This parameter allows the status code driver to apply different rules to different callers.
40 @param Data This optional parameter may be used to pass additional data.
41 Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
42 The contents of this data type may have additional GUID-specific data. The standard GUIDs and
43 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
48 IN EFI_PEI_SERVICES
**PeiServices
,
49 IN EFI_STATUS_CODE_TYPE Type
,
50 IN EFI_STATUS_CODE_VALUE Value
,
52 IN EFI_GUID
*CallerId OPTIONAL
,
53 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
57 EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi
= {
62 EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor
= {
63 EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
,
64 &gEfiPeiStatusCodePpiGuid
,
69 Report status code to all supported device.
74 @param CodeType Indicates the type of status code being reported.
75 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
76 @param Value Describes the current status of a hardware or software entity.
77 This includes information about the class and subclass that is used to classify the entity
78 as well as an operation. For progress codes, the operation is the current activity.
79 For error codes, it is the exception. For debug codes, it is not defined at this time.
80 Type EFI_STATUS_CODE_VALUE is defined in ¡°Related Definitions¡± below.
81 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
82 @param Instance The enumeration of a hardware or software entity within the system.
83 A system may contain multiple entities that match a class/subclass pairing.
84 The instance differentiates between them. An instance of 0 indicates that instance
85 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
86 @param CallerId This optional parameter may be used to identify the caller.
87 This parameter allows the status code driver to apply different rules to different callers.
88 @param Data This optional parameter may be used to pass additional data.
89 Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
90 The contents of this data type may have additional GUID-specific data. The standard GUIDs and
91 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
93 @return Always return EFI_SUCCESS.
99 IN EFI_PEI_SERVICES
**PeiServices
,
100 IN EFI_STATUS_CODE_TYPE CodeType
,
101 IN EFI_STATUS_CODE_VALUE Value
,
103 IN EFI_GUID
*CallerId OPTIONAL
,
104 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
107 if (FeaturePcdGet (PcdStatusCodeUseSerial
)) {
108 SerialStatusCodeReportWorker (
116 if (FeaturePcdGet (PcdStatusCodeUseMemory
)) {
117 MemoryStatusCodeReportWorker (
123 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
124 OemHookStatusCodeReport (
137 Initialize PEI status codes and publish the status code
140 @param FfsHeader FV this PEIM was loaded from.
141 @param PeiServices General purpose services available to every PEIM.
143 @return The function always returns success.
147 PeiStatusCodeDriverEntry (
148 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
149 IN EFI_PEI_SERVICES
**PeiServices
155 // Dispatch initialization request to sub-statuscode-devices.
156 // If enable UseSerial, then initialize serial port.
157 // if enable UseMemory, then initialize memory status code worker.
158 // if enable UseOEM, then initialize Oem status code.
160 if (FeaturePcdGet (PcdStatusCodeUseSerial
)) {
161 Status
= SerialPortInitialize();
162 ASSERT_EFI_ERROR (Status
);
164 if (FeaturePcdGet (PcdStatusCodeUseMemory
)) {
165 Status
= MemoryStatusCodeInitializeWorker ();
166 ASSERT_EFI_ERROR (Status
);
168 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
169 Status
= OemHookStatusCodeInitialize ();
170 ASSERT_EFI_ERROR (Status
);
174 // Install PeiStatusCodePpi.
175 // PeiServices use this Ppi to output status code.
177 Status
= PeiServicesInstallPpi (&mStatusCodePpiDescriptor
);
178 ASSERT_EFI_ERROR (Status
);