]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.c
IntelFrameworkModulePkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Pei / StatusCodePei.c
CommitLineData
ad1a1798 1/** @file\r
d5aea10c 2 Status code PEIM which produces Status Code PPI.\r
ad1a1798 3\r
0a6f4824 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
180a5a35 5 This program and the accompanying materials\r
ececc2eb 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
ad1a1798 13**/\r
14\r
85eb5794 15#include "StatusCodePei.h"\r
ad1a1798 16\r
d5aea10c 17EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {\r
ad1a1798 18 ReportDispatcher\r
19 };\r
20\r
ad1a1798 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
d5aea10c 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
ad1a1798 51\r
52**/\r
53EFI_STATUS\r
54EFIAPI\r
55ReportDispatcher (\r
507b36ca 56 IN CONST EFI_PEI_SERVICES **PeiServices,\r
d5aea10c 57 IN EFI_STATUS_CODE_TYPE CodeType,\r
58 IN EFI_STATUS_CODE_VALUE Value,\r
59 IN UINT32 Instance,\r
507b36ca 60 IN CONST EFI_GUID *CallerId OPTIONAL,\r
61 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
ad1a1798 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
d5aea10c 81 //\r
82 // Call OEM hook status code library API to report status code to OEM device\r
83 //\r
ad1a1798 84 OemHookStatusCodeReport (\r
85 CodeType,\r
86 Value,\r
87 Instance,\r
507b36ca 88 (EFI_GUID *)CallerId,\r
89 (EFI_STATUS_CODE_DATA *)Data\r
ad1a1798 90 );\r
91 }\r
92\r
93 return EFI_SUCCESS;\r
94}\r
95\r
96/**\r
d5aea10c 97 Entry point of Status Code PEIM.\r
0a6f4824 98\r
d5aea10c 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
ad1a1798 102\r
8bd22b8a
LG
103 @param FileHandle Handle of the file being invoked.\r
104 @param PeiServices Describes the list of possible PEI Services.\r
ececc2eb 105\r
d5aea10c 106 @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully.\r
ad1a1798 107\r
108**/\r
109EFI_STATUS\r
6ba0bc7c 110EFIAPI\r
ad1a1798 111PeiStatusCodeDriverEntry (\r
8bd22b8a
LG
112 IN EFI_PEI_FILE_HANDLE FileHandle,\r
113 IN CONST EFI_PEI_SERVICES **PeiServices\r
ad1a1798 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
d5aea10c 138 // Install Status Code PPI.\r
139 // It serves the PEI Service ReportStatusCode.\r
140 //\r
ea2d9086 141 Status = PeiServicesInstallPpi (&mStatusCodePpiDescriptor);\r
142 ASSERT_EFI_ERROR (Status);\r
ececc2eb 143\r
ad1a1798 144 return EFI_SUCCESS;\r
145}\r
146\r