Obsoleted by new schema and new build tools.
[mirror_edk2.git] / EdkNt32Pkg / Pei / MonoStatusCode / MonoStatusCode.c
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 MonoStatusCode.c\r
15\r
16Abstract:\r
17\r
18 PEIM to provide the status code functionality, to aid in system debug.\r
19 It includes output to 0x80 port and/or to serial port. \r
20 This PEIM is monolithic. Different platform should provide different library.\r
21\r
22--*/\r
23\r
24#include "MonoStatusCode.h"\r
25\r
26//\r
27// Module globals\r
28//\r
29// \r
30EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = { PlatformReportStatusCode };\r
31\r
32EFI_PEI_PPI_DESCRIPTOR mPpiListStatusCode = {\r
33 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
34 &gEfiPeiStatusCodePpiGuid,\r
35 &mStatusCodePpi\r
36};\r
37\r
38//\r
39// Function implemenations\r
40//\r
41EFI_STATUS\r
42EFIAPI\r
43TranslateDxeStatusCodeToPeiStatusCode (\r
44 IN EFI_STATUS_CODE_TYPE CodeType,\r
45 IN EFI_STATUS_CODE_VALUE Value,\r
46 IN UINT32 Instance,\r
47 IN EFI_GUID * CallerId,\r
48 IN EFI_STATUS_CODE_DATA * Data OPTIONAL\r
49 )\r
50/*++\r
51\r
52Routine Description:\r
53\r
54 Translate from a DXE status code interface into a PEI-callable\r
55 interface, making the PEI the least common denominator..\r
56\r
57Arguments:\r
58\r
59 Same as DXE ReportStatusCode RT service\r
60 \r
61Returns:\r
62\r
63 None\r
64\r
65--*/\r
66{\r
67 return PlatformReportStatusCode (NULL, CodeType, Value, Instance, CallerId, Data);\r
68}\r
69\r
70EFI_STATUS\r
71EFIAPI\r
72InitializeDxeReportStatusCode (\r
73 IN EFI_PEI_SERVICES **PeiServices\r
74 )\r
75/*++\r
76\r
77Routine Description:\r
78\r
79 Build a hob describing the status code listener that has been installed.\r
80 This will be used by DXE code until a runtime status code listener is \r
81 installed.\r
82\r
83Arguments:\r
84\r
85 PeiServices - General purpose services available to every PEIM.\r
86 \r
87Returns:\r
88\r
89 Status - EFI_SUCCESS if the interface could be successfully\r
90 installed\r
91\r
92--*/\r
93{\r
94 VOID *Instance;\r
95 VOID *HobData;\r
96\r
97 Instance = (VOID *) (UINTN) TranslateDxeStatusCodeToPeiStatusCode;\r
98\r
99 HobData = BuildGuidDataHob (\r
100 &gEfiStatusCodeRuntimeProtocolGuid,\r
101 &Instance,\r
102 sizeof (VOID *)\r
103 );\r
104\r
105 ASSERT (HobData != NULL);\r
106 return EFI_SUCCESS;\r
107}\r
108\r
109VOID\r
110EFIAPI\r
111InitializeMonoStatusCode (\r
112 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
113 IN EFI_PEI_SERVICES **PeiServices\r
114 )\r
115/*++\r
116\r
117Routine Description:\r
118\r
119 Initialize the platform status codes and publish the platform status code \r
120 PPI.\r
121\r
122Arguments:\r
123\r
124 FfsHeader - FV this PEIM was loaded from.\r
125 PeiServices - General purpose services available to every PEIM.\r
126 \r
127Returns:\r
128\r
129 Status - EFI_SUCCESS\r
130\r
131--*/\r
132{\r
133 EFI_STATUS Status;\r
134\r
135 //\r
136 // Initialize status code listeners.\r
137 //\r
138 PlatformInitializeStatusCode (FfsHeader, PeiServices);\r
139\r
140 //\r
141 // Publish the status code capability to other modules\r
142 //\r
143 Status = (*PeiServices)->InstallPpi (PeiServices, &mPpiListStatusCode);\r
144\r
145 ASSERT_EFI_ERROR (Status);\r
146\r
147 DEBUG ((EFI_D_ERROR, "\nMono Status Code PEIM Loaded\n"));\r
148\r
149 return ;\r
150}\r