]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.c
Update directory/file names for status code PEIM.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Pei / StatusCodePei.c
... / ...
CommitLineData
1/** @file\r
2 Status code PEIM which produces Status Code PPI.\r
3\r
4 Copyright (c) 2006 - 2009, 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
12\r
13**/\r
14\r
15#include "StatusCodePei.h"\r
16\r
17EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {\r
18 ReportDispatcher\r
19 };\r
20\r
21EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {\r
22 EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
23 &gEfiPeiStatusCodePpiGuid,\r
24 &mStatusCodePpi\r
25 };\r
26\r
27/**\r
28 Publishes an interface that allows PEIMs to report status codes.\r
29\r
30 This function implements EFI_PEI_PROGRESS_CODE_PPI.ReportStatusCode().\r
31 It publishes an interface that allows PEIMs to report status codes.\r
32\r
33 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
34 @param CodeType Indicates the type of status code being reported.\r
35 @param Value Describes the current status of a hardware or\r
36 software entity. This includes information about the class and\r
37 subclass that is used to classify the entity as well as an operation.\r
38 For progress codes, the operation is the current activity.\r
39 For error codes, it is the exception.For debug codes,it is not defined at this time.\r
40 @param Instance The enumeration of a hardware or software entity within\r
41 the system. A system may contain multiple entities that match a class/subclass\r
42 pairing. The instance differentiates between them. An instance of 0 indicates\r
43 that instance information is unavailable, not meaningful, or not relevant.\r
44 Valid instance numbers start with 1.\r
45 @param CallerId This optional parameter may be used to identify the caller.\r
46 This parameter allows the status code driver to apply different rules to\r
47 different callers.\r
48 @param Data This optional parameter may be used to pass additional data.\r
49\r
50 @retval EFI_SUCCESS The function completed successfully.\r
51\r
52**/\r
53EFI_STATUS\r
54EFIAPI\r
55ReportDispatcher (\r
56 IN CONST EFI_PEI_SERVICES **PeiServices,\r
57 IN EFI_STATUS_CODE_TYPE CodeType,\r
58 IN EFI_STATUS_CODE_VALUE Value,\r
59 IN UINT32 Instance,\r
60 IN CONST EFI_GUID *CallerId OPTIONAL,\r
61 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
62 )\r
63{\r
64 if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
65 SerialStatusCodeReportWorker (\r
66 CodeType,\r
67 Value,\r
68 Instance,\r
69 CallerId,\r
70 Data\r
71 );\r
72 }\r
73 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
74 MemoryStatusCodeReportWorker (\r
75 CodeType,\r
76 Value,\r
77 Instance\r
78 );\r
79 }\r
80 if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
81 //\r
82 // Call OEM hook status code library API to report status code to OEM device\r
83 //\r
84 OemHookStatusCodeReport (\r
85 CodeType,\r
86 Value,\r
87 Instance,\r
88 (EFI_GUID *)CallerId,\r
89 (EFI_STATUS_CODE_DATA *)Data\r
90 );\r
91 }\r
92\r
93 return EFI_SUCCESS;\r
94}\r
95\r
96/**\r
97 Entry point of Status Code PEIM.\r
98 \r
99 This function is the entry point of this Status Code PEIM.\r
100 It initializes supported status code devices according to PCD settings,\r
101 and installs Status Code PPI.\r
102\r
103 @param FileHandle Handle of the file being invoked.\r
104 @param PeiServices Describes the list of possible PEI Services.\r
105\r
106 @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully.\r
107\r
108**/\r
109EFI_STATUS\r
110EFIAPI\r
111PeiStatusCodeDriverEntry (\r
112 IN EFI_PEI_FILE_HANDLE FileHandle,\r
113 IN CONST 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
138 // Install Status Code PPI.\r
139 // It serves the PEI Service ReportStatusCode.\r
140 //\r
141 Status = PeiServicesInstallPpi (&mStatusCodePpiDescriptor);\r
142 ASSERT_EFI_ERROR (Status);\r
143\r
144 return EFI_SUCCESS;\r
145}\r
146\r