]>
Commit | Line | Data |
---|---|---|
4684b66f | 1 | /*++ |
2 | This file contains an 'Intel UEFI Application' and is | |
3 | licensed for Intel CPUs and chipsets under the terms of your | |
4 | license agreement with Intel or your vendor. This file may | |
5 | be modified by the user, subject to additional terms of the | |
6 | license agreement | |
7 | --*/ | |
8 | /*++ | |
9 | ||
10 | Copyright (c) 2011 Intel Corporation. All rights reserved | |
11 | This software and associated documentation (if any) is furnished | |
12 | under a license and may only be used or copied in accordance | |
13 | with the terms of the license. Except as permitted by such | |
14 | license, no part of this software or documentation may be | |
15 | reproduced, stored in a retrieval system, or transmitted in any | |
16 | form or by any means without the express written consent of | |
17 | Intel Corporation. | |
18 | ||
19 | --*/ | |
20 | ||
21 | /** @file | |
22 | Display the configuration table | |
23 | ||
24 | **/ | |
25 | ||
26 | #include <WebServer.h> | |
27 | #include <Guid\Acpi.h> | |
28 | #include <Guid\DebugImageInfoTable.h> | |
29 | #include <Guid\DxeServices.h> | |
30 | #include <Guid\HobList.h> | |
31 | #include <Guid\MemoryTypeInformation.h> | |
32 | #include <Guid\LoadModuleAtFixedAddress.h> | |
33 | ||
34 | ||
35 | typedef struct { | |
36 | CHAR16 * GuidName; | |
37 | EFI_GUID * pGuid; | |
38 | CHAR16 * pWebPage; | |
39 | } GUID_NAME; | |
40 | ||
59bc0593 | 41 | CONST GUID_NAME mGuidName[] = { |
4684b66f | 42 | { L"gEfiAcpi10TableGuid", &gEfiAcpi10TableGuid, PAGE_ACPI_RSDP_10B }, |
43 | { L"gEfiAcpiTableGuid", &gEfiAcpiTableGuid, PAGE_ACPI_RSDP_30 }, | |
44 | { L"gEfiDebugImageInfoTableGuid", &gEfiDebugImageInfoTableGuid, NULL }, | |
45 | { L"gEfiDxeServicesTableGuid", &gEfiDxeServicesTableGuid, PAGE_DXE_SERVICES_TABLE }, | |
46 | { L"gEfiHobListGuid", &gEfiHobListGuid, NULL }, | |
47 | { L"gEfiMemoryTypeInformationGuid", &gEfiMemoryTypeInformationGuid, NULL }, | |
48 | { L"gLoadFixedAddressConfigurationTableGuid", &gLoadFixedAddressConfigurationTableGuid, NULL } | |
49 | }; | |
50 | ||
51 | /** | |
52 | Display a row containing a GUID value | |
53 | ||
54 | @param [in] SocketFD The socket's file descriptor to add to the list. | |
55 | @param [in] pPort The WSDT_PORT structure address | |
56 | @param [in] pName Address of a zero terminated name string | |
57 | @param [in] pGuid Address of the GUID to display | |
58 | ||
59 | @retval EFI_SUCCESS The request was successfully processed | |
60 | ||
61 | **/ | |
62 | EFI_STATUS | |
63 | RowGuid ( | |
64 | IN int SocketFD, | |
65 | IN WSDT_PORT * pPort, | |
66 | IN CONST CHAR8 * pName, | |
67 | IN CONST EFI_GUID * pGuid | |
68 | ) | |
69 | { | |
70 | CONST GUID_NAME * pGuidName; | |
71 | CONST GUID_NAME * pGuidNameEnd; | |
72 | EFI_STATUS Status; | |
73 | UINTN Value; | |
74 | ||
75 | DBG_ENTER ( ); | |
76 | ||
77 | // | |
78 | // Use for/break instead of goto | |
79 | // | |
80 | for ( ; ; ) { | |
81 | Status = HttpSendAnsiString ( SocketFD, | |
82 | pPort, | |
83 | "<tr><td>" ); | |
84 | if ( EFI_ERROR ( Status )) { | |
85 | break; | |
86 | } | |
87 | Status = HttpSendAnsiString ( SocketFD, | |
88 | pPort, | |
89 | pName ); | |
90 | if ( EFI_ERROR ( Status )) { | |
91 | break; | |
92 | } | |
93 | Status = HttpSendAnsiString ( SocketFD, | |
94 | pPort, | |
95 | "</td><td><code>" ); | |
96 | if ( EFI_ERROR ( Status )) { | |
97 | break; | |
98 | } | |
99 | ||
100 | // | |
101 | // Determine if this is a known GUID | |
102 | // | |
103 | pGuidName = &mGuidName[0]; | |
59bc0593 | 104 | pGuidNameEnd = &pGuidName[ sizeof ( mGuidName ) / sizeof ( mGuidName[0])]; |
4684b66f | 105 | while ( pGuidNameEnd > pGuidName ) { |
106 | if ( CompareGuid ( pGuidName->pGuid, pGuid )) { | |
107 | // | |
108 | // Display the web link if available | |
109 | // | |
110 | if ( NULL != pGuidName->pWebPage ) { | |
111 | Status = HttpSendAnsiString ( SocketFD, | |
112 | pPort, | |
113 | "<a target=\"_blank\" href=\"" ); | |
114 | if ( EFI_ERROR ( Status )) { | |
115 | break; | |
116 | } | |
117 | Status = HttpSendUnicodeString ( SocketFD, | |
118 | pPort, | |
119 | pGuidName->pWebPage ); | |
120 | if ( EFI_ERROR ( Status )) { | |
121 | break; | |
122 | } | |
123 | Status = HttpSendAnsiString ( SocketFD, | |
124 | pPort, | |
125 | "\">" ); | |
126 | if ( EFI_ERROR ( Status )) { | |
127 | break; | |
128 | } | |
129 | } | |
130 | ||
131 | // | |
132 | // Display the GUID name | |
133 | // | |
134 | Status = HttpSendUnicodeString ( SocketFD, | |
135 | pPort, | |
136 | pGuidName->GuidName ); | |
137 | ||
138 | // | |
139 | // Complete the web link if available | |
140 | // | |
141 | if ( NULL != pGuidName->pWebPage ) { | |
142 | if ( EFI_ERROR ( Status )) { | |
143 | break; | |
144 | } | |
145 | Status = HttpSendAnsiString ( SocketFD, | |
146 | pPort, | |
147 | "</a>" ); | |
148 | } | |
149 | break; | |
150 | } | |
151 | ||
152 | // | |
153 | // Set the next GUID name | |
154 | // | |
155 | pGuidName += 1; | |
156 | } | |
157 | if ( EFI_ERROR ( Status )) { | |
158 | break; | |
159 | } | |
160 | ||
161 | // | |
162 | // Only if the entry is not known, display the GUID and type | |
163 | // | |
164 | if ( pGuidNameEnd <= pGuidName ) { | |
165 | // | |
166 | // Display the GUID | |
167 | // | |
168 | Status = HttpSendGuid ( SocketFD, | |
169 | pPort, | |
170 | pGuid ); | |
171 | if ( EFI_ERROR ( Status )) { | |
172 | break; | |
173 | } | |
174 | ||
175 | // | |
176 | // Display the GUID type | |
177 | // | |
178 | Status = HttpSendAnsiString ( SocketFD, | |
179 | pPort, | |
180 | "<br/><a target=\"_blank\" href=\"http://www.ietf.org/rfc/rfc4122.txt\">Guid Type</a>: " ); | |
181 | if ( EFI_ERROR ( Status )) { | |
182 | break; | |
183 | } | |
184 | Value = pGuid->Data4[1]; | |
185 | Value >>= 5; | |
186 | if ( 3 >= Value ) { | |
187 | // | |
188 | // Network type | |
189 | // | |
190 | Status = HttpSendAnsiString ( SocketFD, | |
191 | pPort, | |
192 | "Network " ); | |
193 | } | |
194 | else if ( 5 >= Value ) { | |
195 | // | |
196 | // Standard type | |
197 | // | |
198 | Status = HttpSendAnsiString ( SocketFD, | |
199 | pPort, | |
200 | "Standard " ); | |
201 | if ( EFI_ERROR ( Status )) { | |
202 | break; | |
203 | } | |
204 | ||
205 | // | |
206 | // Decode the standard type using RFC 4122 | |
207 | // | |
208 | Value = pGuid->Data3; | |
209 | Value >>= 12; | |
210 | switch ( Value ) { | |
211 | default: | |
212 | // | |
213 | // Display the MAC address | |
214 | // | |
215 | Status = HttpSendAnsiString ( SocketFD, | |
216 | pPort, | |
217 | "Version " ); | |
218 | if ( EFI_ERROR ( Status )) { | |
219 | break; | |
220 | } | |
221 | Status = HttpSendValue ( SocketFD, | |
222 | pPort, | |
223 | pGuid->Data3 >> 12 ); | |
224 | break; | |
225 | ||
226 | case 1: | |
227 | Status = HttpSendAnsiString ( SocketFD, | |
228 | pPort, | |
229 | "MAC address" ); | |
230 | break; | |
231 | ||
232 | case 2: | |
233 | Status = HttpSendAnsiString ( SocketFD, | |
234 | pPort, | |
235 | "DCE Security" ); | |
236 | break; | |
237 | ||
238 | case 3: | |
239 | Status = HttpSendAnsiString ( SocketFD, | |
240 | pPort, | |
241 | "MD5 hash" ); | |
242 | break; | |
243 | ||
244 | case 4: | |
245 | Status = HttpSendAnsiString ( SocketFD, | |
246 | pPort, | |
247 | "Random" ); | |
248 | break; | |
249 | ||
250 | case 5: | |
251 | Status = HttpSendAnsiString ( SocketFD, | |
252 | pPort, | |
253 | "SHA-1 hash" ); | |
254 | break; | |
255 | } | |
256 | } | |
257 | else if ( 6 == Value ) { | |
258 | // | |
259 | // Microsoft's Component Object Model (COM) type | |
260 | // | |
261 | Status = HttpSendAnsiString ( SocketFD, | |
262 | pPort, | |
263 | "Microsoft COM" ); | |
264 | } | |
265 | else { | |
266 | // | |
267 | // Reserved type | |
268 | // | |
269 | Status = HttpSendAnsiString ( SocketFD, | |
270 | pPort, | |
271 | "Reserved" ); | |
272 | } | |
273 | } | |
274 | ||
275 | // | |
276 | // Done with this entry | |
277 | // | |
278 | Status = HttpSendAnsiString ( SocketFD, | |
279 | pPort, | |
280 | "</code></td></tr>\r\n" ); | |
281 | break; | |
282 | } | |
283 | ||
284 | // | |
285 | // Return the operation status | |
286 | // | |
287 | DBG_EXIT_STATUS ( Status ); | |
288 | return Status; | |
289 | } | |
290 | ||
291 | ||
292 | /** | |
293 | Respond with the configuration tables | |
294 | ||
295 | @param [in] SocketFD The socket's file descriptor to add to the list. | |
296 | @param [in] pPort The WSDT_PORT structure address | |
297 | @param [out] pbDone Address to receive the request completion status | |
298 | ||
299 | @retval EFI_SUCCESS The request was successfully processed | |
300 | ||
301 | **/ | |
302 | EFI_STATUS | |
303 | ConfigurationTablePage ( | |
304 | IN int SocketFD, | |
305 | IN WSDT_PORT * pPort, | |
306 | OUT BOOLEAN * pbDone | |
307 | ) | |
308 | { | |
309 | EFI_CONFIGURATION_TABLE * pEnd; | |
310 | EFI_CONFIGURATION_TABLE * pTable; | |
311 | EFI_STATUS Status; | |
312 | ||
313 | DBG_ENTER ( ); | |
314 | ||
315 | // | |
316 | // Send the system table page | |
317 | // | |
318 | for ( ; ; ) { | |
319 | // | |
320 | // Send the page and table header | |
321 | // | |
322 | Status = TableHeader ( SocketFD, pPort, L"Configuration Tables", gST ); | |
323 | if ( EFI_ERROR ( Status )) { | |
324 | break; | |
325 | } | |
326 | ||
327 | // | |
328 | // Display the table size | |
329 | // | |
330 | Status = RowDecimalValue ( SocketFD, | |
331 | pPort, | |
332 | "Entries", | |
333 | gST->NumberOfTableEntries ); | |
334 | if ( EFI_ERROR ( Status )) { | |
335 | break; | |
336 | } | |
337 | ||
338 | // | |
339 | // Determine the location of the configuration tables | |
340 | // | |
341 | pTable = gST->ConfigurationTable; | |
59bc0593 | 342 | pEnd = &pTable[ gST->NumberOfTableEntries ]; |
4684b66f | 343 | while ( pEnd > pTable ) { |
344 | Status = RowGuid ( SocketFD, | |
345 | pPort, | |
346 | "VendorGuid", | |
347 | &pTable->VendorGuid ); | |
348 | if ( EFI_ERROR ( Status )) { | |
349 | break; | |
350 | } | |
351 | Status = RowPointer ( SocketFD, | |
352 | pPort, | |
353 | "VendorTable", | |
354 | (VOID *)pTable->VendorTable, | |
355 | NULL ); | |
356 | if ( EFI_ERROR ( Status )) { | |
357 | break; | |
358 | } | |
359 | ||
360 | // | |
361 | // Set the next row | |
362 | // | |
363 | pTable += 1; | |
364 | } | |
365 | ||
366 | // | |
367 | // Build the table trailer | |
368 | // | |
369 | Status = TableTrailer ( SocketFD, | |
370 | pPort, | |
371 | pbDone ); | |
372 | break; | |
373 | } | |
374 | ||
375 | // | |
376 | // Return the operation status | |
377 | // | |
378 | DBG_EXIT_STATUS ( Status ); | |
379 | return Status; | |
380 | } |