3 Display the system table
5 Copyright (c) 2011-2012, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <WebServer.h>
20 Display the EFI Table Header
22 @param [in] SocketFD The socket's file descriptor to add to the list.
23 @param [in] pPort The WSDT_PORT structure address
24 @param [in] pHeader Address of the EFI_TABLE_HEADER structure
26 @retval EFI_SUCCESS The request was successfully processed
33 IN EFI_TABLE_HEADER
* pHeader
41 // Send the handles page
45 /// A 64-bit signature that identifies the type of table that follows.
46 /// Unique signatures have been generated for the EFI System Table,
47 /// the EFI Boot Services Table, and the EFI Runtime Services Table.
49 Status
= RowHexValue ( SocketFD
,
54 if ( EFI_ERROR ( Status
)) {
59 /// The revision of the EFI Specification to which this table
60 /// conforms. The upper 16 bits of this field contain the major
61 /// revision value, and the lower 16 bits contain the minor revision
62 /// value. The minor revision values are limited to the range of 00..99.
64 Status
= RowRevision ( SocketFD
,
68 if ( EFI_ERROR ( Status
)) {
73 /// The size, in bytes, of the entire table including the EFI_TABLE_HEADER.
75 Status
= RowDecimalValue ( SocketFD
,
78 pHeader
->HeaderSize
);
79 if ( EFI_ERROR ( Status
)) {
84 /// The 32-bit CRC for the entire table. This value is computed by
85 /// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.
87 Status
= RowHexValue ( SocketFD
,
92 if ( EFI_ERROR ( Status
)) {
97 /// Reserved field that must be set to 0.
99 Status
= RowHexValue ( SocketFD
,
108 // Return the operation status
110 DBG_EXIT_STATUS ( Status
);
116 Display a row containing a decimal value
118 @param [in] SocketFD The socket's file descriptor to add to the list.
119 @param [in] pPort The WSDT_PORT structure address
120 @param [in] pName Address of a zero terminated name string
121 @param [in] Value The value to display
123 @retval EFI_SUCCESS The request was successfully processed
129 IN WSDT_PORT
* pPort
,
130 IN CONST CHAR8
* pName
,
139 // Use for/break instead of goto
142 Status
= HttpSendAnsiString ( SocketFD
,
145 if ( EFI_ERROR ( Status
)) {
148 Status
= HttpSendAnsiString ( SocketFD
,
151 if ( EFI_ERROR ( Status
)) {
154 Status
= HttpSendAnsiString ( SocketFD
,
157 if ( EFI_ERROR ( Status
)) {
160 Status
= HttpSendValue ( SocketFD
,
163 if ( EFI_ERROR ( Status
)) {
166 Status
= HttpSendAnsiString ( SocketFD
,
168 "</code></td></tr>\r\n" );
173 // Return the operation status
175 DBG_EXIT_STATUS ( Status
);
181 Display a row containing a hex value
183 @param [in] SocketFD The socket's file descriptor to add to the list.
184 @param [in] pPort The WSDT_PORT structure address
185 @param [in] pName Address of a zero terminated name string
186 @param [in] Value The value to display
187 @param [in] pWebPage Address of a zero terminated web page name
189 @retval EFI_SUCCESS The request was successfully processed
195 IN WSDT_PORT
* pPort
,
196 IN CONST CHAR8
* pName
,
198 IN CONST CHAR16
* pWebPage
206 // Use for/break instead of goto
209 Status
= HttpSendAnsiString ( SocketFD
,
212 if ( EFI_ERROR ( Status
)) {
215 Status
= HttpSendAnsiString ( SocketFD
,
218 if ( EFI_ERROR ( Status
)) {
221 Status
= HttpSendAnsiString ( SocketFD
,
223 "</td><td><code>0x" );
224 if ( EFI_ERROR ( Status
)) {
227 if ( NULL
!= pWebPage
) {
228 Status
= HttpSendAnsiString ( SocketFD
,
230 "<a target=\"_blank\" href=\"" );
231 if ( EFI_ERROR ( Status
)) {
234 Status
= HttpSendUnicodeString ( SocketFD
,
237 if ( EFI_ERROR ( Status
)) {
240 Status
= HttpSendAnsiString ( SocketFD
,
243 if ( EFI_ERROR ( Status
)) {
247 Status
= HttpSendHexValue ( SocketFD
,
250 if ( EFI_ERROR ( Status
)) {
253 if ( NULL
!= pWebPage
) {
254 Status
= HttpSendAnsiString ( SocketFD
,
257 if ( EFI_ERROR ( Status
)) {
261 Status
= HttpSendAnsiString ( SocketFD
,
263 "</code></td></tr>\r\n" );
268 // Return the operation status
270 DBG_EXIT_STATUS ( Status
);
276 Display a row containing a pointer
278 @param [in] SocketFD The socket's file descriptor to add to the list.
279 @param [in] pPort The WSDT_PORT structure address
280 @param [in] pName Address of a zero terminated name string
281 @param [in] pAddress The address to display
282 @param [in] pWebPage Address of a zero terminated web page name
284 @retval EFI_SUCCESS The request was successfully processed
290 IN WSDT_PORT
* pPort
,
291 IN CONST CHAR8
* pName
,
292 IN CONST VOID
* pAddress
,
293 IN CONST CHAR16
* pWebPage
301 // Use for/break instead of goto
304 Status
= HttpSendAnsiString ( SocketFD
,
307 if ( EFI_ERROR ( Status
)) {
310 Status
= HttpSendAnsiString ( SocketFD
,
313 if ( EFI_ERROR ( Status
)) {
316 Status
= HttpSendAnsiString ( SocketFD
,
319 if ( EFI_ERROR ( Status
)) {
322 if ( NULL
!= pWebPage
) {
323 Status
= HttpSendAnsiString ( SocketFD
,
325 "<a target=\"_blank\" href=\"" );
326 if ( EFI_ERROR ( Status
)) {
329 Status
= HttpSendUnicodeString ( SocketFD
,
332 if ( EFI_ERROR ( Status
)) {
335 Status
= HttpSendAnsiString ( SocketFD
,
338 if ( EFI_ERROR ( Status
)) {
342 Status
= HttpSendAnsiString ( SocketFD
,
345 if ( EFI_ERROR ( Status
)) {
348 Status
= HttpSendHexBits ( SocketFD
,
350 sizeof ( pAddress
) * 8,
351 (UINT64
)(UINTN
)pAddress
);
352 if ( EFI_ERROR ( Status
)) {
355 if ( NULL
!= pWebPage
) {
356 Status
= HttpSendAnsiString ( SocketFD
,
359 if ( EFI_ERROR ( Status
)) {
363 Status
= HttpSendAnsiString ( SocketFD
,
365 "</code></td></tr>\r\n" );
370 // Return the operation status
372 DBG_EXIT_STATUS ( Status
);
378 Display a row containing a revision
380 @param [in] SocketFD The socket's file descriptor to add to the list.
381 @param [in] pPort The WSDT_PORT structure address
382 @param [in] pName Address of a zero terminated name string
383 @param [in] Revision The revision to display
385 @retval EFI_SUCCESS The request was successfully processed
391 IN WSDT_PORT
* pPort
,
392 IN CONST CHAR8
* pName
,
401 // Use for/break instead of goto
404 Status
= HttpSendAnsiString ( SocketFD
,
407 if ( EFI_ERROR ( Status
)) {
410 Status
= HttpSendAnsiString ( SocketFD
,
413 if ( EFI_ERROR ( Status
)) {
416 Status
= HttpSendAnsiString ( SocketFD
,
419 if ( EFI_ERROR ( Status
)) {
422 Status
= HttpSendValue ( SocketFD
,
425 if ( EFI_ERROR ( Status
)) {
428 Status
= HttpSendByte ( SocketFD
,
431 if ( EFI_ERROR ( Status
)) {
434 Status
= HttpSendValue ( SocketFD
,
437 if ( EFI_ERROR ( Status
)) {
440 Status
= HttpSendAnsiString ( SocketFD
,
442 "</code></td></tr>\r\n" );
447 // Return the operation status
449 DBG_EXIT_STATUS ( Status
);
455 Display a row containing a unicode string
457 @param [in] SocketFD The socket's file descriptor to add to the list.
458 @param [in] pPort The WSDT_PORT structure address
459 @param [in] pName Address of a zero terminated name string
460 @param [in] pString Address of a zero terminated unicode string
462 @retval EFI_SUCCESS The request was successfully processed
468 IN WSDT_PORT
* pPort
,
469 IN CONST CHAR8
* pName
,
470 IN CONST CHAR16
* pString
478 // Use for/break instead of goto
481 Status
= HttpSendAnsiString ( SocketFD
,
484 if ( EFI_ERROR ( Status
)) {
487 Status
= HttpSendAnsiString ( SocketFD
,
490 if ( EFI_ERROR ( Status
)) {
493 Status
= HttpSendAnsiString ( SocketFD
,
496 if ( EFI_ERROR ( Status
)) {
499 Status
= HttpSendUnicodeString ( SocketFD
,
502 if ( EFI_ERROR ( Status
)) {
505 Status
= HttpSendAnsiString ( SocketFD
,
512 // Return the operation status
514 DBG_EXIT_STATUS ( Status
);
522 @param [in] SocketFD The socket's file descriptor to add to the list.
523 @param [in] pPort The WSDT_PORT structure address
524 @param [in] pName Address of a zero terminated name string
525 @param [in] pTable Address of the table
527 @retval EFI_SUCCESS The request was successfully processed
533 IN WSDT_PORT
* pPort
,
534 IN CONST CHAR16
* pName
,
535 IN CONST VOID
* pTable
543 // Use for/break instead of goto
547 // Send the page header
549 Status
= HttpPageHeader ( SocketFD
, pPort
, pName
);
550 if ( EFI_ERROR ( Status
)) {
555 // Build the table header
557 Status
= HttpSendAnsiString ( SocketFD
,
560 if ( EFI_ERROR ( Status
)) {
563 Status
= HttpSendUnicodeString ( SocketFD
,
566 if ( EFI_ERROR ( Status
)) {
569 if ( NULL
!= pTable
) {
570 Status
= HttpSendAnsiString ( SocketFD
,
573 if ( EFI_ERROR ( Status
)) {
576 Status
= HttpSendHexBits ( SocketFD
,
578 sizeof ( pTable
) * 8,
579 (UINT64
)(UINTN
)pTable
);
580 if ( EFI_ERROR ( Status
)) {
584 Status
= HttpSendAnsiString ( SocketFD
,
587 "<table border=\"1\">\r\n"
588 " <tr bgcolor=\"c0c0ff\"><th>Field Name</th><th>Value</th></tr>\r\n" );
593 // Return the operation status
595 DBG_EXIT_STATUS ( Status
);
603 @param [in] SocketFD The socket's file descriptor to add to the list.
604 @param [in] pPort The WSDT_PORT structure address
605 @param [out] pbDone Address to receive the request completion status
607 @retval EFI_SUCCESS The request was successfully processed
613 IN WSDT_PORT
* pPort
,
622 // Use for/break instead of goto
626 // Build the table trailer
628 Status
= HttpSendAnsiString ( SocketFD
,
631 if ( EFI_ERROR ( Status
)) {
636 // Send the page trailer
638 Status
= HttpPageTrailer ( SocketFD
, pPort
, pbDone
);
643 // Return the operation status
645 DBG_EXIT_STATUS ( Status
);
651 Respond with the system table
653 @param [in] SocketFD The socket's file descriptor to add to the list.
654 @param [in] pPort The WSDT_PORT structure address
655 @param [out] pbDone Address to receive the request completion status
657 @retval EFI_SUCCESS The request was successfully processed
663 IN WSDT_PORT
* pPort
,
672 // Send the system table page
676 // Send the page and table header
678 Status
= TableHeader ( SocketFD
, pPort
, L
"System Table", gST
);
679 if ( EFI_ERROR ( Status
)) {
684 /// The table header for the EFI System Table.
686 Status
= EfiTableHeader ( SocketFD
,
689 if ( EFI_ERROR ( Status
)) {
694 /// A pointer to a null terminated string that identifies the vendor
695 /// that produces the system firmware for the platform.
697 Status
= RowUnicodeString ( SocketFD
,
700 gST
->FirmwareVendor
);
701 if ( EFI_ERROR ( Status
)) {
706 /// A firmware vendor specific value that identifies the revision
707 /// of the system firmware for the platform.
709 Status
= RowRevision ( SocketFD
,
712 gST
->FirmwareRevision
);
713 if ( EFI_ERROR ( Status
)) {
718 /// The handle for the active console input device. This handle must support
719 /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
721 Status
= RowPointer ( SocketFD
,
724 (VOID
*)gST
->ConsoleInHandle
,
726 if ( EFI_ERROR ( Status
)) {
731 /// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
732 /// associated with ConsoleInHandle.
734 Status
= RowPointer ( SocketFD
,
739 if ( EFI_ERROR ( Status
)) {
744 /// The handle for the active console output device.
746 Status
= RowPointer ( SocketFD
,
749 (VOID
*)gST
->ConsoleOutHandle
,
751 if ( EFI_ERROR ( Status
)) {
756 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
757 /// that is associated with ConsoleOutHandle.
759 Status
= RowPointer ( SocketFD
,
764 if ( EFI_ERROR ( Status
)) {
769 /// The handle for the active standard error console device.
770 /// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
772 Status
= RowPointer ( SocketFD
,
774 "StandardErrorHandle",
775 (VOID
*)gST
->StandardErrorHandle
,
777 if ( EFI_ERROR ( Status
)) {
782 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
783 /// that is associated with StandardErrorHandle.
785 Status
= RowPointer ( SocketFD
,
790 if ( EFI_ERROR ( Status
)) {
795 /// A pointer to the EFI Runtime Services Table.
797 Status
= RowPointer ( SocketFD
,
800 (VOID
*)gST
->RuntimeServices
,
801 PAGE_RUNTIME_SERVICES_TABLE
);
804 /// A pointer to the EFI Boot Services Table.
806 Status
= RowPointer ( SocketFD
,
809 (VOID
*)gST
->BootServices
,
810 PAGE_BOOT_SERVICES_TABLE
);
811 if ( EFI_ERROR ( Status
)) {
816 /// The number of system configuration tables in the buffer ConfigurationTable.
818 Status
= RowDecimalValue ( SocketFD
,
820 "NumberOfTableEntries",
821 gST
->NumberOfTableEntries
);
822 if ( EFI_ERROR ( Status
)) {
827 /// A pointer to the system configuration tables.
828 /// The number of entries in the table is NumberOfTableEntries.
830 Status
= RowPointer ( SocketFD
,
832 "ConfigurationTable",
833 (VOID
*)gST
->ConfigurationTable
,
834 PAGE_CONFIGURATION_TABLE
);
835 if ( EFI_ERROR ( Status
)) {
840 // Build the table trailer
842 Status
= TableTrailer ( SocketFD
,
849 // Return the operation status
851 DBG_EXIT_STATUS ( Status
);