]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Library/EdkRuntimeStatusCodeLib/RtPlatformStatusCode/RtPlatformStatusCode.c
Initial import.
[mirror_edk2.git] / EdkModulePkg / Library / EdkRuntimeStatusCodeLib / RtPlatformStatusCode / RtPlatformStatusCode.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 RtPlatformStatusCode.c \r
15 \r
16Abstract:\r
17\r
18 Contains NT32 specific implementations required to use status codes.\r
19\r
20--*/\r
21\r
22//\r
23// Globals only work at BootService Time. NOT at Runtime!\r
24//\r
25// \r
26\r
27typedef\r
28EFI_STATUS\r
29(EFIAPI *REPORT_STATUS_CODE_FUNCTION) (\r
30 IN EFI_STATUS_CODE_TYPE Type,\r
31 IN EFI_STATUS_CODE_VALUE Value,\r
32 IN UINT32 Instance,\r
33 IN EFI_GUID *CallerId OPTIONAL,\r
34 IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
35 );\r
36\r
37REPORT_STATUS_CODE_FUNCTION mPeiReportStatusCode;\r
38\r
39//\r
40// Function implementations\r
41//\r
42EFI_STATUS\r
43RtPlatformReportStatusCode (\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 Call all status code listeners in the MonoStatusCode.\r
55\r
56Arguments:\r
57\r
58 Same as ReportStatusCode service\r
59 \r
60Returns:\r
61\r
62 EFI_SUCCESS Always returns success.\r
63\r
64--*/\r
65{\r
66 RtMemoryReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r
67 if (EfiAtRuntime ()) {\r
68 //\r
69 // For now all we do is post code at runtime\r
70 //\r
71 return EFI_SUCCESS;\r
72 }\r
73\r
74 BsDataHubReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r
75\r
76 //\r
77 // Call back into PEI to get status codes. This is because SecMain contains\r
78 // status code that reports to Win32.\r
79 //\r
80 if (mPeiReportStatusCode != NULL) {\r
81 return mPeiReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r
82 }\r
83\r
84 return EFI_SUCCESS;\r
85}\r
86\r
87VOID\r
88RtPlatformStatusCodeInitialize (\r
89 VOID\r
90 )\r
91/*++\r
92\r
93Routine Description:\r
94\r
95 Initialize the status code listeners.\r
96\r
97Arguments:\r
98\r
99 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
100\r
101Returns:\r
102\r
103 None\r
104\r
105--*/\r
106{\r
107 EFI_HOB_GUID_TYPE *GuidHob;\r
108 void *Pointer;\r
109\r
110 RtMemoryStatusCodeInitialize ();\r
111 BsDataHubStatusCodeInitialize ();\r
112\r
113 //\r
114 // Play any prior status codes to the data hub.\r
115 //\r
116 PlaybackStatusCodes (BsDataHubReportStatusCode);\r
117\r
118 //\r
119 // If PEI has a ReportStatusCode callback find it and use it before StdErr\r
120 // is connected.\r
121 //\r
122 mPeiReportStatusCode = NULL;\r
123\r
124 GuidHob = GetFirstGuidHob (&gEfiStatusCodeRuntimeProtocolGuid);\r
125 if (NULL == GuidHob) {\r
126 return;\r
127 }\r
128 Pointer = GET_GUID_HOB_DATA (GuidHob);\r
129 mPeiReportStatusCode = (REPORT_STATUS_CODE_FUNCTION) (*(UINTN *) Pointer);\r
130}\r