]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
Make EdkModulePkg pass Intel IPF compiler with /W4 /WX switches, solving warning...
[mirror_edk2.git] / EdkModulePkg / Universal / StatusCode / Pei / PeiStatusCode.c
CommitLineData
56836fe9 1\r
2/** @file\r
3 Generic PeiStatusCode Module.\r
4\r
161c26a7 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
56836fe9 13\r
14 Module Name: PeiStatusCode.c\r
15\r
16**/\r
17\r
18#include "PeiStatusCode.h"\r
19\r
a93763b7 20STATIC\r
56836fe9 21EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = { \r
22 ReportDispatcher\r
23 };\r
24\r
a93763b7 25STATIC\r
56836fe9 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
a93763b7 34 \r
35 \r
56836fe9 36 @param PeiServices\r
37\r
38 @param CodeType Indicates the type of status code being reported. \r
39 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
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
511710d6 44 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below. \r
56836fe9 45 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
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
49 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.\r
50 @param CallerId This optional parameter may be used to identify the caller. \r
51 This parameter allows the status code driver to apply different rules to different callers.\r
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
55 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.\r
53408952 56\r
57 @return Always return EFI_SUCCESS.\r
58\r
56836fe9 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
101 Initialize PEI status codes and publish the status code \r
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
106 \r
107 @return The function always returns success.\r
108\r
109**/\r
110EFI_STATUS\r
56836fe9 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
a93763b7 125 Status = SerialPortInitialize();\r
126 ASSERT_EFI_ERROR (Status);\r
56836fe9 127 }\r
128 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
a93763b7 129 Status = MemoryStatusCodeInitializeWorker ();\r
130 ASSERT_EFI_ERROR (Status);\r
56836fe9 131 }\r
132 if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
a93763b7 133 Status = OemHookStatusCodeInitialize ();\r
134 ASSERT_EFI_ERROR (Status);\r
56836fe9 135 }\r
136\r
137 //\r
138 // Install PeiStatusCodePpi. \r
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
143 \r
144 return EFI_SUCCESS;\r
145}\r
146\r