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 runtime services table |
23 | |
24 | **/ |
25 | |
26 | #include <WebServer.h> |
27 | #include <Guid/Acpi.h> |
28 | #include <IndustryStandard/Acpi10.h> |
29 | #include <IndustryStandard/Acpi30.h> |
30 | |
31 | #pragma warning ( disable : 4305 ) |
32 | |
33 | // |
34 | // Ensure proper structure formats |
35 | // |
36 | #pragma pack(1) |
37 | |
38 | typedef struct { |
39 | UINT8 AddressSpaceId; |
40 | UINT8 RegisterBitWidth; |
41 | UINT8 RegisterBitOffset; |
42 | UINT8 AccessSize; |
43 | UINT64 Address; |
44 | } GENERIC_ADDRESS; |
45 | |
46 | |
47 | typedef struct { |
48 | UINT32 Signature; // 0 |
49 | UINT32 Length; // 4 |
50 | UINT8 Revision; // 8 |
51 | UINT8 Checksum; // 9 |
52 | UINT8 OemId[6]; // 10 |
53 | UINT8 OemTableId[8]; // 16 |
54 | UINT32 OemRevision; // 24 |
55 | UINT32 CreatorId; // 28 |
56 | UINT32 CreatorRevision; // 32 |
57 | UINT8 DefinitionBlock[1]; // 36 |
58 | } ACPI_DSDT; |
59 | |
60 | |
61 | typedef struct { |
62 | UINT32 Signature; // 0 |
63 | UINT32 Length; // 4 |
64 | UINT8 Revision; // 8 |
65 | UINT8 Checksum; // 9 |
66 | UINT8 OemId[6]; // 10 |
67 | UINT8 OemTableId[8]; // 16 |
68 | UINT32 OemRevision; // 24 |
69 | UINT32 CreatorId; // 28 |
70 | UINT32 CreatorRevision; // 32 |
71 | UINT32 FirmwareCtrl; // 36 |
72 | UINT32 DSDT; // 40 |
73 | UINT8 Reserved; // 44 |
74 | UINT8 PreferredPmProfile; // 45 |
75 | UINT16 SciInt; // 46 |
76 | UINT32 SmiCmd; // 48 |
77 | UINT8 AcpiEnable; // 52 |
78 | UINT8 AcpiDisable; // 53 |
79 | UINT8 S4BiosReq; // 54 |
80 | UINT8 PStateCnt; // 55 |
81 | UINT32 Pm1aEvtBlk; // 56 |
82 | UINT32 Pm1bEvtBlk; // 60 |
83 | UINT32 Pm1aCntBlk; // 64 |
84 | UINT32 Pm1bCntBlk; // 68 |
85 | UINT32 Pm2CntBlk; // 72 |
86 | UINT32 PmTmrBlk; // 76 |
87 | UINT32 Gpe0Blk; // 80 |
88 | UINT32 Gpe1Blk; // 84 |
89 | UINT8 Pm1EvtLen; // 88 |
90 | UINT8 Pm1CntLen; // 89 |
91 | UINT8 PM2CntLen; // 90 |
92 | UINT8 PmTmrLen; // 91 |
93 | UINT8 Gpe0BlkLen; // 92 |
94 | UINT8 Gpe1BlkLen; // 93 |
95 | UINT8 Gpe1Base; // 94 |
96 | UINT8 CstCnt; // 95 |
97 | UINT16 PLvl2Lat; // 96 |
98 | UINT16 PLvl3Lat; // 98 |
99 | UINT16 FlushSize; // 100 |
100 | UINT16 FlushStride; // 102 |
101 | UINT8 DutyOffset; // 104 |
102 | UINT8 DutyWidth; // 105 |
103 | UINT8 DayAlrm; // 106 |
104 | UINT8 MonAlrm; // 107 |
105 | UINT8 Century; // 108 |
106 | UINT16 IapcBootArch; // 109 |
107 | UINT8 Reserved2; // 111 |
108 | UINT32 Flags; // 112 |
109 | UINT32 ResetReg [3]; // 116 |
110 | UINT8 ResetValue; // 128 |
111 | UINT8 Reserved3 [3]; // 129 |
112 | UINT64 XFirmwareCtrl; // 132 |
113 | UINT64 XDsdt; // 140 |
114 | UINT32 XPm1aEvtBlk [3]; // 148 |
115 | UINT32 XPm1bEvtBlk [3]; // 160 |
116 | UINT32 XPm1aCntBlk [3]; // 172 |
117 | UINT32 XPm1bCntBlk [3]; // 184 |
118 | UINT32 XPm2CntBlk [3]; // 196 |
119 | UINT32 XPmTmrBlk [3]; // 208 |
120 | UINT32 XGpe0Blk [3]; // 220 |
121 | UINT32 XGpe1Blk [3]; // 232 |
122 | } ACPI_FADT; |
123 | |
124 | |
125 | typedef struct { |
126 | UINT32 Signature; |
127 | UINT32 Length; |
128 | UINT8 Revision; |
129 | UINT8 Checksum; |
130 | UINT8 OemId[6]; |
131 | UINT8 OemTableId[8]; |
132 | UINT32 OemRevision; |
133 | UINT32 CreatorId; |
134 | UINT32 CreatorRevision; |
135 | UINT32 Entry[1]; |
136 | } ACPI_RSDT; |
137 | |
138 | |
139 | #pragma pack() |
140 | |
141 | |
142 | typedef struct { |
143 | UINT32 Signature; |
144 | CONST CHAR8 * pTableName; |
145 | CONST CHAR16 * pWebPage; |
146 | } TABLE_SIGNATURE; |
147 | |
148 | |
149 | CONST TABLE_SIGNATURE mTableId [] = { |
150 | { DSDT_SIGNATURE, "DSDT", PAGE_ACPI_DSDT }, |
151 | { FADT_SIGNATURE, "FADT", PAGE_ACPI_FADT } |
152 | }; |
153 | |
154 | |
155 | /** |
156 | Locate the RSDT table |
157 | |
158 | @returns Table address or NULL if not found |
159 | |
160 | **/ |
161 | CONST ACPI_RSDT * |
162 | LocateRsdt ( |
163 | VOID |
164 | ) |
165 | { |
166 | CONST EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER * pRsdp10b; |
167 | CONST EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER * pRsdp30; |
168 | CONST ACPI_RSDT * pRsdt; |
169 | EFI_STATUS Status; |
170 | |
171 | // |
172 | // Use for/break instead of goto |
173 | // |
174 | pRsdt = NULL; |
175 | for ( ; ; ) { |
176 | // |
177 | // Locate the RSDT |
178 | // |
179 | Status = EfiGetSystemConfigurationTable ( &gEfiAcpiTableGuid, (VOID **)&pRsdp30 ); |
180 | if ( !EFI_ERROR ( Status )) { |
181 | pRsdt = (ACPI_RSDT *)pRsdp30->RsdtAddress; |
182 | } |
183 | else { |
184 | Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **)&pRsdp10b ); |
185 | if ( EFI_ERROR ( Status )) { |
186 | break; |
187 | } |
188 | pRsdt = (ACPI_RSDT *)pRsdp10b->RsdtAddress; |
189 | } |
190 | break; |
191 | } |
192 | |
193 | // |
194 | // The entry was not found |
195 | // |
196 | return pRsdt; |
197 | } |
198 | |
199 | |
200 | /** |
201 | Locate the specified table |
202 | |
203 | @param [in] Signature Table signature |
204 | |
205 | @returns Table address or NULL if not found |
206 | |
207 | **/ |
208 | CONST VOID * |
209 | LocateTable ( |
210 | IN UINT32 Signature |
211 | ) |
212 | { |
213 | CONST UINT32 * pEnd; |
214 | CONST UINT32 * pEntry; |
215 | CONST EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER * pRsdp10b; |
216 | CONST EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER * pRsdp30; |
217 | CONST ACPI_RSDT * pRsdt; |
218 | CONST UINT32 * pSignature; |
219 | EFI_STATUS Status; |
220 | |
221 | // |
222 | // Use for/break instead of goto |
223 | // |
224 | for ( ; ; ) { |
225 | // |
226 | // Locate the RSDT |
227 | // |
228 | Status = EfiGetSystemConfigurationTable ( &gEfiAcpiTableGuid, (VOID **)&pRsdp30 ); |
229 | if ( !EFI_ERROR ( Status )) { |
230 | pRsdt = (ACPI_RSDT *)pRsdp30->RsdtAddress; |
231 | } |
232 | else { |
233 | Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **)&pRsdp10b ); |
234 | if ( EFI_ERROR ( Status )) { |
235 | break; |
236 | } |
237 | pRsdt = (ACPI_RSDT *)pRsdp10b->RsdtAddress; |
238 | } |
239 | |
240 | // |
241 | // Walk the list of entries |
242 | // |
243 | pEntry = &pRsdt->Entry [ 0 ]; |
244 | pEnd = &pEntry [(( pRsdt->Length - sizeof ( *pRsdt )) >> 2 ) + 1 ]; |
245 | while ( pEnd > pEntry ) { |
246 | // |
247 | // The entry is actually a 32-bit physical table address |
248 | // The first entry in the table is the 32-bit table signature |
249 | // |
250 | pSignature = (UINT32 *)*pEntry; |
251 | if ( *pSignature == Signature ) { |
252 | return (CONST VOID *) *pEntry; |
253 | } |
254 | |
255 | // |
256 | // Set the next entry |
257 | // |
258 | pEntry++; |
259 | } |
260 | break; |
261 | } |
262 | |
263 | // |
264 | // The entry was not found |
265 | // |
266 | return NULL; |
267 | } |
268 | |
269 | |
270 | /** |
271 | Display a row containing a hex value |
272 | |
273 | @param [in] SocketFD The socket's file descriptor to add to the list. |
274 | @param [in] pPort The WSDT_PORT structure address |
275 | @param [in] pName Address of a zero terminated name string |
276 | @param [in] Length Length in bytes |
277 | @param [in] pChar Address of the first character |
278 | |
279 | @retval EFI_SUCCESS The request was successfully processed |
280 | |
281 | **/ |
282 | EFI_STATUS |
283 | RowAnsiArray ( |
284 | IN int SocketFD, |
285 | IN WSDT_PORT * pPort, |
286 | IN CONST CHAR8 * pName, |
287 | IN UINTN Length, |
288 | IN CONST CHAR8 * pChar |
289 | ) |
290 | { |
291 | CONST CHAR8 * pData; |
292 | CONST CHAR8 * pEnd; |
293 | EFI_STATUS Status; |
294 | |
295 | DBG_ENTER ( ); |
296 | |
297 | // |
298 | // Use for/break instead of goto |
299 | // |
300 | for ( ; ; ) { |
301 | // |
302 | // Start the row |
303 | // |
304 | Status = HttpSendAnsiString ( SocketFD, |
305 | pPort, |
306 | "<tr><td>" ); |
307 | if ( EFI_ERROR ( Status )) { |
308 | break; |
309 | } |
310 | Status = HttpSendAnsiString ( SocketFD, |
311 | pPort, |
312 | pName ); |
313 | if ( EFI_ERROR ( Status )) { |
314 | break; |
315 | } |
316 | Status = HttpSendAnsiString ( SocketFD, |
317 | pPort, |
318 | "</td><td><code>" ); |
319 | if ( EFI_ERROR ( Status )) { |
320 | break; |
321 | } |
322 | |
323 | // |
324 | // Display the characters |
325 | // |
326 | pData = pChar; |
327 | pEnd = &pChar [ Length ]; |
328 | while ( pEnd > pData ) { |
329 | Status = HttpSendCharacter ( SocketFD, |
330 | pPort, |
331 | *pData++, |
332 | " " ); |
333 | if ( EFI_ERROR ( Status )) { |
334 | break; |
335 | } |
336 | } |
337 | if ( EFI_ERROR ( Status )) { |
338 | break; |
339 | } |
340 | |
341 | // |
342 | // Display the byte values |
343 | // |
344 | Status = HttpSendAnsiString ( SocketFD, |
345 | pPort, |
346 | "<br/>0x" ); |
347 | if ( EFI_ERROR ( Status )) { |
348 | break; |
349 | } |
350 | pData = pChar; |
351 | while ( pEnd > pData ) { |
352 | Status = HttpSendHexBits ( SocketFD, |
353 | pPort, |
354 | 8, |
355 | *pData++ ); |
356 | if ( EFI_ERROR ( Status )) { |
357 | break; |
358 | } |
359 | if ( pEnd > pData ) { |
360 | Status = HttpSendAnsiString ( SocketFD, |
361 | pPort, |
362 | " 0x" ); |
363 | if ( EFI_ERROR ( Status )) { |
364 | break; |
365 | } |
366 | } |
367 | } |
368 | |
369 | // |
370 | // Terminate the row |
371 | // |
372 | Status = HttpSendAnsiString ( SocketFD, |
373 | pPort, |
374 | "</code></td></tr>\r\n" ); |
375 | break; |
376 | } |
377 | |
378 | // |
379 | // Return the operation status |
380 | // |
381 | DBG_EXIT_STATUS ( Status ); |
382 | return Status; |
383 | } |
384 | |
385 | |
386 | /** |
387 | Format a row with a list of bytes |
388 | |
389 | @param [in] SocketFD The socket's file descriptor to add to the list. |
390 | @param [in] pPort The WSDT_PORT structure address |
391 | @param [in] pName Zero terminated name string |
392 | @param [in] ByteCount The number of bytes to display |
393 | @param [in] pData Address of the byte array |
394 | |
395 | @retval EFI_SUCCESS The request was successfully processed |
396 | |
397 | **/ |
398 | EFI_STATUS |
399 | RowBytes ( |
400 | IN int SocketFD, |
401 | IN WSDT_PORT * pPort, |
402 | IN CHAR8 * pName, |
403 | IN UINTN ByteCount, |
404 | IN CONST UINT8 * pData |
405 | ) |
406 | { |
407 | CONST UINT8 * pEnd; |
408 | EFI_STATUS Status; |
409 | |
410 | // |
411 | // Use for/break instead of goto |
412 | // |
413 | for ( ; ; ) { |
414 | // |
415 | // Start the row |
416 | // |
417 | Status = HttpSendAnsiString ( SocketFD, |
418 | pPort, |
419 | "<tr><td>" ); |
420 | if ( EFI_ERROR ( Status )) { |
421 | break; |
422 | } |
423 | |
424 | // |
425 | // Display the field name |
426 | // |
427 | Status = HttpSendAnsiString ( SocketFD, |
428 | pPort, |
429 | pName ); |
430 | if ( EFI_ERROR ( Status )) { |
431 | break; |
432 | } |
433 | |
434 | // |
435 | // Display the field value |
436 | // |
437 | Status = HttpSendAnsiString ( SocketFD, |
438 | pPort, |
439 | "</td><td><code>0x" ); |
440 | if ( EFI_ERROR ( Status )) { |
441 | break; |
442 | } |
443 | pEnd = &pData [ ByteCount ]; |
444 | while ( pEnd > pData ) { |
445 | Status = HttpSendHexBits ( SocketFD, |
446 | pPort, |
447 | 8, |
448 | *pData++ ); |
449 | if ( EFI_ERROR ( Status )) { |
450 | break; |
451 | } |
452 | if ( pEnd > pData ) { |
453 | Status = HttpSendAnsiString ( SocketFD, |
454 | pPort, |
455 | " 0x" ); |
456 | if ( EFI_ERROR ( Status )) { |
457 | break; |
458 | } |
459 | } |
460 | } |
461 | if ( EFI_ERROR ( Status )) { |
462 | break; |
463 | } |
464 | |
465 | // |
466 | // Terminate the row |
467 | // |
468 | Status = HttpSendAnsiString ( SocketFD, |
469 | pPort, |
470 | "</code></td></tr>\r\n" ); |
471 | break; |
472 | } |
473 | |
474 | // |
475 | // Return the operation status |
476 | // |
477 | return Status; |
478 | } |
479 | |
480 | |
481 | /** |
482 | Format a row with a list of bytes |
483 | |
484 | @param [in] SocketFD The socket's file descriptor to add to the list. |
485 | @param [in] pPort The WSDT_PORT structure address |
486 | @param [in] pName Zero terminated name string |
487 | @param [in] ByteCount The number of bytes to display |
488 | @param [in] pData Address of the byte array |
489 | |
490 | @retval EFI_SUCCESS The request was successfully processed |
491 | |
492 | **/ |
493 | EFI_STATUS |
494 | RowDump ( |
495 | IN int SocketFD, |
496 | IN WSDT_PORT * pPort, |
497 | IN CHAR8 * pName, |
498 | IN UINTN ByteCount, |
499 | IN CONST UINT8 * pData |
500 | ) |
501 | { |
502 | EFI_STATUS Status; |
503 | |
504 | // |
505 | // Use for/break instead of goto |
506 | // |
507 | for ( ; ; ) { |
508 | // |
509 | // Start the row |
510 | // |
511 | Status = HttpSendAnsiString ( SocketFD, |
512 | pPort, |
513 | "<tr><td>" ); |
514 | if ( EFI_ERROR ( Status )) { |
515 | break; |
516 | } |
517 | |
518 | // |
519 | // Display the field name |
520 | // |
521 | Status = HttpSendAnsiString ( SocketFD, |
522 | pPort, |
523 | pName ); |
524 | if ( EFI_ERROR ( Status )) { |
525 | break; |
526 | } |
527 | |
528 | // |
529 | // Start the field value |
530 | // |
531 | Status = HttpSendAnsiString ( SocketFD, |
532 | pPort, |
533 | "</td><td>" ); |
534 | if ( EFI_ERROR ( Status )) { |
535 | break; |
536 | } |
537 | |
538 | // |
539 | // Dump the buffer |
540 | // |
541 | Status = HttpSendDump ( SocketFD, |
542 | pPort, |
543 | ByteCount, |
544 | pData ); |
545 | |
546 | // |
547 | // Terminate the field value and row |
548 | // |
549 | Status = HttpSendAnsiString ( SocketFD, |
550 | pPort, |
551 | "</td></tr>\r\n" ); |
552 | break; |
553 | } |
554 | |
555 | // |
556 | // Return the operation status |
557 | // |
558 | return Status; |
559 | } |
560 | |
561 | |
562 | /** |
563 | Format a row with a general address |
564 | |
565 | @param [in] SocketFD The socket's file descriptor to add to the list. |
566 | @param [in] pPort The WSDT_PORT structure address |
567 | @param [in] pName Zero terminated name string |
568 | @param [in] pAddr Address of the general address buffer |
569 | @param [in] pWebPage Zero terminated web page address |
570 | |
571 | @retval EFI_SUCCESS The request was successfully processed |
572 | |
573 | **/ |
574 | EFI_STATUS |
575 | RowGenericAddress ( |
576 | IN int SocketFD, |
577 | IN WSDT_PORT * pPort, |
578 | IN CHAR8 * pName, |
579 | IN CONST UINT32 * pAddr, |
580 | IN CONST CHAR16 * pWebPage |
581 | ) |
582 | { |
583 | CONST GENERIC_ADDRESS * pGenericAddress; |
584 | EFI_STATUS Status; |
585 | |
586 | // |
587 | // Use for/break instead of goto |
588 | // |
589 | for ( ; ; ) { |
590 | // |
591 | // Start the row |
592 | // |
593 | Status = HttpSendAnsiString ( SocketFD, |
594 | pPort, |
595 | "<tr><td>" ); |
596 | if ( EFI_ERROR ( Status )) { |
597 | break; |
598 | } |
599 | |
600 | // |
601 | // Display the field name |
602 | // |
603 | Status = HttpSendAnsiString ( SocketFD, |
604 | pPort, |
605 | pName ); |
606 | if ( EFI_ERROR ( Status )) { |
607 | break; |
608 | } |
609 | |
610 | // |
611 | // Display the field value |
612 | // |
613 | Status = HttpSendAnsiString ( SocketFD, |
614 | pPort, |
615 | "</td><td><code>" ); |
616 | if ( EFI_ERROR ( Status )) { |
617 | break; |
618 | } |
619 | |
620 | // |
621 | // Determine the type of address |
622 | // |
623 | pGenericAddress = (CONST GENERIC_ADDRESS *)pAddr; |
624 | if ( 0 == pGenericAddress->AddressSpaceId ) { |
625 | Status = HttpSendAnsiString ( SocketFD, pPort, "System Memory" ); |
626 | } |
627 | else if ( 1 == pGenericAddress->AddressSpaceId ) { |
628 | Status = HttpSendAnsiString ( SocketFD, pPort, "I/O Space" ); |
629 | } |
630 | else if ( 2 == pGenericAddress->AddressSpaceId ) { |
631 | Status = HttpSendAnsiString ( SocketFD, pPort, "PCI Configuration Space" ); |
632 | } |
633 | else if ( 3 == pGenericAddress->AddressSpaceId ) { |
634 | Status = HttpSendAnsiString ( SocketFD, pPort, "Embedded Controller" ); |
635 | } |
636 | else if ( 4 == pGenericAddress->AddressSpaceId ) { |
637 | Status = HttpSendAnsiString ( SocketFD, pPort, "SMBus" ); |
638 | } |
639 | else if ( 0x7f == pGenericAddress->AddressSpaceId ) { |
640 | Status = HttpSendAnsiString ( SocketFD, pPort, "Functional Fixed Hardware" ); |
641 | } |
642 | else if (( 0xc0 <= pGenericAddress->AddressSpaceId ) |
643 | && ( 0xff >= pGenericAddress->AddressSpaceId )) { |
644 | Status = HttpSendAnsiString ( SocketFD, pPort, "OEM Defined" ); |
645 | } |
646 | else { |
647 | Status = HttpSendAnsiString ( SocketFD, pPort, "Reserved" ); |
648 | } |
649 | if ( EFI_ERROR ( Status )) { |
650 | break; |
651 | } |
652 | Status = HttpSendAnsiString ( SocketFD, |
653 | pPort, |
654 | "<br/>Register Bit Width: " ); |
655 | if ( EFI_ERROR ( Status )) { |
656 | break; |
657 | } |
658 | Status = HttpSendValue ( SocketFD, |
659 | pPort, |
660 | pGenericAddress->RegisterBitWidth ); |
661 | if ( EFI_ERROR ( Status )) { |
662 | break; |
663 | } |
664 | Status = HttpSendAnsiString ( SocketFD, |
665 | pPort, |
666 | "<br/>Register Bit Offset: " ); |
667 | if ( EFI_ERROR ( Status )) { |
668 | break; |
669 | } |
670 | Status = HttpSendHexValue ( SocketFD, |
671 | pPort, |
672 | pGenericAddress->RegisterBitOffset ); |
673 | if ( EFI_ERROR ( Status )) { |
674 | break; |
675 | } |
676 | Status = HttpSendAnsiString ( SocketFD, |
677 | pPort, |
678 | "<br/>Access Size: " ); |
679 | if ( EFI_ERROR ( Status )) { |
680 | break; |
681 | } |
682 | Status = HttpSendValue ( SocketFD, |
683 | pPort, |
684 | pGenericAddress->AccessSize ); |
685 | if ( EFI_ERROR ( Status )) { |
686 | break; |
687 | } |
688 | Status = HttpSendAnsiString ( SocketFD, |
689 | pPort, |
690 | "<br/>Address: " ); |
691 | if ( EFI_ERROR ( Status )) { |
692 | break; |
693 | } |
694 | |
695 | // |
696 | // Add the web-page link if necessary |
697 | // |
698 | if ( NULL != pWebPage ) { |
699 | Status = HttpSendAnsiString ( SocketFD, |
700 | pPort, |
701 | "<a target=\"_blank\" href=\"" ); |
702 | if ( EFI_ERROR ( Status )) { |
703 | break; |
704 | } |
705 | Status = HttpSendUnicodeString ( SocketFD, |
706 | pPort, |
707 | pWebPage ); |
708 | if ( EFI_ERROR ( Status )) { |
709 | break; |
710 | } |
711 | Status = HttpSendAnsiString ( SocketFD, |
712 | pPort, |
713 | "\">" ); |
714 | if ( EFI_ERROR ( Status )) { |
715 | break; |
716 | } |
717 | } |
718 | |
719 | // |
720 | // Display the address |
721 | // |
722 | Status = HttpSendAnsiString ( SocketFD, |
723 | pPort, |
724 | "0x" ); |
725 | if ( EFI_ERROR ( Status )) { |
726 | break; |
727 | } |
728 | Status = HttpSendHexBits ( SocketFD, |
729 | pPort, |
730 | 64, |
731 | pGenericAddress->Address ); |
732 | if ( EFI_ERROR ( Status )) { |
733 | break; |
734 | } |
735 | |
736 | // |
737 | // Finish the web-page link if necessary |
738 | // |
739 | if ( NULL != pWebPage ) { |
740 | Status = HttpSendAnsiString ( SocketFD, |
741 | pPort, |
742 | "</a>" ); |
743 | if ( EFI_ERROR ( Status )) { |
744 | break; |
745 | } |
746 | } |
747 | |
748 | // |
749 | // Terminate the row |
750 | // |
751 | Status = HttpSendAnsiString ( SocketFD, |
752 | pPort, |
753 | "</code></td></tr>\r\n" ); |
754 | break; |
755 | } |
756 | |
757 | // |
758 | // Return the operation status |
759 | // |
760 | return Status; |
761 | } |
762 | |
763 | |
764 | /** |
765 | Translate a table address into a web page |
766 | |
767 | @param [in] pSignature Address of the table signature |
768 | @param [out] ppTableName Address to receive the table name address |
769 | |
770 | @returns Zero terminated web page address or NULL if not found |
771 | |
772 | **/ |
773 | CONST CHAR16 * |
774 | SignatureLookup ( |
775 | IN UINT32 * pSignature, |
776 | OUT CONST CHAR8 ** ppTableName |
777 | ) |
778 | { |
779 | CONST TABLE_SIGNATURE * pTableId; |
780 | CONST TABLE_SIGNATURE * pEnd; |
781 | UINT32 Signature; |
782 | |
783 | // |
784 | // Walk the list of tables |
785 | // |
786 | Signature = *pSignature; |
787 | pTableId = &mTableId [ 0 ]; |
788 | pEnd = &pTableId [ sizeof ( mTableId ) / sizeof ( mTableId [ 0 ])]; |
789 | while ( pEnd > pTableId ) { |
790 | // |
791 | // Attempt to locate the table signature |
792 | // |
793 | if ( pTableId->Signature == Signature ) { |
794 | // |
795 | // The signature was found |
796 | // Return the web page |
797 | // |
798 | *ppTableName = pTableId->pTableName; |
799 | return pTableId->pWebPage; |
800 | } |
801 | |
802 | // |
803 | // Set the next table |
804 | // |
805 | pTableId += 1; |
806 | } |
807 | |
808 | // |
809 | // The table was not found |
810 | // |
811 | *ppTableName = (CONST CHAR8 *)pSignature; |
812 | return NULL; |
813 | } |
814 | |
815 | |
816 | /** |
817 | Respond with the ACPI DSDT table |
818 | |
819 | @param [in] SocketFD The socket's file descriptor to add to the list. |
820 | @param [in] pPort The WSDT_PORT structure address |
821 | @param [out] pbDone Address to receive the request completion status |
822 | |
823 | @retval EFI_SUCCESS The request was successfully processed |
824 | |
825 | **/ |
826 | EFI_STATUS |
827 | AcpiDsdtPage ( |
828 | IN int SocketFD, |
829 | IN WSDT_PORT * pPort, |
830 | OUT BOOLEAN * pbDone |
831 | ) |
832 | { |
833 | CONST ACPI_DSDT * pDsdt; |
834 | CONST ACPI_FADT * pFadt; |
835 | EFI_STATUS Status; |
836 | |
837 | DBG_ENTER ( ); |
838 | |
839 | // |
840 | // Send the DADT page |
841 | // |
842 | for ( ; ; ) { |
843 | // |
844 | // Locate the DADT |
845 | // |
846 | pFadt = (ACPI_FADT *)LocateTable ( FADT_SIGNATURE ); |
847 | if ( NULL == pFadt ) { |
848 | Status = EFI_NOT_FOUND; |
849 | break; |
850 | } |
851 | pDsdt = (VOID *)pFadt->XDsdt; |
852 | |
853 | // |
854 | // Send the page and table header |
855 | // |
856 | Status = TableHeader ( SocketFD, pPort, L"DSDT - Differentiated System Description Table", pDsdt ); |
857 | if ( EFI_ERROR ( Status )) { |
858 | break; |
859 | } |
860 | |
861 | // |
862 | // Display the DSDT header |
863 | // |
864 | Status = RowAnsiArray ( SocketFD, |
865 | pPort, |
866 | "Signature", |
867 | sizeof ( pDsdt->Signature ), |
868 | (CHAR8 *)&pDsdt->Signature ); |
869 | if ( EFI_ERROR ( Status )) { |
870 | break; |
871 | } |
872 | Status = RowDecimalValue ( SocketFD, |
873 | pPort, |
874 | "Length", |
875 | pDsdt->Length ); |
876 | if ( EFI_ERROR ( Status )) { |
877 | break; |
878 | } |
879 | Status = RowDecimalValue ( SocketFD, |
880 | pPort, |
881 | "Revision", |
882 | pDsdt->Revision ); |
883 | if ( EFI_ERROR ( Status )) { |
884 | break; |
885 | } |
886 | Status = RowHexValue ( SocketFD, |
887 | pPort, |
888 | "Checksum", |
889 | pDsdt->Checksum, |
890 | NULL ); |
891 | if ( EFI_ERROR ( Status )) { |
892 | break; |
893 | } |
894 | Status = RowAnsiArray ( SocketFD, |
895 | pPort, |
896 | "OEMID", |
897 | sizeof ( pDsdt->OemId ), |
898 | &pDsdt->OemId [ 0 ]); |
899 | if ( EFI_ERROR ( Status )) { |
900 | break; |
901 | } |
902 | Status = RowAnsiArray ( SocketFD, |
903 | pPort, |
904 | "OEM Table ID", |
905 | sizeof ( pDsdt->OemTableId ), |
906 | &pDsdt->OemTableId [ 0 ]); |
907 | if ( EFI_ERROR ( Status )) { |
908 | break; |
909 | } |
910 | Status = RowRevision ( SocketFD, |
911 | pPort, |
912 | "OEM Revision", |
913 | pDsdt->OemRevision ); |
914 | if ( EFI_ERROR ( Status )) { |
915 | break; |
916 | } |
917 | Status = RowAnsiArray ( SocketFD, |
918 | pPort, |
919 | "Creator ID", |
920 | sizeof ( pDsdt->CreatorId ), |
921 | (CHAR8 *)&pDsdt->CreatorId ); |
922 | if ( EFI_ERROR ( Status )) { |
923 | break; |
924 | } |
925 | Status = RowRevision ( SocketFD, |
926 | pPort, |
927 | "Creator Revision", |
928 | pDsdt->CreatorRevision ); |
929 | if ( EFI_ERROR ( Status )) { |
930 | break; |
931 | } |
932 | |
933 | // |
934 | // Display the data from the DSDT |
935 | // |
936 | Status = RowDump ( SocketFD, |
937 | pPort, |
938 | "Definition Block", |
939 | pDsdt->Length - sizeof ( *pDsdt ) + 1, |
940 | &pDsdt->DefinitionBlock[0]); |
941 | if ( EFI_ERROR ( Status )) { |
942 | break; |
943 | } |
944 | |
945 | // |
946 | // Build the table trailer |
947 | // |
948 | Status = TableTrailer ( SocketFD, |
949 | pPort, |
950 | pbDone ); |
951 | break; |
952 | } |
953 | |
954 | // |
955 | // Return the operation status |
956 | // |
957 | DBG_EXIT_STATUS ( Status ); |
958 | return Status; |
959 | } |
960 | |
961 | |
962 | /** |
963 | Respond with the ACPI FADT table |
964 | |
965 | @param [in] SocketFD The socket's file descriptor to add to the list. |
966 | @param [in] pPort The WSDT_PORT structure address |
967 | @param [out] pbDone Address to receive the request completion status |
968 | |
969 | @retval EFI_SUCCESS The request was successfully processed |
970 | |
971 | **/ |
972 | EFI_STATUS |
973 | AcpiFadtPage ( |
974 | IN int SocketFD, |
975 | IN WSDT_PORT * pPort, |
976 | OUT BOOLEAN * pbDone |
977 | ) |
978 | { |
979 | CONST ACPI_FADT * pFadt; |
980 | EFI_STATUS Status; |
981 | |
982 | DBG_ENTER ( ); |
983 | |
984 | // |
985 | // Send the FADT page |
986 | // |
987 | for ( ; ; ) { |
988 | // |
989 | // Locate the FADT |
990 | // |
991 | pFadt = (ACPI_FADT *)LocateTable ( FADT_SIGNATURE ); |
992 | if ( NULL == pFadt ) { |
993 | Status = EFI_NOT_FOUND; |
994 | break; |
995 | } |
996 | |
997 | // |
998 | // Send the page and table header |
999 | // |
1000 | Status = TableHeader ( SocketFD, pPort, L"FADT - Fixed ACPI Description Table", pFadt ); |
1001 | if ( EFI_ERROR ( Status )) { |
1002 | break; |
1003 | } |
1004 | |
1005 | // |
1006 | // Display the FSDT header |
1007 | // |
1008 | Status = RowAnsiArray ( SocketFD, |
1009 | pPort, |
1010 | "Signature", |
1011 | sizeof ( pFadt->Signature ), |
1012 | (CHAR8 *)&pFadt->Signature ); |
1013 | if ( EFI_ERROR ( Status )) { |
1014 | break; |
1015 | } |
1016 | Status = RowDecimalValue ( SocketFD, |
1017 | pPort, |
1018 | "Length", |
1019 | pFadt->Length ); |
1020 | if ( EFI_ERROR ( Status )) { |
1021 | break; |
1022 | } |
1023 | Status = RowDecimalValue ( SocketFD, |
1024 | pPort, |
1025 | "Revision", |
1026 | pFadt->Revision ); |
1027 | if ( EFI_ERROR ( Status )) { |
1028 | break; |
1029 | } |
1030 | Status = RowHexValue ( SocketFD, |
1031 | pPort, |
1032 | "Checksum", |
1033 | pFadt->Checksum, |
1034 | NULL ); |
1035 | if ( EFI_ERROR ( Status )) { |
1036 | break; |
1037 | } |
1038 | Status = RowAnsiArray ( SocketFD, |
1039 | pPort, |
1040 | "OEMID", |
1041 | sizeof ( pFadt->OemId ), |
1042 | &pFadt->OemId [ 0 ]); |
1043 | if ( EFI_ERROR ( Status )) { |
1044 | break; |
1045 | } |
1046 | Status = RowAnsiArray ( SocketFD, |
1047 | pPort, |
1048 | "OEM Table ID", |
1049 | sizeof ( pFadt->OemTableId ), |
1050 | &pFadt->OemTableId [ 0 ]); |
1051 | if ( EFI_ERROR ( Status )) { |
1052 | break; |
1053 | } |
1054 | Status = RowRevision ( SocketFD, |
1055 | pPort, |
1056 | "OEM Revision", |
1057 | pFadt->OemRevision ); |
1058 | if ( EFI_ERROR ( Status )) { |
1059 | break; |
1060 | } |
1061 | Status = RowAnsiArray ( SocketFD, |
1062 | pPort, |
1063 | "Creator ID", |
1064 | sizeof ( pFadt->CreatorId ), |
1065 | (CHAR8 *)&pFadt->CreatorId ); |
1066 | if ( EFI_ERROR ( Status )) { |
1067 | break; |
1068 | } |
1069 | Status = RowRevision ( SocketFD, |
1070 | pPort, |
1071 | "Creator Revision", |
1072 | pFadt->CreatorRevision ); |
1073 | if ( EFI_ERROR ( Status )) { |
1074 | break; |
1075 | } |
1076 | |
1077 | // |
1078 | // Display the data from the FADT |
1079 | // |
1080 | Status = RowPointer ( SocketFD, |
1081 | pPort, |
1082 | "FIRMWARE_CTRL", |
1083 | (CONST VOID *)pFadt->FirmwareCtrl, |
1084 | NULL ); |
1085 | if ( EFI_ERROR ( Status )) { |
1086 | break; |
1087 | } |
1088 | Status = RowPointer ( SocketFD, |
1089 | pPort, |
1090 | "DSDT", |
1091 | (CONST VOID *)pFadt->DSDT, |
1092 | ( pFadt->DSDT == pFadt->XDsdt ) ? PAGE_ACPI_DSDT : NULL ); |
1093 | if ( EFI_ERROR ( Status )) { |
1094 | break; |
1095 | } |
1096 | Status = RowHexValue ( SocketFD, |
1097 | pPort, |
1098 | "Reserved", |
1099 | pFadt->Reserved, |
1100 | NULL ); |
1101 | if ( EFI_ERROR ( Status )) { |
1102 | break; |
1103 | } |
1104 | Status = RowHexValue ( SocketFD, |
1105 | pPort, |
1106 | "Preferred_PM_Profile", |
1107 | pFadt->PreferredPmProfile, |
1108 | NULL ); |
1109 | if ( EFI_ERROR ( Status )) { |
1110 | break; |
1111 | } |
1112 | Status = RowHexValue ( SocketFD, |
1113 | pPort, |
1114 | "SCI_INT", |
1115 | pFadt->SciInt, |
1116 | NULL ); |
1117 | if ( EFI_ERROR ( Status )) { |
1118 | break; |
1119 | } |
1120 | Status = RowHexValue ( SocketFD, |
1121 | pPort, |
1122 | "SMI_CMD", |
1123 | pFadt->SmiCmd, |
1124 | NULL ); |
1125 | if ( EFI_ERROR ( Status )) { |
1126 | break; |
1127 | } |
1128 | Status = RowHexValue ( SocketFD, |
1129 | pPort, |
1130 | "ACPI_ENABLE", |
1131 | pFadt->AcpiEnable, |
1132 | NULL ); |
1133 | if ( EFI_ERROR ( Status )) { |
1134 | break; |
1135 | } |
1136 | Status = RowHexValue ( SocketFD, |
1137 | pPort, |
1138 | "ACPI_DISABLE", |
1139 | pFadt->AcpiDisable, |
1140 | NULL ); |
1141 | if ( EFI_ERROR ( Status )) { |
1142 | break; |
1143 | } |
1144 | Status = RowHexValue ( SocketFD, |
1145 | pPort, |
1146 | "S4BIOS_REQ", |
1147 | pFadt->S4BiosReq, |
1148 | NULL ); |
1149 | if ( EFI_ERROR ( Status )) { |
1150 | break; |
1151 | } |
1152 | Status = RowHexValue ( SocketFD, |
1153 | pPort, |
1154 | "PSTATE_CNT", |
1155 | pFadt->PStateCnt, |
1156 | NULL ); |
1157 | if ( EFI_ERROR ( Status )) { |
1158 | break; |
1159 | } |
1160 | Status = RowHexValue ( SocketFD, |
1161 | pPort, |
1162 | "PM1a_EVT_BLK", |
1163 | pFadt->Pm1aEvtBlk, |
1164 | NULL ); |
1165 | if ( EFI_ERROR ( Status )) { |
1166 | break; |
1167 | } |
1168 | Status = RowHexValue ( SocketFD, |
1169 | pPort, |
1170 | "PM1b_EVT_BLK", |
1171 | pFadt->Pm1bEvtBlk, |
1172 | NULL ); |
1173 | if ( EFI_ERROR ( Status )) { |
1174 | break; |
1175 | } |
1176 | Status = RowHexValue ( SocketFD, |
1177 | pPort, |
1178 | "PM1a_CNT_BLK", |
1179 | pFadt->Pm1aCntBlk, |
1180 | NULL ); |
1181 | if ( EFI_ERROR ( Status )) { |
1182 | break; |
1183 | } |
1184 | Status = RowHexValue ( SocketFD, |
1185 | pPort, |
1186 | "PM1b_CNT_BLK", |
1187 | pFadt->Pm1bCntBlk, |
1188 | NULL ); |
1189 | if ( EFI_ERROR ( Status )) { |
1190 | break; |
1191 | } |
1192 | Status = RowHexValue ( SocketFD, |
1193 | pPort, |
1194 | "PM2_CNT_BLK", |
1195 | pFadt->Pm2CntBlk, |
1196 | NULL ); |
1197 | if ( EFI_ERROR ( Status )) { |
1198 | break; |
1199 | } |
1200 | Status = RowHexValue ( SocketFD, |
1201 | pPort, |
1202 | "PM_TMR_BLK", |
1203 | pFadt->PmTmrBlk, |
1204 | NULL ); |
1205 | if ( EFI_ERROR ( Status )) { |
1206 | break; |
1207 | } |
1208 | |
1209 | Status = RowHexValue ( SocketFD, |
1210 | pPort, |
1211 | "GPE0_BLK", |
1212 | pFadt->Gpe0Blk, |
1213 | NULL ); |
1214 | if ( EFI_ERROR ( Status )) { |
1215 | break; |
1216 | } |
1217 | Status = RowHexValue ( SocketFD, |
1218 | pPort, |
1219 | "GPE1_BLK", |
1220 | pFadt->Gpe1Blk, |
1221 | NULL ); |
1222 | if ( EFI_ERROR ( Status )) { |
1223 | break; |
1224 | } |
1225 | Status = RowDecimalValue ( SocketFD, |
1226 | pPort, |
1227 | "PM1_EVT_LEN", |
1228 | pFadt->Pm1EvtLen ); |
1229 | if ( EFI_ERROR ( Status )) { |
1230 | break; |
1231 | } |
1232 | Status = RowDecimalValue ( SocketFD, |
1233 | pPort, |
1234 | "PM1_CNT_LEN", |
1235 | pFadt->Pm1CntLen ); |
1236 | if ( EFI_ERROR ( Status )) { |
1237 | break; |
1238 | } |
1239 | Status = RowDecimalValue ( SocketFD, |
1240 | pPort, |
1241 | "PM2_CNT_LEN", |
1242 | pFadt->PM2CntLen ); |
1243 | if ( EFI_ERROR ( Status )) { |
1244 | break; |
1245 | } |
1246 | Status = RowDecimalValue ( SocketFD, |
1247 | pPort, |
1248 | "PM_TMR_LEN", |
1249 | pFadt->PmTmrLen ); |
1250 | if ( EFI_ERROR ( Status )) { |
1251 | break; |
1252 | } |
1253 | Status = RowDecimalValue ( SocketFD, |
1254 | pPort, |
1255 | "GPE0_BLK_LEN", |
1256 | pFadt->Gpe0BlkLen ); |
1257 | if ( EFI_ERROR ( Status )) { |
1258 | break; |
1259 | } |
1260 | Status = RowDecimalValue ( SocketFD, |
1261 | pPort, |
1262 | "GPE1_BLK_LEN", |
1263 | pFadt->Gpe1BlkLen ); |
1264 | if ( EFI_ERROR ( Status )) { |
1265 | break; |
1266 | } |
1267 | Status = RowHexValue ( SocketFD, |
1268 | pPort, |
1269 | "GPE1_BASE", |
1270 | pFadt->Gpe1Base, |
1271 | NULL ); |
1272 | if ( EFI_ERROR ( Status )) { |
1273 | break; |
1274 | } |
1275 | Status = RowDecimalValue ( SocketFD, |
1276 | pPort, |
1277 | "CST_CNT", |
1278 | pFadt->CstCnt ); |
1279 | if ( EFI_ERROR ( Status )) { |
1280 | break; |
1281 | } |
1282 | Status = RowHexValue ( SocketFD, |
1283 | pPort, |
1284 | "P_LVL2_LAT", |
1285 | pFadt->PLvl2Lat, |
1286 | NULL ); |
1287 | if ( EFI_ERROR ( Status )) { |
1288 | break; |
1289 | } |
1290 | Status = RowHexValue ( SocketFD, |
1291 | pPort, |
1292 | "P_LVL3_LAT", |
1293 | pFadt->PLvl3Lat, |
1294 | NULL ); |
1295 | if ( EFI_ERROR ( Status )) { |
1296 | break; |
1297 | } |
1298 | Status = RowDecimalValue ( SocketFD, |
1299 | pPort, |
1300 | "FLUSH_SIZE", |
1301 | pFadt->FlushSize ); |
1302 | if ( EFI_ERROR ( Status )) { |
1303 | break; |
1304 | } |
1305 | Status = RowDecimalValue ( SocketFD, |
1306 | pPort, |
1307 | "FLUSH_Stride", |
1308 | pFadt->FlushStride ); |
1309 | if ( EFI_ERROR ( Status )) { |
1310 | break; |
1311 | } |
1312 | Status = RowHexValue ( SocketFD, |
1313 | pPort, |
1314 | "DUTY_OFFSET", |
1315 | pFadt->DutyOffset, |
1316 | NULL ); |
1317 | if ( EFI_ERROR ( Status )) { |
1318 | break; |
1319 | } |
1320 | Status = RowHexValue ( SocketFD, |
1321 | pPort, |
1322 | "DUTY_WIDTH", |
1323 | pFadt->DutyWidth, |
1324 | NULL ); |
1325 | if ( EFI_ERROR ( Status )) { |
1326 | break; |
1327 | } |
1328 | Status = RowHexValue ( SocketFD, |
1329 | pPort, |
1330 | "DAY_ALRM", |
1331 | pFadt->DayAlrm, |
1332 | NULL ); |
1333 | if ( EFI_ERROR ( Status )) { |
1334 | break; |
1335 | } |
1336 | Status = RowHexValue ( SocketFD, |
1337 | pPort, |
1338 | "MON_ALRM", |
1339 | pFadt->MonAlrm, |
1340 | NULL ); |
1341 | if ( EFI_ERROR ( Status )) { |
1342 | break; |
1343 | } |
1344 | Status = RowHexValue ( SocketFD, |
1345 | pPort, |
1346 | "CENTURY", |
1347 | pFadt->Century, |
1348 | NULL ); |
1349 | if ( EFI_ERROR ( Status )) { |
1350 | break; |
1351 | } |
1352 | Status = RowHexValue ( SocketFD, |
1353 | pPort, |
1354 | "IAPC_BOOT_ARCH", |
1355 | pFadt->IapcBootArch, |
1356 | NULL ); |
1357 | if ( EFI_ERROR ( Status )) { |
1358 | break; |
1359 | } |
1360 | Status = RowHexValue ( SocketFD, |
1361 | pPort, |
1362 | "Reserved", |
1363 | pFadt->Reserved2, |
1364 | NULL ); |
1365 | if ( EFI_ERROR ( Status )) { |
1366 | break; |
1367 | } |
1368 | Status = RowHexValue ( SocketFD, |
1369 | pPort, |
1370 | "Flags", |
1371 | pFadt->Flags, |
1372 | NULL ); |
1373 | if ( EFI_ERROR ( Status )) { |
1374 | break; |
1375 | } |
1376 | Status = RowGenericAddress ( SocketFD, |
1377 | pPort, |
1378 | "RESET_REG", |
1379 | &pFadt->ResetReg[0], |
1380 | NULL ); |
1381 | if ( EFI_ERROR ( Status )) { |
1382 | break; |
1383 | } |
1384 | Status = RowHexValue ( SocketFD, |
1385 | pPort, |
1386 | "RESET_VALUE", |
1387 | pFadt->ResetValue, |
1388 | NULL ); |
1389 | if ( EFI_ERROR ( Status )) { |
1390 | break; |
1391 | } |
1392 | Status = RowHexValue ( SocketFD, |
1393 | pPort, |
1394 | "Reserved", |
1395 | pFadt->Reserved3[0], |
1396 | NULL ); |
1397 | if ( EFI_ERROR ( Status )) { |
1398 | break; |
1399 | } |
1400 | Status = RowHexValue ( SocketFD, |
1401 | pPort, |
1402 | "Reserved", |
1403 | pFadt->Reserved3[1], |
1404 | NULL ); |
1405 | if ( EFI_ERROR ( Status )) { |
1406 | break; |
1407 | } |
1408 | Status = RowHexValue ( SocketFD, |
1409 | pPort, |
1410 | "Reserved", |
1411 | pFadt->Reserved3[2], |
1412 | NULL ); |
1413 | if ( EFI_ERROR ( Status )) { |
1414 | break; |
1415 | } |
1416 | Status = RowHexValue ( SocketFD, |
1417 | pPort, |
1418 | "X_FIRMWARE_CTRL", |
1419 | pFadt->XFirmwareCtrl, |
1420 | NULL ); |
1421 | if ( EFI_ERROR ( Status )) { |
1422 | break; |
1423 | } |
1424 | Status = RowHexValue ( SocketFD, |
1425 | pPort, |
1426 | "X_DSDT", |
1427 | pFadt->XDsdt, |
1428 | PAGE_ACPI_DSDT ); |
1429 | if ( EFI_ERROR ( Status )) { |
1430 | break; |
1431 | } |
1432 | Status = RowGenericAddress ( SocketFD, |
1433 | pPort, |
1434 | "X_PM1a_EVT_BLK", |
1435 | &pFadt->XPm1aEvtBlk[0], |
1436 | NULL ); |
1437 | if ( EFI_ERROR ( Status )) { |
1438 | break; |
1439 | } |
1440 | Status = RowGenericAddress ( SocketFD, |
1441 | pPort, |
1442 | "X_PM1b_EVT_BLK", |
1443 | &pFadt->XPm1bEvtBlk[0], |
1444 | NULL ); |
1445 | if ( EFI_ERROR ( Status )) { |
1446 | break; |
1447 | } |
1448 | Status = RowGenericAddress ( SocketFD, |
1449 | pPort, |
1450 | "X_PM1a_CNT_BLK", |
1451 | &pFadt->XPm1aCntBlk[0], |
1452 | NULL ); |
1453 | if ( EFI_ERROR ( Status )) { |
1454 | break; |
1455 | } |
1456 | Status = RowGenericAddress ( SocketFD, |
1457 | pPort, |
1458 | "X_PM1b_CNT_BLK", |
1459 | &pFadt->XPm1bCntBlk[0], |
1460 | NULL ); |
1461 | if ( EFI_ERROR ( Status )) { |
1462 | break; |
1463 | } |
1464 | Status = RowGenericAddress ( SocketFD, |
1465 | pPort, |
1466 | "X_PM2_CNT_BLK", |
1467 | &pFadt->XPm2CntBlk[0], |
1468 | NULL ); |
1469 | if ( EFI_ERROR ( Status )) { |
1470 | break; |
1471 | } |
1472 | Status = RowGenericAddress ( SocketFD, |
1473 | pPort, |
1474 | "X_PM_TMR_BLK", |
1475 | &pFadt->XPmTmrBlk[0], |
1476 | NULL ); |
1477 | if ( EFI_ERROR ( Status )) { |
1478 | break; |
1479 | } |
1480 | Status = RowGenericAddress ( SocketFD, |
1481 | pPort, |
1482 | "X_GPE0_BLK", |
1483 | &pFadt->XGpe0Blk[0], |
1484 | NULL ); |
1485 | if ( EFI_ERROR ( Status )) { |
1486 | break; |
1487 | } |
1488 | Status = RowGenericAddress ( SocketFD, |
1489 | pPort, |
1490 | "X_GPE1_BLK", |
1491 | &pFadt->XGpe1Blk[0], |
1492 | NULL ); |
1493 | if ( EFI_ERROR ( Status )) { |
1494 | break; |
1495 | } |
1496 | |
1497 | // |
1498 | // Build the table trailer |
1499 | // |
1500 | Status = TableTrailer ( SocketFD, |
1501 | pPort, |
1502 | pbDone ); |
1503 | break; |
1504 | } |
1505 | |
1506 | // |
1507 | // Return the operation status |
1508 | // |
1509 | DBG_EXIT_STATUS ( Status ); |
1510 | return Status; |
1511 | } |
1512 | |
1513 | |
1514 | /** |
1515 | Respond with the ACPI RSDP 1.0b table |
1516 | |
1517 | @param [in] SocketFD The socket's file descriptor to add to the list. |
1518 | @param [in] pPort The WSDT_PORT structure address |
1519 | @param [out] pbDone Address to receive the request completion status |
1520 | |
1521 | @retval EFI_SUCCESS The request was successfully processed |
1522 | |
1523 | **/ |
1524 | EFI_STATUS |
1525 | AcpiRsdp10Page ( |
1526 | IN int SocketFD, |
1527 | IN WSDT_PORT * pPort, |
1528 | OUT BOOLEAN * pbDone |
1529 | ) |
1530 | { |
1531 | CONST EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER * pRsdp10b; |
1532 | EFI_STATUS Status; |
1533 | |
1534 | DBG_ENTER ( ); |
1535 | |
1536 | // |
1537 | // Send the RSDP page |
1538 | // |
1539 | for ( ; ; ) { |
1540 | // |
1541 | // Locate the RSDP |
1542 | // |
1543 | Status = EfiGetSystemConfigurationTable ( &gEfiAcpi10TableGuid, (VOID **) &pRsdp10b ); |
1544 | if ( EFI_ERROR ( Status )) { |
1545 | break; |
1546 | } |
1547 | |
1548 | // |
1549 | // Send the page and table header |
1550 | // |
1551 | Status = TableHeader ( SocketFD, pPort, L"RSDP - ACPI 1.0b Root System Description Pointer", pRsdp10b ); |
1552 | if ( EFI_ERROR ( Status )) { |
1553 | break; |
1554 | } |
1555 | |
1556 | // |
1557 | // Display the RSDP |
1558 | // |
1559 | Status = RowAnsiArray ( SocketFD, |
1560 | pPort, |
1561 | "Signature", |
1562 | sizeof ( pRsdp10b->Signature ), |
1563 | (CHAR8 *)&pRsdp10b->Signature ); |
1564 | if ( EFI_ERROR ( Status )) { |
1565 | break; |
1566 | } |
1567 | Status = RowHexValue ( SocketFD, |
1568 | pPort, |
1569 | "Checksum", |
1570 | pRsdp10b->Checksum, |
1571 | NULL ); |
1572 | if ( EFI_ERROR ( Status )) { |
1573 | break; |
1574 | } |
1575 | Status = RowAnsiArray ( SocketFD, |
1576 | pPort, |
1577 | "OemId", |
1578 | sizeof ( pRsdp10b->OemId ), |
1579 | &pRsdp10b->OemId [ 0 ]); |
1580 | if ( EFI_ERROR ( Status )) { |
1581 | break; |
1582 | } |
1583 | Status = RowHexValue ( SocketFD, |
1584 | pPort, |
1585 | "Reserved", |
1586 | pRsdp10b->Reserved, |
1587 | NULL ); |
1588 | if ( EFI_ERROR ( Status )) { |
1589 | break; |
1590 | } |
1591 | Status = RowPointer ( SocketFD, |
1592 | pPort, |
1593 | "RsdtAddress", |
1594 | (VOID *)pRsdp10b->RsdtAddress, |
1595 | PAGE_ACPI_RSDT ); |
1596 | if ( EFI_ERROR ( Status )) { |
1597 | break; |
1598 | } |
1599 | |
1600 | // |
1601 | // Build the table trailer |
1602 | // |
1603 | Status = TableTrailer ( SocketFD, |
1604 | pPort, |
1605 | pbDone ); |
1606 | break; |
1607 | } |
1608 | |
1609 | // |
1610 | // Return the operation status |
1611 | // |
1612 | DBG_EXIT_STATUS ( Status ); |
1613 | return Status; |
1614 | } |
1615 | |
1616 | |
1617 | /** |
1618 | Respond with the ACPI RSDP 3.0 table |
1619 | |
1620 | @param [in] SocketFD The socket's file descriptor to add to the list. |
1621 | @param [in] pPort The WSDT_PORT structure address |
1622 | @param [out] pbDone Address to receive the request completion status |
1623 | |
1624 | @retval EFI_SUCCESS The request was successfully processed |
1625 | |
1626 | **/ |
1627 | EFI_STATUS |
1628 | AcpiRsdp30Page ( |
1629 | IN int SocketFD, |
1630 | IN WSDT_PORT * pPort, |
1631 | OUT BOOLEAN * pbDone |
1632 | ) |
1633 | { |
1634 | CONST EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER * pRsdp30; |
1635 | EFI_STATUS Status; |
1636 | |
1637 | DBG_ENTER ( ); |
1638 | |
1639 | // |
1640 | // Send the RSDP page |
1641 | // |
1642 | for ( ; ; ) { |
1643 | // |
1644 | // Locate the RSDP |
1645 | // |
1646 | Status = EfiGetSystemConfigurationTable ( &gEfiAcpiTableGuid, (VOID **) &pRsdp30 ); |
1647 | if ( EFI_ERROR ( Status )) { |
1648 | break; |
1649 | } |
1650 | |
1651 | // |
1652 | // Send the page and table header |
1653 | // |
1654 | Status = TableHeader ( SocketFD, pPort, L"RSDP - ACPI 3.0 Root System Description Pointer", pRsdp30 ); |
1655 | if ( EFI_ERROR ( Status )) { |
1656 | break; |
1657 | } |
1658 | |
1659 | // |
1660 | // Display the RSDP |
1661 | // |
1662 | Status = RowAnsiArray ( SocketFD, |
1663 | pPort, |
1664 | "Signature", |
1665 | sizeof ( pRsdp30->Signature ), |
1666 | (CHAR8 *)&pRsdp30->Signature ); |
1667 | if ( EFI_ERROR ( Status )) { |
1668 | break; |
1669 | } |
1670 | Status = RowHexValue ( SocketFD, |
1671 | pPort, |
1672 | "Checksum", |
1673 | pRsdp30->Checksum, |
1674 | NULL ); |
1675 | if ( EFI_ERROR ( Status )) { |
1676 | break; |
1677 | } |
1678 | Status = RowAnsiArray ( SocketFD, |
1679 | pPort, |
1680 | "OemId", |
1681 | sizeof ( pRsdp30->OemId ), |
1682 | &pRsdp30->OemId [ 0 ]); |
1683 | if ( EFI_ERROR ( Status )) { |
1684 | break; |
1685 | } |
1686 | Status = RowHexValue ( SocketFD, |
1687 | pPort, |
1688 | "Revision", |
1689 | pRsdp30->Revision, |
1690 | NULL ); |
1691 | if ( EFI_ERROR ( Status )) { |
1692 | break; |
1693 | } |
1694 | Status = RowPointer ( SocketFD, |
1695 | pPort, |
1696 | "RsdtAddress", |
1697 | (VOID *)pRsdp30->RsdtAddress, |
1698 | PAGE_ACPI_RSDT ); |
1699 | if ( EFI_ERROR ( Status )) { |
1700 | break; |
1701 | } |
1702 | Status = RowDecimalValue ( SocketFD, |
1703 | pPort, |
1704 | "Length", |
1705 | pRsdp30->Length ); |
1706 | if ( EFI_ERROR ( Status )) { |
1707 | break; |
1708 | } |
1709 | Status = RowPointer ( SocketFD, |
1710 | pPort, |
1711 | "XsdtAddress", |
1712 | (VOID *)pRsdp30->XsdtAddress, |
1713 | NULL ); |
1714 | if ( EFI_ERROR ( Status )) { |
1715 | break; |
1716 | } |
1717 | Status = RowHexValue ( SocketFD, |
1718 | pPort, |
1719 | "ExtendedChecksum", |
1720 | pRsdp30->ExtendedChecksum, |
1721 | NULL ); |
1722 | if ( EFI_ERROR ( Status )) { |
1723 | break; |
1724 | } |
1725 | Status = RowBytes ( SocketFD, |
1726 | pPort, |
1727 | "Reserved", |
1728 | sizeof ( pRsdp30->Reserved ), |
1729 | &pRsdp30->Reserved [ 0 ]); |
1730 | if ( EFI_ERROR ( Status )) { |
1731 | break; |
1732 | } |
1733 | |
1734 | // |
1735 | // Build the table trailer |
1736 | // |
1737 | Status = TableTrailer ( SocketFD, |
1738 | pPort, |
1739 | pbDone ); |
1740 | break; |
1741 | } |
1742 | |
1743 | // |
1744 | // Return the operation status |
1745 | // |
1746 | DBG_EXIT_STATUS ( Status ); |
1747 | return Status; |
1748 | } |
1749 | |
1750 | |
1751 | /** |
1752 | Respond with the ACPI RSDT table |
1753 | |
1754 | @param [in] SocketFD The socket's file descriptor to add to the list. |
1755 | @param [in] pPort The WSDT_PORT structure address |
1756 | @param [out] pbDone Address to receive the request completion status |
1757 | |
1758 | @retval EFI_SUCCESS The request was successfully processed |
1759 | |
1760 | **/ |
1761 | EFI_STATUS |
1762 | AcpiRsdtPage ( |
1763 | IN int SocketFD, |
1764 | IN WSDT_PORT * pPort, |
1765 | OUT BOOLEAN * pbDone |
1766 | ) |
1767 | { |
1768 | CONST UINT32 * pEnd; |
1769 | CONST UINT32 * pEntry; |
1770 | CONST ACPI_RSDT * pRsdt; |
1771 | CONST CHAR8 * pTableName; |
1772 | CONST CHAR16 * pWebPage; |
1773 | EFI_STATUS Status; |
1774 | UINT32 TableName [ 2 ]; |
1775 | |
1776 | DBG_ENTER ( ); |
1777 | |
1778 | // |
1779 | // Send the RSDT page |
1780 | // |
1781 | for ( ; ; ) { |
1782 | // |
1783 | // Locate the RSDT |
1784 | // |
1785 | pRsdt = LocateRsdt ( ); |
1786 | if ( NULL == pRsdt ) { |
1787 | Status = EFI_NOT_FOUND; |
1788 | break; |
1789 | } |
1790 | |
1791 | // |
1792 | // Send the page and table header |
1793 | // |
1794 | Status = TableHeader ( SocketFD, pPort, L"RSDT - ACPI Root System Description Table", pRsdt ); |
1795 | if ( EFI_ERROR ( Status )) { |
1796 | break; |
1797 | } |
1798 | |
1799 | // |
1800 | // Display the RSDT |
1801 | // |
1802 | Status = RowAnsiArray ( SocketFD, |
1803 | pPort, |
1804 | "Signature", |
1805 | sizeof ( pRsdt->Signature ), |
1806 | (CHAR8 *)&pRsdt->Signature ); |
1807 | if ( EFI_ERROR ( Status )) { |
1808 | break; |
1809 | } |
1810 | Status = RowDecimalValue ( SocketFD, |
1811 | pPort, |
1812 | "Length", |
1813 | pRsdt->Length ); |
1814 | if ( EFI_ERROR ( Status )) { |
1815 | break; |
1816 | } |
1817 | Status = RowDecimalValue ( SocketFD, |
1818 | pPort, |
1819 | "Revision", |
1820 | pRsdt->Revision ); |
1821 | if ( EFI_ERROR ( Status )) { |
1822 | break; |
1823 | } |
1824 | Status = RowHexValue ( SocketFD, |
1825 | pPort, |
1826 | "Checksum", |
1827 | pRsdt->Checksum, |
1828 | NULL ); |
1829 | if ( EFI_ERROR ( Status )) { |
1830 | break; |
1831 | } |
1832 | Status = RowAnsiArray ( SocketFD, |
1833 | pPort, |
1834 | "OEMID", |
1835 | sizeof ( pRsdt->OemId ), |
1836 | &pRsdt->OemId [ 0 ]); |
1837 | if ( EFI_ERROR ( Status )) { |
1838 | break; |
1839 | } |
1840 | Status = RowAnsiArray ( SocketFD, |
1841 | pPort, |
1842 | "OEM Table ID", |
1843 | sizeof ( pRsdt->OemTableId ), |
1844 | &pRsdt->OemTableId [ 0 ]); |
1845 | if ( EFI_ERROR ( Status )) { |
1846 | break; |
1847 | } |
1848 | Status = RowRevision ( SocketFD, |
1849 | pPort, |
1850 | "OEM Revision", |
1851 | pRsdt->OemRevision ); |
1852 | if ( EFI_ERROR ( Status )) { |
1853 | break; |
1854 | } |
1855 | Status = RowAnsiArray ( SocketFD, |
1856 | pPort, |
1857 | "Creator ID", |
1858 | sizeof ( pRsdt->CreatorId ), |
1859 | (CHAR8 *)&pRsdt->CreatorId ); |
1860 | if ( EFI_ERROR ( Status )) { |
1861 | break; |
1862 | } |
1863 | Status = RowRevision ( SocketFD, |
1864 | pPort, |
1865 | "Creator Revision", |
1866 | pRsdt->CreatorRevision ); |
1867 | if ( EFI_ERROR ( Status )) { |
1868 | break; |
1869 | } |
1870 | |
1871 | // |
1872 | // Walk the list of entries |
1873 | // |
1874 | pEntry = &pRsdt->Entry [ 0 ]; |
1875 | pEnd = &pEntry [(( pRsdt->Length - sizeof ( *pRsdt )) >> 2 ) + 1 ]; |
1876 | TableName [ 1 ] = 0; |
1877 | while ( pEnd > pEntry ) { |
1878 | // |
1879 | // The entry is actually a 32-bit physical table address |
1880 | // The first entry in the table is the 32-bit table signature |
1881 | // |
1882 | TableName [ 0 ] = *(UINT32 *)*pEntry; |
1883 | pWebPage = SignatureLookup ( &TableName [ 0 ], &pTableName ); |
1884 | |
1885 | // |
1886 | // Display the table address |
1887 | // |
1888 | Status = RowPointer ( SocketFD, |
1889 | pPort, |
1890 | pTableName, |
1891 | (VOID *)*pEntry, |
1892 | pWebPage ); |
1893 | if ( EFI_ERROR ( Status )) { |
1894 | break; |
1895 | } |
1896 | pEntry++; |
1897 | } |
1898 | if ( EFI_ERROR ( Status )) { |
1899 | break; |
1900 | } |
1901 | |
1902 | // |
1903 | // Build the table trailer |
1904 | // |
1905 | Status = TableTrailer ( SocketFD, |
1906 | pPort, |
1907 | pbDone ); |
1908 | break; |
1909 | } |
1910 | |
1911 | // |
1912 | // Return the operation status |
1913 | // |
1914 | DBG_EXIT_STATUS ( Status ); |
1915 | return Status; |
1916 | } |
1917 | |
1918 | |