Home | History | Annotate | Download | only in WebServer
      1 /**
      2   @file
      3   Display the runtime services table
      4 
      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
     10 
     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.
     13 
     14 **/
     15 
     16 #include <WebServer.h>
     17 #include <Library/UefiRuntimeServicesTableLib.h>
     18 
     19 /**
     20   Respond with the runtime services table
     21 
     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 [out] pbDone       Address to receive the request completion status
     25 
     26   @retval EFI_SUCCESS       The request was successfully processed
     27 
     28 **/
     29 EFI_STATUS
     30 RuntimeSservicesTablePage (
     31   IN int SocketFD,
     32   IN WSDT_PORT * pPort,
     33   OUT BOOLEAN * pbDone
     34   )
     35 {
     36   EFI_STATUS Status;
     37 
     38   DBG_ENTER ( );
     39 
     40   //
     41   //  Send the runtime services page
     42   //
     43   for ( ; ; ) {
     44     //
     45     //  Send the page and table header
     46     //
     47     Status = TableHeader ( SocketFD, pPort, L"Runtime Services Table", gRT );
     48     if ( EFI_ERROR ( Status )) {
     49       break;
     50     }
     51 
     52     ///
     53     /// The table header for the EFI Runtime Services Table.
     54     ///
     55     Status = EfiTableHeader ( SocketFD,
     56                               pPort,
     57                               &gRT->Hdr );
     58     if ( EFI_ERROR ( Status )) {
     59       break;
     60     }
     61 
     62     //
     63     // Time Services
     64     //
     65     Status = RowPointer ( SocketFD,
     66                           pPort,
     67                           "GetTime",
     68                           (VOID *)gRT->GetTime,
     69                           NULL );
     70     if ( EFI_ERROR ( Status )) {
     71       break;
     72     }
     73     Status = RowPointer ( SocketFD,
     74                           pPort,
     75                           "SetTime",
     76                           (VOID *)gRT->SetTime,
     77                           NULL );
     78     if ( EFI_ERROR ( Status )) {
     79       break;
     80     }
     81     Status = RowPointer ( SocketFD,
     82                           pPort,
     83                           "GetWakeupTime",
     84                           (VOID *)gRT->GetWakeupTime,
     85                           NULL );
     86     if ( EFI_ERROR ( Status )) {
     87       break;
     88     }
     89     Status = RowPointer ( SocketFD,
     90                           pPort,
     91                           "SetWakeupTime",
     92                           (VOID *)gRT->SetWakeupTime,
     93                           NULL );
     94     if ( EFI_ERROR ( Status )) {
     95       break;
     96     }
     97 
     98     //
     99     // Virtual Memory Services
    100     //
    101     Status = RowPointer ( SocketFD,
    102                           pPort,
    103                           "SetVirtualAddressMap",
    104                           (VOID *)gRT->SetVirtualAddressMap,
    105                           NULL );
    106     if ( EFI_ERROR ( Status )) {
    107       break;
    108     }
    109     Status = RowPointer ( SocketFD,
    110                           pPort,
    111                           "ConvertPointer",
    112                           (VOID *)gRT->ConvertPointer,
    113                           NULL );
    114     if ( EFI_ERROR ( Status )) {
    115       break;
    116     }
    117 
    118     //
    119     // Variable Services
    120     //
    121     Status = RowPointer ( SocketFD,
    122                           pPort,
    123                           "GetVariable",
    124                           (VOID *)gRT->GetVariable,
    125                           NULL );
    126     if ( EFI_ERROR ( Status )) {
    127       break;
    128     }
    129     Status = RowPointer ( SocketFD,
    130                           pPort,
    131                           "GetNextVariableName",
    132                           (VOID *)gRT->GetNextVariableName,
    133                           NULL );
    134     if ( EFI_ERROR ( Status )) {
    135       break;
    136     }
    137     Status = RowPointer ( SocketFD,
    138                           pPort,
    139                           "SetVariable",
    140                           (VOID *)gRT->SetVariable,
    141                           NULL );
    142     if ( EFI_ERROR ( Status )) {
    143       break;
    144     }
    145 
    146     //
    147     // Miscellaneous Services
    148     //
    149     Status = RowPointer ( SocketFD,
    150                           pPort,
    151                           "GetNextHighNonotonicCount",
    152                           (VOID *)gRT->GetNextHighMonotonicCount,
    153                           NULL );
    154     if ( EFI_ERROR ( Status )) {
    155       break;
    156     }
    157     Status = RowPointer ( SocketFD,
    158                           pPort,
    159                           "ResetSystem",
    160                           (VOID *)gRT->ResetSystem,
    161                           NULL );
    162     if ( EFI_ERROR ( Status )) {
    163       break;
    164     }
    165 
    166     //
    167     //  Determine if the structures supports 2.0 services
    168     //
    169     if ( 2 <= ( gRT->Hdr.Revision >> 16 )) {
    170       //
    171       // UEFI 2.0 Capsule Services
    172       //
    173       Status = RowPointer ( SocketFD,
    174                             pPort,
    175                             "UpdateCapsule",
    176                             (VOID *)gRT->UpdateCapsule,
    177                             NULL );
    178       if ( EFI_ERROR ( Status )) {
    179         break;
    180       }
    181       Status = RowPointer ( SocketFD,
    182                             pPort,
    183                             "QueryCapsuleCapabilities",
    184                             (VOID *)gRT->QueryCapsuleCapabilities,
    185                             NULL );
    186       if ( EFI_ERROR ( Status )) {
    187         break;
    188       }
    189 
    190       //
    191       // Miscellaneous UEFI 2.0 Service
    192       //
    193       Status = RowPointer ( SocketFD,
    194                             pPort,
    195                             "QueryVariableInfo",
    196                             (VOID *)gRT->QueryVariableInfo,
    197                             NULL );
    198       if ( EFI_ERROR ( Status )) {
    199         break;
    200       }
    201     }
    202 
    203     //
    204     //  Build the table trailer
    205     //
    206     Status = TableTrailer ( SocketFD,
    207                             pPort,
    208                             pbDone );
    209     break;
    210   }
    211 
    212   //
    213   //  Return the operation status
    214   //
    215   DBG_EXIT_STATUS ( Status );
    216   return Status;
    217 }
    218