Home | History | Annotate | Download | only in BaseS3BootScriptLibNull
      1 /** @file
      2   Null function implementation for EFI S3 boot script.
      3 
      4   Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
      5 
      6   This program and the accompanying materials
      7   are licensed and made available under the terms and conditions
      8   of the BSD License which accompanies this distribution.  The
      9   full text of the license may be found at
     10   http://opensource.org/licenses/bsd-license.php
     11 
     12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     14 
     15 **/
     16 
     17 
     18 #include <Base.h>
     19 #include <Library/S3BootScriptLib.h>
     20 
     21 /**
     22   Save I/O write to boot script
     23 
     24   @param Width  the width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
     25   @param Address The base address of the I/O operations.
     26   @param Count   The number of I/O operations to perform.
     27   @param Buffer  The source buffer from which to write data.
     28 
     29   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
     30   @retval RETURN_SUCCESS           Opcode is added.
     31 **/
     32 RETURN_STATUS
     33 EFIAPI
     34 S3BootScriptSaveIoWrite (
     35   IN  S3_BOOT_SCRIPT_LIB_WIDTH             Width,
     36   IN  UINT64                            Address,
     37   IN  UINTN                             Count,
     38   IN  VOID                              *Buffer
     39   )
     40 {
     41 	return RETURN_SUCCESS;
     42 }
     43 
     44 /**
     45   Adds a record for an I/O modify operation into a S3 boot script table
     46 
     47   @param Width   The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
     48   @param Address The base address of the I/O operations.
     49   @param Data    A pointer to the data to be OR-ed.
     50   @param DataMask  A pointer to the data mask to be AND-ed with the data read from the register
     51 
     52   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
     53   @retval RETURN_SUCCESS           Opcode is added.
     54 **/
     55 RETURN_STATUS
     56 EFIAPI
     57 S3BootScriptSaveIoReadWrite (
     58   IN  S3_BOOT_SCRIPT_LIB_WIDTH             Width,
     59   IN  UINT64                           Address,
     60   IN  VOID                            *Data,
     61   IN  VOID                            *DataMask
     62   )
     63 {
     64 	return RETURN_SUCCESS;
     65 }
     66 
     67 /**
     68   Adds a record for a memory write operation into a specified boot script table.
     69 
     70   @param Width   The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
     71   @param Address The base address of the memory operations
     72   @param Count   The number of memory operations to perform.
     73   @param Buffer  The source buffer from which to write the data.
     74 
     75   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
     76   @retval RETURN_SUCCESS           Opcode is added.
     77 **/
     78 RETURN_STATUS
     79 EFIAPI
     80 S3BootScriptSaveMemWrite (
     81   IN  S3_BOOT_SCRIPT_LIB_WIDTH              Width,
     82   IN  UINT64                            Address,
     83   IN  UINTN                             Count,
     84   IN  VOID                              *Buffer
     85   )
     86 {
     87 	return RETURN_SUCCESS;
     88 }
     89 /**
     90   Adds a record for a memory modify operation into a specified boot script table.
     91 
     92   @param Width     The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
     93   @param Address   The base address of the memory operations. Address needs alignment if required
     94   @param Data      A pointer to the data to be OR-ed.
     95   @param DataMask  A pointer to the data mask to be AND-ed with the data read from the register.
     96 
     97   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
     98   @retval RETURN_SUCCESS           Opcode is added.
     99 **/
    100 RETURN_STATUS
    101 EFIAPI
    102 S3BootScriptSaveMemReadWrite (
    103   IN  S3_BOOT_SCRIPT_LIB_WIDTH             Width,
    104   IN  UINT64                            Address,
    105   IN  VOID                              *Data,
    106   IN  VOID                              *DataMask
    107   )
    108 {
    109 	return RETURN_SUCCESS;
    110 }
    111 /**
    112   Adds a record for a PCI configuration space write operation into a specified boot script table.
    113 
    114   @param Width     The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
    115   @param Address   The address within the PCI configuration space.
    116   @param Count     The number of PCI operations to perform.
    117   @param Buffer    The source buffer from which to write the data.
    118 
    119   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    120   @retval RETURN_SUCCESS           Opcode is added.
    121 **/
    122 RETURN_STATUS
    123 EFIAPI
    124 S3BootScriptSavePciCfgWrite (
    125   IN  S3_BOOT_SCRIPT_LIB_WIDTH             Width,
    126   IN  UINT64                           Address,
    127   IN  UINTN                            Count,
    128   IN  VOID                            *Buffer
    129   )
    130 {
    131 	return RETURN_SUCCESS;
    132 }
    133 
    134 /**
    135   Adds a record for a PCI configuration space modify operation into a specified boot script table.
    136 
    137   @param Width     The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
    138   @param Address   The address within the PCI configuration space.
    139   @param Data      A pointer to the data to be OR-ed.The size depends on Width.
    140   @param DataMask    A pointer to the data mask to be AND-ed.
    141 
    142   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    143   @retval RETURN__SUCCESS           Opcode is added.
    144 **/
    145 RETURN_STATUS
    146 EFIAPI
    147 S3BootScriptSavePciCfgReadWrite (
    148   IN  S3_BOOT_SCRIPT_LIB_WIDTH          Width,
    149   IN  UINT64                            Address,
    150   IN  VOID                              *Data,
    151   IN  VOID                              *DataMask
    152   )
    153 {
    154 	return RETURN_SUCCESS;
    155 }
    156 /**
    157   Adds a record for a PCI configuration space modify operation into a specified boot script table.
    158 
    159   @param Width     The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
    160   @param Segment   The PCI segment number for Address.
    161   @param Address   The address within the PCI configuration space.
    162   @param Count     The number of PCI operations to perform.
    163   @param Buffer    The source buffer from which to write the data.
    164 
    165   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    166   @retval RETURN_SUCCESS           Opcode is added.
    167 **/
    168 RETURN_STATUS
    169 EFIAPI
    170 S3BootScriptSavePciCfg2Write (
    171   IN S3_BOOT_SCRIPT_LIB_WIDTH        Width,
    172   IN UINT16                          Segment,
    173   IN UINT64                          Address,
    174   IN UINTN                           Count,
    175   IN VOID                           *Buffer
    176   )
    177 {
    178 	return RETURN_SUCCESS;
    179 }
    180 /**
    181   Adds a record for a PCI configuration space modify operation into a specified boot script table.
    182 
    183   @param Width     The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
    184   @param Segment   The PCI segment number for Address.
    185   @param Address   The address within the PCI configuration space.
    186   @param Data      A pointer to the data to be OR-ed. The size depends on Width.
    187   @param DataMask    A pointer to the data mask to be AND-ed.
    188 
    189   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    190   @retval RETURN_SUCCESS           Opcode is added.
    191 **/
    192 RETURN_STATUS
    193 EFIAPI
    194 S3BootScriptSavePciCfg2ReadWrite (
    195   IN S3_BOOT_SCRIPT_LIB_WIDTH            Width,
    196   IN UINT16                          Segment,
    197   IN UINT64                          Address,
    198   IN VOID                           *Data,
    199   IN VOID                           *DataMask
    200   )
    201 {
    202 	return RETURN_SUCCESS;
    203 }
    204 /**
    205   Adds a record for an SMBus command execution into a specified boot script table.
    206 
    207   @param  SmBusAddress  Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC.
    208   @param Operation      Indicates which particular SMBus protocol it will use to execute the SMBus
    209                         transactions.
    210   @param Length         A pointer to signify the number of bytes that this operation will do.
    211   @param Buffer         Contains the value of data to execute to the SMBUS slave device.
    212 
    213   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    214   @retval RETURN_SUCCESS           Opcode is added.
    215 **/
    216 RETURN_STATUS
    217 EFIAPI
    218 S3BootScriptSaveSmbusExecute (
    219   IN  UINTN                             SmBusAddress,
    220   IN  EFI_SMBUS_OPERATION               Operation,
    221   IN  UINTN                             *Length,
    222   IN  VOID                              *Buffer
    223   )
    224 {
    225 	return RETURN_SUCCESS;
    226 }
    227 /**
    228   Adds a record for an execution stall on the processor into a specified boot script table.
    229 
    230   @param Duration   Duration in microseconds of the stall
    231 
    232   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    233   @retval RETURN_SUCCESS           Opcode is added.
    234 **/
    235 RETURN_STATUS
    236 EFIAPI
    237 S3BootScriptSaveStall (
    238   IN  UINTN                             Duration
    239   )
    240 {
    241 	return RETURN_SUCCESS;
    242 }
    243 /**
    244   Adds a record for dispatching specified arbitrary code into a specified boot script table.
    245 
    246   @param EntryPoint   Entry point of the code to be dispatched.
    247 
    248   @retval RETURN_OUT_OF_RESOURCES   Not enough memory for the table do operation.
    249   @retval RETURN_SUCCESS            Opcode is added.
    250 **/
    251 RETURN_STATUS
    252 EFIAPI
    253 S3BootScriptSaveDispatch (
    254   IN  VOID *EntryPoint
    255   )
    256 {
    257   return RETURN_SUCCESS;
    258 }
    259 /**
    260   Adds a record for dispatching specified arbitrary code into a specified boot script table.
    261 
    262   @param EntryPoint   Entry point of the code to be dispatched.
    263   @param Context      Argument to be passed into the EntryPoint of the code to be dispatched.
    264 
    265   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    266   @retval RETURN_SUCCESS           Opcode is added.
    267 **/
    268 RETURN_STATUS
    269 EFIAPI
    270 S3BootScriptSaveDispatch2 (
    271   IN  VOID                              *EntryPoint,
    272   IN  VOID                              *Context
    273   )
    274 {
    275 	return RETURN_SUCCESS;
    276 }
    277 
    278 /**
    279   Adds a record for memory reads of the memory location and continues when the exit criteria is
    280   satisfied or after a defined duration.
    281 
    282   Please aware, below interface is different with PI specification, Vol 5:
    283   EFI_S3_SAVE_STATE_PROTOCOL.Write() for EFI_BOOT_SCRIPT_MEM_POLL_OPCODE.
    284   "Duration" below is microseconds, while "Delay" in PI specification means
    285   the number of 100ns units to poll.
    286 
    287   @param Width     The width of the memory operations.
    288   @param Address   The base address of the memory operations.
    289   @param BitMask   A pointer to the bit mask to be AND-ed with the data read from the register.
    290   @param BitValue  A pointer to the data value after to be Masked.
    291   @param Duration  Duration in microseconds of the stall.
    292   @param LoopTimes The times of the register polling.
    293 
    294   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    295   @retval RETURN_SUCCESS           Opcode is added.
    296 
    297 **/
    298 RETURN_STATUS
    299 EFIAPI
    300 S3BootScriptSaveMemPoll (
    301   IN  S3_BOOT_SCRIPT_LIB_WIDTH             Width,
    302   IN  UINT64                            Address,
    303   IN  VOID                              *BitMask,
    304   IN  VOID                              *BitValue,
    305   IN  UINTN                             Duration,
    306   IN  UINT64                            LoopTimes
    307   )
    308 {
    309 	return RETURN_SUCCESS;
    310 }
    311 
    312 /**
    313   Store arbitrary information in the boot script table. This opcode is a no-op on dispatch and is only
    314   used for debugging script issues.
    315 
    316   @param InformationLength   Length of the data in bytes
    317   @param Information       Information to be logged in the boot scrpit
    318 
    319   @retval RETURN_UNSUPPORTED   If  entering runtime, this method will not support.
    320   @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    321   @retval RETURN_SUCCESS           Opcode is added.
    322 
    323 **/
    324 RETURN_STATUS
    325 EFIAPI
    326 S3BootScriptSaveInformation (
    327   IN  UINT32                   InformationLength,
    328   IN  VOID                    *Information
    329   )
    330 {
    331 	return RETURN_SUCCESS;
    332 }
    333 /**
    334   Adds a record for I/O reads the I/O location and continues when the exit criteria is satisfied or after a
    335   defined duration.
    336 
    337   @param  Width                 The width of the I/O operations.
    338   @param  Address               The base address of the I/O operations.
    339   @param  Data                  The comparison value used for the polling exit criteria.
    340   @param  DataMask              Mask used for the polling criteria. The bits in the bytes below Width which are zero
    341                                 in Data are ignored when polling the memory address.
    342   @param  Delay                 The number of 100ns units to poll. Note that timer available may be of poorer
    343                                 granularity so the delay may be longer.
    344 
    345  @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    346  @retval RETURN_SUCCESS          Opcode is added.
    347 
    348 **/
    349 RETURN_STATUS
    350 EFIAPI
    351 S3BootScriptSaveIoPoll (
    352   IN S3_BOOT_SCRIPT_LIB_WIDTH       Width,
    353   IN UINT64                     Address,
    354   IN VOID                      *Data,
    355   IN VOID                      *DataMask,
    356   IN UINT64                     Delay
    357   )
    358 {
    359 	return RETURN_SUCCESS;
    360 }
    361 
    362 /**
    363   Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
    364   after a defined duration.
    365 
    366   @param  Width                 The width of the I/O operations.
    367   @param  Address               The address within the PCI configuration space.
    368   @param  Data                  The comparison value used for the polling exit criteria.
    369   @param  DataMask              Mask used for the polling criteria. The bits in the bytes below Width which are zero
    370                                 in Data are ignored when polling the memory address
    371   @param  Delay                 The number of 100ns units to poll. Note that timer available may be of poorer
    372                                 granularity so the delay may be longer.
    373 
    374  @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    375  @retval RETURN_SUCCESS           Opcode is added.
    376 
    377 **/
    378 RETURN_STATUS
    379 EFIAPI
    380 S3BootScriptSavePciPoll (
    381    IN S3_BOOT_SCRIPT_LIB_WIDTH   Width,
    382    IN UINT64                     Address,
    383    IN VOID                      *Data,
    384    IN VOID                      *DataMask,
    385    IN UINT64                     Delay
    386  )
    387 {
    388 	return RETURN_SUCCESS;
    389 }
    390 /**
    391   Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
    392   after a defined duration.
    393 
    394   @param  Width                 The width of the I/O operations.
    395   @param  Segment               The PCI segment number for Address.
    396   @param  Address               The address within the PCI configuration space.
    397   @param  Data                  The comparison value used for the polling exit criteria.
    398   @param  DataMask              Mask used for the polling criteria. The bits in the bytes below Width which are zero
    399                                 in Data are ignored when polling the memory address
    400   @param  Delay                 The number of 100ns units to poll. Note that timer available may be of poorer
    401                                 granularity so the delay may be longer.
    402 
    403  @retval RETURN_OUT_OF_RESOURCES  Not enough memory for the table do operation.
    404  @retval RETURN_SUCCESS           Opcode is added.
    405  @note   A known Limitations in the implementation: When interpreting the opcode  EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
    406          EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as
    407          Zero, or else, assert.
    408 
    409 **/
    410 RETURN_STATUS
    411 EFIAPI
    412 S3BootScriptSavePci2Poll (
    413    IN S3_BOOT_SCRIPT_LIB_WIDTH      Width,
    414    IN UINT16                        Segment,
    415    IN UINT64                        Address,
    416    IN VOID                         *Data,
    417    IN VOID                         *DataMask,
    418    IN UINT64                        Delay
    419   )
    420 {
    421 	return RETURN_SUCCESS;
    422 }
    423 /**
    424   Save ASCII string information specified by Buffer to
    425   boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE
    426 
    427   @param  String         the ascii string to store into the S3 boot script table
    428 
    429   @retval RETURN_NOT_FOUND  BootScriptSave Protocol not exist.
    430   @retval RETURN_SUCCESS     BootScriptSave Protocol exist, always returns RETURN_SUCCESS
    431 
    432 **/
    433 RETURN_STATUS
    434 EFIAPI
    435 S3BootScriptSaveInformationAsciiString (
    436   IN  CONST CHAR8               *String
    437   )
    438 {
    439 	return RETURN_SUCCESS;
    440 }
    441 /**
    442   This is an function to close the S3 boot script table. The function could only be called in
    443   BOOT time phase. To comply with the Framework spec definition on
    444   EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:
    445   1. Closes the specified boot script table
    446   2. It allocates a new memory pool to duplicate all the boot scripts in the specified table.
    447      Once this function is called, the table maintained by the library will be destroyed
    448      after it is copied into the allocated pool.
    449   3. Any attempts to add a script record after calling this function will cause a new table
    450      to be created by the library.
    451   4. The base address of the allocated pool will be returned in Address. Note that after
    452      using the boot script table, the CALLER is responsible for freeing the pool that is allocated
    453      by this function.
    454 
    455   In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. By then it is not
    456   necessary to provide this API in BootScriptLib. To provides this API for now is only to meet
    457   the requirement from Framework Spec.
    458 
    459   If anyone does call CloseTable() on a real platform, then the caller is responsible for figuring out
    460   how to get the script to run on an S3 resume because the boot script maintained by the lib will be
    461   destroyed.
    462 
    463   @return the base address of the new copy of the boot script table.
    464 
    465 **/
    466 UINT8*
    467 EFIAPI
    468 S3BootScriptCloseTable (
    469   VOID
    470   )
    471 {
    472 	return 0;
    473 }
    474 /**
    475   Executes the S3 boot script table.
    476 
    477   @param RETURN_SUCCESS           The boot script table was executed successfully.
    478   @param RETURN_UNSUPPORTED       Invalid script table or opcode.
    479 **/
    480 RETURN_STATUS
    481 EFIAPI
    482 S3BootScriptExecute (
    483    VOID
    484   )
    485 {
    486 	return RETURN_SUCCESS;
    487 }
    488 /**
    489   Move the last boot script entry to the position
    490 
    491   @param  BeforeOrAfter         Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position
    492                                 in the boot script table specified by Position. If Position is NULL or points to
    493                                 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end
    494                                 of the table (if FALSE).
    495   @param  Position              On entry, specifies the position in the boot script table where the opcode will be
    496                                 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies
    497                                 the position of the inserted opcode in the boot script table.
    498 
    499   @retval RETURN_OUT_OF_RESOURCES  The table is not available.
    500   @retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.
    501   @retval RETURN_SUCCESS           Opcode is inserted.
    502 **/
    503 RETURN_STATUS
    504 EFIAPI
    505 S3BootScriptMoveLastOpcode (
    506   IN     BOOLEAN                        BeforeOrAfter,
    507   IN OUT VOID                         **Position OPTIONAL
    508 )
    509 {
    510 	return RETURN_SUCCESS;
    511 }
    512 /**
    513   Find a label within the boot script table and, if not present, optionally create it.
    514 
    515   @param  BeforeOrAfter         Specifies whether the opcode is stored before (TRUE)
    516                                 or after (FALSE) the position in the boot script table
    517                                 specified by Position.
    518   @param  CreateIfNotFound      Specifies whether the label will be created if the label
    519                                 does not exists (TRUE) or not (FALSE).
    520   @param  Position              On entry, specifies the position in the boot script table
    521                                 where the opcode will be inserted, either before or after,
    522                                 depending on BeforeOrAfter. On exit, specifies the position
    523                                 of the inserted opcode in the boot script table.
    524   @param  Label                 Points to the label which will be inserted in the boot script table.
    525 
    526   @retval EFI_SUCCESS           The operation succeeded. A record was added into the
    527                                 specified script table.
    528   @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
    529                                 If the opcode is unknow or not supported because of the PCD
    530                                 Feature Flags.
    531   @retval EFI_OUT_OF_RESOURCES  There is insufficient memory to store the boot script.
    532 
    533 **/
    534 RETURN_STATUS
    535 EFIAPI
    536 S3BootScriptLabel (
    537   IN       BOOLEAN                      BeforeOrAfter,
    538   IN       BOOLEAN                      CreateIfNotFound,
    539   IN OUT   VOID                       **Position OPTIONAL,
    540   IN CONST CHAR8                       *Label
    541   )
    542 {
    543 	return RETURN_SUCCESS;
    544 }
    545 /**
    546   Compare two positions in the boot script table and return their relative position.
    547   @param  Position1             The positions in the boot script table to compare
    548   @param  Position2             The positions in the boot script table to compare
    549   @param  RelativePosition      On return, points to the result of the comparison
    550 
    551   @retval EFI_SUCCESS           The operation succeeded. A record was added into the
    552                                 specified script table.
    553   @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
    554                                 If the opcode is unknow or not supported because of the PCD
    555                                 Feature Flags.
    556   @retval EFI_OUT_OF_RESOURCES  There is insufficient memory to store the boot script.
    557 
    558 **/
    559 RETURN_STATUS
    560 EFIAPI
    561 S3BootScriptCompare (
    562   IN  UINT8                       *Position1,
    563   IN  UINT8                       *Position2,
    564   OUT UINTN                       *RelativePosition
    565   )
    566 {
    567 	return RETURN_SUCCESS;
    568 }
    569