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