]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
Modules clean up.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Pei / PeiStatusCode.c
CommitLineData
ad1a1798 1\r
2/** @file\r
3 Generic PeiStatusCode Module.\r
4\r
ececc2eb 5 Copyright (c) 2006, Intel Corporation\r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
ad1a1798 13\r
14 Module Name: PeiStatusCode.c\r
15\r
16**/\r
17\r
ad1a1798 18#include "PeiStatusCode.h"\r
19\r
20STATIC\r
ececc2eb 21EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {\r
ad1a1798 22 ReportDispatcher\r
23 };\r
24\r
25STATIC\r
26EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {\r
27 EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
28 &gEfiPeiStatusCodePpiGuid,\r
29 &mStatusCodePpi\r
30 };\r
31\r
32/**\r
33 Report status code to all supported device.\r
ececc2eb 34\r
35\r
ad1a1798 36 @param PeiServices\r
37\r
ececc2eb 38 @param CodeType Indicates the type of status code being reported.\r
ad1a1798 39 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
ececc2eb 40 @param Value Describes the current status of a hardware or software entity.\r
41 This includes information about the class and subclass that is used to classify the entity\r
42 as well as an operation. For progress codes, the operation is the current activity.\r
43 For error codes, it is the exception. For debug codes, it is not defined at this time.\r
44 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r
ad1a1798 45 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
ececc2eb 46 @param Instance The enumeration of a hardware or software entity within the system.\r
47 A system may contain multiple entities that match a class/subclass pairing.\r
48 The instance differentiates between them. An instance of 0 indicates that instance\r
ad1a1798 49 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.\r
ececc2eb 50 @param CallerId This optional parameter may be used to identify the caller.\r
ad1a1798 51 This parameter allows the status code driver to apply different rules to different callers.\r
ececc2eb 52 @param Data This optional parameter may be used to pass additional data.\r
53 Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.\r
54 The contents of this data type may have additional GUID-specific data. The standard GUIDs and\r
ad1a1798 55 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.\r
56\r
57 @return Always return EFI_SUCCESS.\r
58\r
59**/\r
60EFI_STATUS\r
61EFIAPI\r
62ReportDispatcher (\r
63 IN EFI_PEI_SERVICES **PeiServices,\r
64 IN EFI_STATUS_CODE_TYPE CodeType,\r
65 IN EFI_STATUS_CODE_VALUE Value,\r
66 IN UINT32 Instance,\r
67 IN EFI_GUID *CallerId OPTIONAL,\r
68 IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
69 )\r
70{\r
71 if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
72 SerialStatusCodeReportWorker (\r
73 CodeType,\r
74 Value,\r
75 Instance,\r
76 CallerId,\r
77 Data\r
78 );\r
79 }\r
80 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
81 MemoryStatusCodeReportWorker (\r
82 CodeType,\r
83 Value,\r
84 Instance\r
85 );\r
86 }\r
87 if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
88 OemHookStatusCodeReport (\r
89 CodeType,\r
90 Value,\r
91 Instance,\r
92 CallerId,\r
93 Data\r
94 );\r
95 }\r
96\r
97 return EFI_SUCCESS;\r
98}\r
99\r
100/**\r
ececc2eb 101 Initialize PEI status codes and publish the status code\r
ad1a1798 102 PPI.\r
103\r
104 @param FfsHeader FV this PEIM was loaded from.\r
105 @param PeiServices General purpose services available to every PEIM.\r
ececc2eb 106\r
ad1a1798 107 @return The function always returns success.\r
108\r
109**/\r
110EFI_STATUS\r
111PeiStatusCodeDriverEntry (\r
112 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
113 IN EFI_PEI_SERVICES **PeiServices\r
114 )\r
115{\r
116 EFI_STATUS Status;\r
117\r
118 //\r
119 // Dispatch initialization request to sub-statuscode-devices.\r
120 // If enable UseSerial, then initialize serial port.\r
121 // if enable UseMemory, then initialize memory status code worker.\r
122 // if enable UseOEM, then initialize Oem status code.\r
123 //\r
124 if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
125 Status = SerialPortInitialize();\r
126 ASSERT_EFI_ERROR (Status);\r
127 }\r
128 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
129 Status = MemoryStatusCodeInitializeWorker ();\r
130 ASSERT_EFI_ERROR (Status);\r
131 }\r
132 if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
133 Status = OemHookStatusCodeInitialize ();\r
134 ASSERT_EFI_ERROR (Status);\r
135 }\r
136\r
137 //\r
ececc2eb 138 // Install PeiStatusCodePpi.\r
ad1a1798 139 // PeiServices use this Ppi to output status code.\r
140 // use library\r
141 Status = PeiServicesInstallPpi (&mStatusCodePpiDescriptor);\r
142 ASSERT_EFI_ERROR (Status);\r
ececc2eb 143\r
ad1a1798 144 return EFI_SUCCESS;\r
145}\r
146\r