2 This file contains an 'Intel UEFI Application' and is
3 licensed for Intel CPUs and chipsets under the terms of your
4 license agreement with Intel or your vendor. This file may
5 be modified by the user, subject to additional terms of the
10 Copyright (c) 2011 Intel Corporation. All rights reserved
11 This software and associated documentation (if any) is furnished
12 under a license and may only be used or copied in accordance
13 with the terms of the license. Except as permitted by such
14 license, no part of this software or documentation may be
15 reproduced, stored in a retrieval system, or transmitted in any
16 form or by any means without the express written consent of
22 Display the system table
26 #include <WebServer.h>
30 Display the EFI Table Header
32 @param [in] SocketFD The socket's file descriptor to add to the list.
33 @param [in] pPort The WSDT_PORT structure address
34 @param [in] pHeader Address of the EFI_TABLE_HEADER structure
36 @retval EFI_SUCCESS The request was successfully processed
43 IN EFI_TABLE_HEADER
* pHeader
51 // Send the handles page
55 /// A 64-bit signature that identifies the type of table that follows.
56 /// Unique signatures have been generated for the EFI System Table,
57 /// the EFI Boot Services Table, and the EFI Runtime Services Table.
59 Status
= RowHexValue ( SocketFD
,
64 if ( EFI_ERROR ( Status
)) {
69 /// The revision of the EFI Specification to which this table
70 /// conforms. The upper 16 bits of this field contain the major
71 /// revision value, and the lower 16 bits contain the minor revision
72 /// value. The minor revision values are limited to the range of 00..99.
74 Status
= RowRevision ( SocketFD
,
78 if ( EFI_ERROR ( Status
)) {
83 /// The size, in bytes, of the entire table including the EFI_TABLE_HEADER.
85 Status
= RowDecimalValue ( SocketFD
,
88 pHeader
->HeaderSize
);
89 if ( EFI_ERROR ( Status
)) {
94 /// The 32-bit CRC for the entire table. This value is computed by
95 /// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.
97 Status
= RowHexValue ( SocketFD
,
102 if ( EFI_ERROR ( Status
)) {
107 /// Reserved field that must be set to 0.
109 Status
= RowHexValue ( SocketFD
,
118 // Return the operation status
120 DBG_EXIT_STATUS ( Status
);
126 Display a row containing a decimal value
128 @param [in] SocketFD The socket's file descriptor to add to the list.
129 @param [in] pPort The WSDT_PORT structure address
130 @param [in] pName Address of a zero terminated name string
131 @param [in] Value The value to display
133 @retval EFI_SUCCESS The request was successfully processed
139 IN WSDT_PORT
* pPort
,
140 IN CONST CHAR8
* pName
,
149 // Use for/break instead of goto
152 Status
= HttpSendAnsiString ( SocketFD
,
155 if ( EFI_ERROR ( Status
)) {
158 Status
= HttpSendAnsiString ( SocketFD
,
161 if ( EFI_ERROR ( Status
)) {
164 Status
= HttpSendAnsiString ( SocketFD
,
167 if ( EFI_ERROR ( Status
)) {
170 Status
= HttpSendValue ( SocketFD
,
173 if ( EFI_ERROR ( Status
)) {
176 Status
= HttpSendAnsiString ( SocketFD
,
178 "</code></td></tr>\r\n" );
183 // Return the operation status
185 DBG_EXIT_STATUS ( Status
);
191 Display a row containing a hex value
193 @param [in] SocketFD The socket's file descriptor to add to the list.
194 @param [in] pPort The WSDT_PORT structure address
195 @param [in] pName Address of a zero terminated name string
196 @param [in] Value The value to display
197 @param [in] pWebPage Address of a zero terminated web page name
199 @retval EFI_SUCCESS The request was successfully processed
205 IN WSDT_PORT
* pPort
,
206 IN CONST CHAR8
* pName
,
208 IN CONST CHAR16
* pWebPage
216 // Use for/break instead of goto
219 Status
= HttpSendAnsiString ( SocketFD
,
222 if ( EFI_ERROR ( Status
)) {
225 Status
= HttpSendAnsiString ( SocketFD
,
228 if ( EFI_ERROR ( Status
)) {
231 Status
= HttpSendAnsiString ( SocketFD
,
233 "</td><td><code>0x" );
234 if ( EFI_ERROR ( Status
)) {
237 if ( NULL
!= pWebPage
) {
238 Status
= HttpSendAnsiString ( SocketFD
,
240 "<a target=\"_blank\" href=\"" );
241 if ( EFI_ERROR ( Status
)) {
244 Status
= HttpSendUnicodeString ( SocketFD
,
247 if ( EFI_ERROR ( Status
)) {
250 Status
= HttpSendAnsiString ( SocketFD
,
253 if ( EFI_ERROR ( Status
)) {
257 Status
= HttpSendHexValue ( SocketFD
,
260 if ( EFI_ERROR ( Status
)) {
263 if ( NULL
!= pWebPage
) {
264 Status
= HttpSendAnsiString ( SocketFD
,
267 if ( EFI_ERROR ( Status
)) {
271 Status
= HttpSendAnsiString ( SocketFD
,
273 "</code></td></tr>\r\n" );
278 // Return the operation status
280 DBG_EXIT_STATUS ( Status
);
286 Display a row containing a pointer
288 @param [in] SocketFD The socket's file descriptor to add to the list.
289 @param [in] pPort The WSDT_PORT structure address
290 @param [in] pName Address of a zero terminated name string
291 @param [in] pAddress The address to display
292 @param [in] pWebPage Address of a zero terminated web page name
294 @retval EFI_SUCCESS The request was successfully processed
300 IN WSDT_PORT
* pPort
,
301 IN CONST CHAR8
* pName
,
302 IN CONST VOID
* pAddress
,
303 IN CONST CHAR16
* pWebPage
311 // Use for/break instead of goto
314 Status
= HttpSendAnsiString ( SocketFD
,
317 if ( EFI_ERROR ( Status
)) {
320 Status
= HttpSendAnsiString ( SocketFD
,
323 if ( EFI_ERROR ( Status
)) {
326 Status
= HttpSendAnsiString ( SocketFD
,
329 if ( EFI_ERROR ( Status
)) {
332 if ( NULL
!= pWebPage
) {
333 Status
= HttpSendAnsiString ( SocketFD
,
335 "<a target=\"_blank\" href=\"" );
336 if ( EFI_ERROR ( Status
)) {
339 Status
= HttpSendUnicodeString ( SocketFD
,
342 if ( EFI_ERROR ( Status
)) {
345 Status
= HttpSendAnsiString ( SocketFD
,
348 if ( EFI_ERROR ( Status
)) {
352 Status
= HttpSendAnsiString ( SocketFD
,
355 if ( EFI_ERROR ( Status
)) {
358 Status
= HttpSendHexBits ( SocketFD
,
360 sizeof ( pAddress
) * 8,
361 (UINT64
)(UINTN
)pAddress
);
362 if ( EFI_ERROR ( Status
)) {
365 if ( NULL
!= pWebPage
) {
366 Status
= HttpSendAnsiString ( SocketFD
,
369 if ( EFI_ERROR ( Status
)) {
373 Status
= HttpSendAnsiString ( SocketFD
,
375 "</code></td></tr>\r\n" );
380 // Return the operation status
382 DBG_EXIT_STATUS ( Status
);
388 Display a row containing a revision
390 @param [in] SocketFD The socket's file descriptor to add to the list.
391 @param [in] pPort The WSDT_PORT structure address
392 @param [in] pName Address of a zero terminated name string
393 @param [in] Revision The revision to display
395 @retval EFI_SUCCESS The request was successfully processed
401 IN WSDT_PORT
* pPort
,
402 IN CONST CHAR8
* pName
,
411 // Use for/break instead of goto
414 Status
= HttpSendAnsiString ( SocketFD
,
417 if ( EFI_ERROR ( Status
)) {
420 Status
= HttpSendAnsiString ( SocketFD
,
423 if ( EFI_ERROR ( Status
)) {
426 Status
= HttpSendAnsiString ( SocketFD
,
429 if ( EFI_ERROR ( Status
)) {
432 Status
= HttpSendValue ( SocketFD
,
435 if ( EFI_ERROR ( Status
)) {
438 Status
= HttpSendByte ( SocketFD
,
441 if ( EFI_ERROR ( Status
)) {
444 Status
= HttpSendValue ( SocketFD
,
447 if ( EFI_ERROR ( Status
)) {
450 Status
= HttpSendAnsiString ( SocketFD
,
452 "</code></td></tr>\r\n" );
457 // Return the operation status
459 DBG_EXIT_STATUS ( Status
);
465 Display a row containing a unicode string
467 @param [in] SocketFD The socket's file descriptor to add to the list.
468 @param [in] pPort The WSDT_PORT structure address
469 @param [in] pName Address of a zero terminated name string
470 @param [in] pString Address of a zero terminated unicode string
472 @retval EFI_SUCCESS The request was successfully processed
478 IN WSDT_PORT
* pPort
,
479 IN CONST CHAR8
* pName
,
480 IN CONST CHAR16
* pString
488 // Use for/break instead of goto
491 Status
= HttpSendAnsiString ( SocketFD
,
494 if ( EFI_ERROR ( Status
)) {
497 Status
= HttpSendAnsiString ( SocketFD
,
500 if ( EFI_ERROR ( Status
)) {
503 Status
= HttpSendAnsiString ( SocketFD
,
506 if ( EFI_ERROR ( Status
)) {
509 Status
= HttpSendUnicodeString ( SocketFD
,
512 if ( EFI_ERROR ( Status
)) {
515 Status
= HttpSendAnsiString ( SocketFD
,
522 // Return the operation status
524 DBG_EXIT_STATUS ( Status
);
532 @param [in] SocketFD The socket's file descriptor to add to the list.
533 @param [in] pPort The WSDT_PORT structure address
534 @param [in] pName Address of a zero terminated name string
535 @param [in] pTable Address of the table
537 @retval EFI_SUCCESS The request was successfully processed
543 IN WSDT_PORT
* pPort
,
544 IN CONST CHAR16
* pName
,
545 IN CONST VOID
* pTable
553 // Use for/break instead of goto
557 // Send the page header
559 Status
= HttpPageHeader ( SocketFD
, pPort
, pName
);
560 if ( EFI_ERROR ( Status
)) {
565 // Build the table header
567 Status
= HttpSendAnsiString ( SocketFD
,
570 if ( EFI_ERROR ( Status
)) {
573 Status
= HttpSendUnicodeString ( SocketFD
,
576 if ( EFI_ERROR ( Status
)) {
579 if ( NULL
!= pTable
) {
580 Status
= HttpSendAnsiString ( SocketFD
,
583 if ( EFI_ERROR ( Status
)) {
586 Status
= HttpSendHexBits ( SocketFD
,
588 sizeof ( pTable
) * 8,
589 (UINT64
)(UINTN
)pTable
);
590 if ( EFI_ERROR ( Status
)) {
594 Status
= HttpSendAnsiString ( SocketFD
,
597 "<table border=\"1\">\r\n"
598 " <tr bgcolor=\"c0c0ff\"><th>Field Name</th><th>Value</th></tr>\r\n" );
603 // Return the operation status
605 DBG_EXIT_STATUS ( Status
);
613 @param [in] SocketFD The socket's file descriptor to add to the list.
614 @param [in] pPort The WSDT_PORT structure address
615 @param [out] pbDone Address to receive the request completion status
617 @retval EFI_SUCCESS The request was successfully processed
623 IN WSDT_PORT
* pPort
,
632 // Use for/break instead of goto
636 // Build the table trailer
638 Status
= HttpSendAnsiString ( SocketFD
,
641 if ( EFI_ERROR ( Status
)) {
646 // Send the page trailer
648 Status
= HttpPageTrailer ( SocketFD
, pPort
, pbDone
);
653 // Return the operation status
655 DBG_EXIT_STATUS ( Status
);
661 Respond with the system table
663 @param [in] SocketFD The socket's file descriptor to add to the list.
664 @param [in] pPort The WSDT_PORT structure address
665 @param [out] pbDone Address to receive the request completion status
667 @retval EFI_SUCCESS The request was successfully processed
673 IN WSDT_PORT
* pPort
,
682 // Send the system table page
686 // Send the page and table header
688 Status
= TableHeader ( SocketFD
, pPort
, L
"System Table", gST
);
689 if ( EFI_ERROR ( Status
)) {
694 /// The table header for the EFI System Table.
696 Status
= EfiTableHeader ( SocketFD
,
699 if ( EFI_ERROR ( Status
)) {
704 /// A pointer to a null terminated string that identifies the vendor
705 /// that produces the system firmware for the platform.
707 Status
= RowUnicodeString ( SocketFD
,
710 gST
->FirmwareVendor
);
711 if ( EFI_ERROR ( Status
)) {
716 /// A firmware vendor specific value that identifies the revision
717 /// of the system firmware for the platform.
719 Status
= RowRevision ( SocketFD
,
722 gST
->FirmwareRevision
);
723 if ( EFI_ERROR ( Status
)) {
728 /// The handle for the active console input device. This handle must support
729 /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
731 Status
= RowPointer ( SocketFD
,
734 (VOID
*)gST
->ConsoleInHandle
,
736 if ( EFI_ERROR ( Status
)) {
741 /// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
742 /// associated with ConsoleInHandle.
744 Status
= RowPointer ( SocketFD
,
749 if ( EFI_ERROR ( Status
)) {
754 /// The handle for the active console output device.
756 Status
= RowPointer ( SocketFD
,
759 (VOID
*)gST
->ConsoleOutHandle
,
761 if ( EFI_ERROR ( Status
)) {
766 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
767 /// that is associated with ConsoleOutHandle.
769 Status
= RowPointer ( SocketFD
,
774 if ( EFI_ERROR ( Status
)) {
779 /// The handle for the active standard error console device.
780 /// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
782 Status
= RowPointer ( SocketFD
,
784 "StandardErrorHandle",
785 (VOID
*)gST
->StandardErrorHandle
,
787 if ( EFI_ERROR ( Status
)) {
792 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
793 /// that is associated with StandardErrorHandle.
795 Status
= RowPointer ( SocketFD
,
800 if ( EFI_ERROR ( Status
)) {
805 /// A pointer to the EFI Runtime Services Table.
807 Status
= RowPointer ( SocketFD
,
810 (VOID
*)gST
->RuntimeServices
,
811 PAGE_RUNTIME_SERVICES_TABLE
);
814 /// A pointer to the EFI Boot Services Table.
816 Status
= RowPointer ( SocketFD
,
819 (VOID
*)gST
->BootServices
,
820 PAGE_BOOT_SERVICES_TABLE
);
821 if ( EFI_ERROR ( Status
)) {
826 /// The number of system configuration tables in the buffer ConfigurationTable.
828 Status
= RowDecimalValue ( SocketFD
,
830 "NumberOfTableEntries",
831 gST
->NumberOfTableEntries
);
832 if ( EFI_ERROR ( Status
)) {
837 /// A pointer to the system configuration tables.
838 /// The number of entries in the table is NumberOfTableEntries.
840 Status
= RowPointer ( SocketFD
,
842 "ConfigurationTable",
843 (VOID
*)gST
->ConfigurationTable
,
844 PAGE_CONFIGURATION_TABLE
);
845 if ( EFI_ERROR ( Status
)) {
850 // Build the table trailer
852 Status
= TableTrailer ( SocketFD
,
859 // Return the operation status
861 DBG_EXIT_STATUS ( Status
);