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