TianoCore EDK2 master
Loading...
Searching...
No Matches
S3SaveState.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS BootScriptWriteIoWrite (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteIoReadWrite (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteMemWrite (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteMemReadWrite (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWritePciCfgWrite (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWritePciCfgReadWrite (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWritePciCfg2Write (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWritePciCfg2ReadWrite (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteSmbusExecute (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteStall (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteDispatch (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteMemPoll (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteDispatch2 (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteInformation (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWriteIoPoll (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWritePciConfigPoll (IN VA_LIST Marker)
 
EFI_STATUS BootScriptWritePciConfig2Poll (IN VA_LIST Marker)
 
EFI_STATUS EFIAPI BootScriptWrite (IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN UINTN OpCode,...)
 
EFI_STATUS EFIAPI BootScriptInsert (IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN BOOLEAN BeforeOrAfter, IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL, IN UINTN OpCode,...)
 
EFI_STATUS EFIAPI BootScriptLabel (IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN BOOLEAN BeforeOrAfter, IN BOOLEAN CreateIfNotFound, IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL, IN CONST CHAR8 *Label)
 
EFI_STATUS EFIAPI BootScriptCompare (IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN EFI_S3_BOOT_SCRIPT_POSITION Position1, IN EFI_S3_BOOT_SCRIPT_POSITION Position2, OUT UINTN *RelativePosition)
 
EFI_STATUS EFIAPI InitializeS3SaveState (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_HANDLE mHandle = NULL
 
EFI_S3_SAVE_STATE_PROTOCOL mS3SaveState
 

Detailed Description

Implementation for S3 Boot Script Saver state driver.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file S3SaveState.c.

Function Documentation

◆ BootScriptCompare()

EFI_STATUS EFIAPI BootScriptCompare ( IN CONST EFI_S3_SAVE_STATE_PROTOCOL This,
IN EFI_S3_BOOT_SCRIPT_POSITION  Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION  Position2,
OUT UINTN RelativePosition 
)

Compare two positions in the boot script table and return their relative position.

This function compares two positions in the boot script table and returns their relative positions. If Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2, then 0 is returned. If Position1 is after Position2, then 1 is returned.

Parameters
ThisA pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
Position1The positions in the boot script table to compare
Position2The positions in the boot script table to compare
RelativePositionOn return, points to the result of the comparison
Return values
EFI_SUCCESSThe operation succeeded.
EFI_INVALID_PARAMETERThe Position1 or Position2 is not a valid position in the boot script table.
EFI_INVALID_PARAMETERThe RelativePosition is NULL.

Definition at line 886 of file S3SaveState.c.

◆ BootScriptInsert()

EFI_STATUS EFIAPI BootScriptInsert ( IN CONST EFI_S3_SAVE_STATE_PROTOCOL This,
IN BOOLEAN  BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position  OPTIONAL,
IN UINTN  OpCode,
  ... 
)

Insert a record into a specified Framework boot script table.

This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is assumed this protocol has platform specific mechanism to store the OpCode set and replay them during the S3 resume. The opcode is inserted before or after the specified position in the boot script table. If Position is NULL then that position is after the last opcode in the table (BeforeOrAfter is FALSE) or before the first opcode in the table (BeforeOrAfter is TRUE). The position which is pointed to by Position upon return can be used for subsequent insertions.

Parameters
ThisA pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
BeforeOrAfterSpecifies whether the opcode is stored before (TRUE) or after (FALSE) the position in the boot script table specified by Position. If Position is NULL or points to NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end of the table (if FALSE).
PositionOn entry, specifies the position in the boot script table where the opcode will be inserted, either before or after, depending on BeforeOrAfter. On exit, specifies the position of the inserted opcode in the boot script table.
OpCodeThe operation code (opcode) number.
...Argument list that is specific to each opcode.
Return values
EFI_SUCCESSThe operation succeeded. A record was added into the specified script table.
EFI_INVALID_PARAMETERThe Opcode is an invalid opcode value or the Position is not a valid position in the boot script table..
EFI_OUT_OF_RESOURCESThere is insufficient memory to store the boot script.

Definition at line 697 of file S3SaveState.c.

◆ BootScriptLabel()

EFI_STATUS EFIAPI BootScriptLabel ( IN CONST EFI_S3_SAVE_STATE_PROTOCOL This,
IN BOOLEAN  BeforeOrAfter,
IN BOOLEAN  CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position  OPTIONAL,
IN CONST CHAR8 *  Label 
)

Find a label within the boot script table and, if not present, optionally create it.

If the label Label is already exists in the boot script table, then no new label is created, the position of the Label is returned in *Position and EFI_SUCCESS is returned. If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be created before or after the specified position and EFI_SUCCESS is returned. If the label Label does not already exist and CreateIfNotFound is FALSE, then EFI_NOT_FOUND is returned.

Parameters
ThisA pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
BeforeOrAfterSpecifies whether the label is stored before (TRUE) or after (FALSE) the position in the boot script table specified by Position. If Position is NULL or points to NULL then the new label is inserted at the beginning of the table (if TRUE) or end of the table (if FALSE).
CreateIfNotFoundSpecifies whether the label will be created if the label does not exists (TRUE) or not (FALSE).
PositionOn entry, specifies the position in the boot script table where the label will be inserted, either before or after, depending on BeforeOrAfter. On exit, specifies the position of the inserted label in the boot script table.
LabelPoints to the label which will be inserted in the boot script table.
Return values
EFI_SUCCESSThe label already exists or was inserted.
EFI_INVALID_PARAMETERThe Label is NULL or points to an empty string.
EFI_INVALID_PARAMETERThe Position is not a valid position in the boot script table.

Definition at line 856 of file S3SaveState.c.

◆ BootScriptWrite()

EFI_STATUS EFIAPI BootScriptWrite ( IN CONST EFI_S3_SAVE_STATE_PROTOCOL This,
IN UINTN  OpCode,
  ... 
)

Adds a record into S3 boot script table.

This function is used to store a boot script record into a given boot script table. If the table specified by TableName is nonexistent in the system, a new table will automatically be created and then the script record will be added into the new table. This function is responsible for allocating necessary memory for the script.

This function has a variable parameter list. The exact parameter list depends on the OpCode that is passed into the function. If an unsupported OpCode or illegal parameter list is passed in, this function returns EFI_INVALID_PARAMETER. If there are not enough resources available for storing more scripts, this function returns EFI_OUT_OF_RESOURCES.

Parameters
ThisA pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
OpCodeThe operation code (opcode) number.
...Argument list that is specific to each opcode.
Return values
EFI_SUCCESSThe operation succeeded. A record was added into the specified script table.
EFI_INVALID_PARAMETERThe parameter is illegal or the given boot script is not supported. If the opcode is unknow or not supported because of the PCD Feature Flags.
EFI_OUT_OF_RESOURCESThere is insufficient memory to store the boot script.

Definition at line 543 of file S3SaveState.c.

◆ BootScriptWriteDispatch()

EFI_STATUS BootScriptWriteDispatch ( IN VA_LIST  Marker)

Internal function to add Save jmp address according to DISPATCH_OPCODE. We ignore "Context" parameter

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 315 of file S3SaveState.c.

◆ BootScriptWriteDispatch2()

EFI_STATUS BootScriptWriteDispatch2 ( IN VA_LIST  Marker)

Internal function to add Save jmp address according to DISPATCH_OPCODE2. The "Context" parameter is not ignored.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 387 of file S3SaveState.c.

◆ BootScriptWriteInformation()

EFI_STATUS BootScriptWriteInformation ( IN VA_LIST  Marker)

Internal function to add INFORAMTION opcode node to the table list.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enought resource to complete the operations.
EFI_SUCCESSThe opcode entry is added to the table successfully.

Definition at line 411 of file S3SaveState.c.

◆ BootScriptWriteIoPoll()

EFI_STATUS BootScriptWriteIoPoll ( IN VA_LIST  Marker)

Internal function to add IO poll opcode node to the table

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enought resource to complete the operations.
EFI_SUCCESSThe opcode entry is added to the table successfully.

Definition at line 433 of file S3SaveState.c.

◆ BootScriptWriteIoReadWrite()

EFI_STATUS BootScriptWriteIoReadWrite ( IN VA_LIST  Marker)

Internal function to add IO read/write opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 58 of file S3SaveState.c.

◆ BootScriptWriteIoWrite()

EFI_STATUS BootScriptWriteIoWrite ( IN VA_LIST  Marker)

Internal function to add IO write opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 30 of file S3SaveState.c.

◆ BootScriptWriteMemPoll()

EFI_STATUS BootScriptWriteMemPoll ( IN VA_LIST  Marker)

Internal function to add memory pool operation to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 336 of file S3SaveState.c.

◆ BootScriptWriteMemReadWrite()

EFI_STATUS BootScriptWriteMemReadWrite ( IN VA_LIST  Marker)

Internal function to add memory read/write opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 114 of file S3SaveState.c.

◆ BootScriptWriteMemWrite()

EFI_STATUS BootScriptWriteMemWrite ( IN VA_LIST  Marker)

Internal function to add memory write opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 86 of file S3SaveState.c.

◆ BootScriptWritePciCfg2ReadWrite()

EFI_STATUS BootScriptWritePciCfg2ReadWrite ( IN VA_LIST  Marker)

Internal function to PciCfg2 read/write opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 228 of file S3SaveState.c.

◆ BootScriptWritePciCfg2Write()

EFI_STATUS BootScriptWritePciCfg2Write ( IN VA_LIST  Marker)

Internal function to add PciCfg2 write opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 198 of file S3SaveState.c.

◆ BootScriptWritePciCfgReadWrite()

EFI_STATUS BootScriptWritePciCfgReadWrite ( IN VA_LIST  Marker)

Internal function to PciCfg read/write opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 170 of file S3SaveState.c.

◆ BootScriptWritePciCfgWrite()

EFI_STATUS BootScriptWritePciCfgWrite ( IN VA_LIST  Marker)

Internal function to add PciCfg write opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 142 of file S3SaveState.c.

◆ BootScriptWritePciConfig2Poll()

EFI_STATUS BootScriptWritePciConfig2Poll ( IN VA_LIST  Marker)

Internal function to add PCI config 2 poll opcode node to the table

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enought resource to complete the operations.
EFI_SUCCESSThe opcode entry is added to the table successfully.

Definition at line 493 of file S3SaveState.c.

◆ BootScriptWritePciConfigPoll()

EFI_STATUS BootScriptWritePciConfigPoll ( IN VA_LIST  Marker)

Internal function to add PCI config poll opcode node to the table

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enought resource to complete the operations.
EFI_SUCCESSThe opcode entry is added to the table successfully.

Definition at line 463 of file S3SaveState.c.

◆ BootScriptWriteSmbusExecute()

EFI_STATUS BootScriptWriteSmbusExecute ( IN VA_LIST  Marker)

Internal function to add smbus execute opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 258 of file S3SaveState.c.

◆ BootScriptWriteStall()

EFI_STATUS BootScriptWriteStall ( IN VA_LIST  Marker)

Internal function to add stall opcode to the table.

Parameters
MarkerThe variable argument list to get the opcode and associated attributes.
Return values
EFI_OUT_OF_RESOURCESNot enough resource to do operation.
EFI_SUCCESSOpcode is added.

Definition at line 292 of file S3SaveState.c.

◆ InitializeS3SaveState()

EFI_STATUS EFIAPI InitializeS3SaveState ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

This routine is entry point of ScriptSave driver.

Parameters
ImageHandleHandle for this drivers loaded image protocol.
SystemTableEFI system table.
Return values
EFI_OUT_OF_RESOURCESNo enough resource
EFI_SUCCESSSuccesfully installed the ScriptSave driver.
otherErrors occurred.

Definition at line 909 of file S3SaveState.c.

Variable Documentation

◆ mHandle

EFI_HANDLE mHandle = NULL

Handle for the Capsule Update Policy Protocol

Definition at line 11 of file S3SaveState.c.

◆ mS3SaveState

Initial value:
= {
}
EFI_STATUS EFIAPI BootScriptLabel(IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN BOOLEAN BeforeOrAfter, IN BOOLEAN CreateIfNotFound, IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL, IN CONST CHAR8 *Label)
Definition: S3SaveState.c:856
EFI_STATUS EFIAPI BootScriptWrite(IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN UINTN OpCode,...)
Definition: S3SaveState.c:543
EFI_STATUS EFIAPI BootScriptInsert(IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN BOOLEAN BeforeOrAfter, IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL, IN UINTN OpCode,...)
Definition: S3SaveState.c:697
EFI_STATUS EFIAPI BootScriptCompare(IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN EFI_S3_BOOT_SCRIPT_POSITION Position1, IN EFI_S3_BOOT_SCRIPT_POSITION Position2, OUT UINTN *RelativePosition)
Definition: S3SaveState.c:886

Definition at line 12 of file S3SaveState.c.