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