Home | History | Annotate | Download | only in BootScriptSaveDxe
      1 /** @file
      2 //
      3 //
      4   Internal header file for S3 Boot Script Saver driver.
      5 
      6   Copyright (c) 2006  - 2014, Intel Corporation. All rights reserved.<BR>
      7 
      8   This program and the accompanying materials are licensed and made available under
     10   the terms and conditions of the BSD License that accompanies this distribution.
     12   The full text of the license may be found at
     14   http://opensource.org/licenses/bsd-license.php.
     16 
     18   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     20   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     22 
     24 
     26 **/
     27 
     28 #ifndef _INTERNAL_BOOT_SCRIPT_SAVE_H_
     29 #define _INTERNAL_BOOT_SCRIPT_SAVE_H_
     30 #include <FrameworkDxe.h>
     31 
     32 #include <Protocol/BootScriptSave.h>
     33 #include <Protocol/FirmwareVolume.h>
     34 
     35 #include <Library/BaseLib.h>
     36 #include <Library/DebugLib.h>
     37 #include <Library/UefiDriverEntryPoint.h>
     38 #include <Library/UefiBootServicesTableLib.h>
     39 #include <Library/UefiRuntimeServicesTableLib.h>
     40 #include <Library/S3BootScriptLib.h>
     41 #include <Library/PcdLib.h>
     42 #include <Library/SmbusLib.h>
     43 #include <IndustryStandard/SmBus.h>
     44 
     45 /**
     46   Adds a record into a specified Framework boot script table.
     47 
     48   This function is used to store a boot script record into a given boot
     49   script table. If the table specified by TableName is nonexistent in the
     50   system, a new table will automatically be created and then the script record
     51   will be added into the new table. A boot script table can add new script records
     52   until EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is called. Currently, the only
     53   meaningful table name is EFI_ACPI_S3_RESUME_SCRIPT_TABLE. This function is
     54   responsible for allocating necessary memory for the script.
     55 
     56   This function has a variable parameter list. The exact parameter list depends on
     57   the OpCode that is passed into the function. If an unsupported OpCode or illegal
     58   parameter list is passed in, this function returns EFI_INVALID_PARAMETER.
     59   If there are not enough resources available for storing more scripts, this function returns
     60   EFI_OUT_OF_RESOURCES.
     61 
     62   @param[in]  This                 A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
     63   @param[in]  TableName            Name of the script table. Currently, the only meaningful value is
     64                                    EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
     65   @param[in]  OpCode               The operation code (opcode) number.
     66   @param[in]  ...                  Argument list that is specific to each opcode.
     67 
     68   @retval EFI_SUCCESS              The operation succeeded. A record was added into the
     69                                    specified script table.
     70   @retval EFI_INVALID_PARAMETER    The parameter is illegal or the given boot script is not supported.
     71                                    If the opcode is unknow or not supported because of the PCD
     72                                    Feature Flags.
     73   @retval EFI_OUT_OF_RESOURCES     There is insufficient memory to store the boot script.
     74 
     75 **/
     76 EFI_STATUS
     77 EFIAPI
     78 BootScriptWrite (
     79   IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL    *This,
     80   IN UINT16                           TableName,
     81   IN UINT16                           OpCode,
     82   ...
     83   );
     84 
     85 /**
     86   Closes the specified script table.
     87 
     88   This function closes the specified boot script table and returns the base address
     89   of the table. It allocates a new pool to duplicate all the boot scripts in the specified
     90   table. Once this function is called, the specified table will be destroyed after it is
     91   copied into the allocated pool. As a result, any attempts to add a script record into a
     92   closed table will cause a new table to be created. The base address of the allocated pool
     93   will be returned in Address. After using the boot script table, the caller is responsible
     94   for freeing the pool that is allocated by this function. If the boot script table,
     95   such as EFI_ACPI_S3_RESUME_SCRIPT_TABLE, is required to be stored in a nonperturbed
     96   memory region, the caller should copy the table into the nonperturbed memory region by itself.
     97 
     98   @param[in]  This              A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
     99   @param[in]  TableName         Name of the script table. Currently, the only meaningful value is
    100                                 EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
    101   @param[in]  Address           A pointer to the physical address where the table begins.
    102 
    103   @retval EFI_SUCCESS           The table was successfully returned.
    104   @retval EFI_NOT_FOUND         The specified table was not created previously.
    105   @retval EFI_OUT_OF_RESOURCE   Memory is insufficient to hold the reorganized boot script table.
    106   @retval EFI_UNSUPPORTED       The table type is not EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
    107 
    108 **/
    109 EFI_STATUS
    110 EFIAPI
    111 BootScriptCloseTable (
    112   IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL    *This,
    113   IN UINT16                           TableName,
    114   OUT EFI_PHYSICAL_ADDRESS            *Address
    115   );
    116 #endif //_INTERNAL_BOOT_SCRIPT_SAVE_H_
    117