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