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