]>
Commit | Line | Data |
---|---|---|
c69dd9df | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | RtPlatformStatusCode.c \r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Contains NT32 specific implementations required to use status codes.\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | //\r | |
23 | // Statements that include other files.\r | |
24 | //\r | |
25 | #include "Tiano.h"\r | |
26 | #include "EfiCommonLib.h"\r | |
27 | #include "EfiRuntimeLib.h"\r | |
28 | #include "EfiStatusCode.h"\r | |
29 | #include "EfiHobLib.h"\r | |
30 | #include "RtMemoryStatusCodeLib.h"\r | |
31 | #include "BsDataHubStatusCodeLib.h"\r | |
32 | \r | |
33 | //\r | |
34 | // Consumed protocols\r | |
35 | //\r | |
36 | #include EFI_ARCH_PROTOCOL_CONSUMER (StatusCode)\r | |
37 | \r | |
38 | //\r | |
39 | // GUID definitions\r | |
40 | //\r | |
41 | #include EFI_GUID_DEFINITION (Hob)\r | |
42 | \r | |
43 | //\r | |
44 | // Globals only work at BootService Time. NOT at Runtime!\r | |
45 | //\r | |
46 | EFI_REPORT_STATUS_CODE mPeiReportStatusCode;\r | |
47 | \r | |
48 | //\r | |
49 | // Function implementations\r | |
50 | //\r | |
c69dd9df | 51 | EFI_STATUS\r |
52 | EFIAPI\r | |
53 | RtPlatformReportStatusCode (\r | |
54 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
55 | IN EFI_STATUS_CODE_VALUE Value,\r | |
56 | IN UINT32 Instance,\r | |
57 | IN EFI_GUID * CallerId,\r | |
58 | IN EFI_STATUS_CODE_DATA * Data OPTIONAL\r | |
59 | )\r | |
60 | /*++\r | |
61 | \r | |
62 | Routine Description:\r | |
63 | \r | |
64 | Call all status code listeners in the MonoStatusCode.\r | |
65 | \r | |
66 | Arguments:\r | |
67 | \r | |
68 | Same as ReportStatusCode service\r | |
69 | \r | |
70 | Returns:\r | |
71 | \r | |
72 | EFI_SUCCESS Always returns success.\r | |
73 | \r | |
74 | --*/\r | |
75 | {\r | |
76 | RtMemoryReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r | |
77 | if (EfiAtRuntime ()) {\r | |
78 | //\r | |
79 | // For now all we do is post code at runtime\r | |
80 | //\r | |
81 | return EFI_SUCCESS;\r | |
82 | }\r | |
83 | \r | |
84 | BsDataHubReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r | |
85 | \r | |
86 | //\r | |
87 | // Call back into PEI to get status codes. This is because SecMain contains\r | |
88 | // status code that reports to Win32.\r | |
89 | //\r | |
90 | if (mPeiReportStatusCode != NULL) {\r | |
91 | return mPeiReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r | |
92 | }\r | |
93 | \r | |
94 | return EFI_SUCCESS;\r | |
95 | }\r | |
96 | \r | |
c69dd9df | 97 | VOID\r |
98 | EFIAPI\r | |
99 | RtPlatformInitializeStatusCode (\r | |
100 | IN EFI_HANDLE ImageHandle,\r | |
101 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
102 | )\r | |
103 | /*++\r | |
104 | \r | |
105 | Routine Description:\r | |
106 | \r | |
107 | Initialize the status code listeners.\r | |
108 | \r | |
109 | Arguments:\r | |
110 | \r | |
111 | (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r | |
112 | \r | |
113 | Returns:\r | |
114 | \r | |
115 | None\r | |
116 | \r | |
117 | --*/\r | |
118 | {\r | |
119 | EFI_STATUS Status;\r | |
120 | VOID *HobList;\r | |
121 | VOID *Pointer;\r | |
122 | \r | |
123 | RtMemoryInitializeStatusCode (ImageHandle, SystemTable);\r | |
124 | BsDataHubInitializeStatusCode (ImageHandle, SystemTable);\r | |
125 | \r | |
126 | //\r | |
127 | // Play any prior status codes to the data hub.\r | |
128 | //\r | |
129 | PlaybackStatusCodes (BsDataHubReportStatusCode);\r | |
130 | \r | |
131 | //\r | |
132 | // If PEI has a ReportStatusCode callback find it and use it before StdErr\r | |
133 | // is connected.\r | |
134 | //\r | |
135 | mPeiReportStatusCode = NULL;\r | |
136 | \r | |
137 | Status = EfiLibGetSystemConfigurationTable (&gEfiHobListGuid, &HobList);\r | |
138 | if (!EFI_ERROR (Status)) {\r | |
139 | Status = GetNextGuidHob (&HobList, &gEfiStatusCodeRuntimeProtocolGuid, &Pointer, NULL);\r | |
140 | if (!EFI_ERROR (Status)) {\r | |
141 | mPeiReportStatusCode = (EFI_REPORT_STATUS_CODE) (*(UINTN *) Pointer);\r | |
142 | }\r | |
143 | }\r | |
144 | }\r |