]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/S3SaveState.h
MdePkg/PiFirmwareFile: fix undefined behavior in FFS_FILE_SIZE
[mirror_edk2.git] / MdePkg / Include / Protocol / S3SaveState.h
index a535764292153ea3d2e1d85e2c4ea3b5f219630d..c1b8f8b9e08de7385ead1a23b65b97e0ccd3b41e 100644 (file)
@@ -1,18 +1,16 @@
 /** @file\r
-  S3 Save State Protocol as defined in PI1.2 Specification VOLUME 5 Standard.\r
+  S3 Save State Protocol as defined in PI 1.6(Errata A) Specification VOLUME 5 Standard.\r
 \r
-  This protocol is used by DXE PI module to store or record various IO operations \r
+  This protocol is used by DXE PI module to store or record various IO operations\r
   to be replayed during an S3 resume.\r
   This protocol is not required for all platforms.\r
-  \r
-  Copyright (c) 2009, Intel Corporation                                                         \r
-  All rights reserved. This program and the accompanying materials                          \r
-  are licensed and made available under the terms and conditions of the BSD License         \r
-  which accompanies this distribution.  The full text of the license may be found at        \r
-  http://opensource.org/licenses/bsd-license.php                                            \r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+  @par Revision Reference:\r
+  This PPI is defined in UEFI Platform Initialization Specification 1.2 Volume 5:\r
+  Standards\r
 \r
 **/\r
 \r
 #define EFI_S3_SAVE_STATE_PROTOCOL_GUID \\r
     { 0xe857caf6, 0xc046, 0x45dc, { 0xbe, 0x3f, 0xee, 0x7, 0x65, 0xfb, 0xa8, 0x87 }}\r
 \r
-//*******************************************\r
-// EFI Boot Script Opcode definitions\r
-//*******************************************\r
-#define EFI_BOOT_SCRIPT_IO_WRITE_OPCODE                 0x00\r
-#define EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE            0x01\r
-#define EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE                0x02\r
-#define EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE           0x03\r
-#define EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE         0x04\r
-#define EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE    0x05\r
-#define EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE            0x06\r
-#define EFI_BOOT_SCRIPT_STALL_OPCODE                    0x07\r
-#define EFI_BOOT_SCRIPT_DISPATCH_OPCODE                 0x08\r
-#define EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE               0x09\r
-#define EFI_BOOT_SCRIPT_INFORMATION_OPCODE              0x0A\r
-#define EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE        0x0B\r
-#define EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE   0x0C\r
-#define EFI_BOOT_SCRIPT_IO_POLL_OPCODE                  0x0D\r
-#define EFI_BOOT_SCRIPT_MEM_POLL_OPCODE                 0x0E\r
-#define EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE          0x0F\r
-#define EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE         0x10\r
-\r
-//*******************************************\r
-// EFI_BOOT_SCRIPT_WIDTH\r
-//*******************************************\r
-typedef enum {\r
-  EfiBootScriptWidthUint8,\r
-  EfiBootScriptWidthUint16,\r
-  EfiBootScriptWidthUint32,\r
-  EfiBootScriptWidthUint64,\r
-  EfiBootScriptWidthFifoUint8,\r
-  EfiBootScriptWidthFifoUint16,\r
-  EfiBootScriptWidthFifoUint32,\r
-  EfiBootScriptWidthFifoUint64,\r
-  EfiBootScriptWidthFillUint8,\r
-  EfiBootScriptWidthFillUint16,\r
-  EfiBootScriptWidthFillUint32,\r
-  EfiBootScriptWidthFillUint64,\r
-  EfiBootScriptWidthMaximum\r
-} EFI_BOOT_SCRIPT_WIDTH;\r
 \r
 typedef VOID *EFI_S3_BOOT_SCRIPT_POSITION;\r
 \r
@@ -68,32 +27,32 @@ typedef struct _EFI_S3_SAVE_STATE_PROTOCOL  EFI_S3_SAVE_STATE_PROTOCOL;
 \r
 /**\r
   Record operations that need to be replayed during an S3 resume.\r
-  \r
+\r
   This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r
   assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r
   during the S3 resume.\r
-  \r
+\r
   @param[in]    This    A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
   @param[in]    OpCode  The operation code (opcode) number.\r
   @param[in]    ...     Argument list that is specific to each opcode. See the following subsections for the\r
                         definition of each opcode.\r
-                        \r
+\r
   @retval EFI_SUCCESS           The operation succeeded. A record was added into the specified\r
-                                script table.                    \r
+                                script table.\r
   @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
-  @retval EFI_OUT_OF_RESOURCES  There is insufficient memory to store the boot script.                       \r
+  @retval EFI_OUT_OF_RESOURCES  There is insufficient memory to store the boot script.\r
 **/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI *EFI_S3_SAVE_STATE_WRITE)(\r
-   IN CONST struct _EFI_S3_SAVE_STATE_PROTOCOL  *This,\r
-   IN       UINT16                              OpCode,\r
+   IN CONST EFI_S3_SAVE_STATE_PROTOCOL  *This,\r
+   IN       UINTN                       OpCode,\r
    ...\r
 );\r
 \r
 /**\r
   Record operations that need to be replayed during an S3 resume.\r
-  \r
+\r
   This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r
   assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r
   during the S3 resume.\r
@@ -101,14 +60,14 @@ EFI_STATUS
   NULL then that position is after the last opcode in the table (BeforeOrAfter is TRUE) or before\r
   the first opcode in the table (BeforeOrAfter is FALSE). The position which is pointed to by\r
   Position upon return can be used for subsequent insertions.\r
-  \r
+\r
   This function has a variable parameter list. The exact parameter list depends on the OpCode that is\r
   passed into the function. If an unsupported OpCode or illegal parameter list is passed in, this\r
   function returns EFI_INVALID_PARAMETER.\r
   If there are not enough resources available for storing more scripts, this function returns\r
   EFI_OUT_OF_RESOURCES.\r
   OpCode values of 0x80 - 0xFE are reserved for implementation specific functions.\r
-  \r
+\r
   @param[in]        This            A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
   @param[in]        BeforeOrAfter   Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
                                     in the boot script table specified by Position. If Position is NULL or points to\r
@@ -120,33 +79,33 @@ EFI_STATUS
   @param[in]        OpCode          The operation code (opcode) number. See "Related Definitions" in Write() for the\r
                                     defined opcode types.\r
   @param[in]        ...             Argument list that is specific to each opcode. See the following subsections for the\r
-                                    definition of each opcode. \r
-                                    \r
+                                    definition of each opcode.\r
+\r
   @retval EFI_SUCCESS               The operation succeeded. An opcode was added into the script.\r
   @retval EFI_INVALID_PARAMETER     The Opcode is an invalid opcode value.\r
   @retval EFI_INVALID_PARAMETER     The Position is not a valid position in the boot script table.\r
-  @retval EFI_OUT_OF_RESOURCES      There is insufficient memory to store the boot script table.                                                                       \r
+  @retval EFI_OUT_OF_RESOURCES      There is insufficient memory to store the boot script table.\r
 **/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI *EFI_S3_SAVE_STATE_INSERT)(\r
-   IN       struct _EFI_S3_SAVE_STATE_PROTOCOL  *This,\r
-   IN       BOOLEAN                             BeforeOrAfter,\r
-   IN OUT   EFI_S3_BOOT_SCRIPT_POSITION         *Position       OPTIONAL,\r
-   IN       UINT16                              OpCode,\r
+   IN CONST EFI_S3_SAVE_STATE_PROTOCOL  *This,\r
+   IN       BOOLEAN                     BeforeOrAfter,\r
+   IN OUT   EFI_S3_BOOT_SCRIPT_POSITION *Position       OPTIONAL,\r
+   IN       UINTN                       OpCode,\r
    ...\r
 );\r
 \r
 /**\r
   Find a label within the boot script table and, if not present, optionally create it.\r
-  \r
+\r
   If the label Label is already exists in the boot script table, then no new label is created, the\r
   position of the Label is returned in *Position and EFI_SUCCESS is returned.\r
   If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be\r
   created before or after the specified position and EFI_SUCCESS is returned.\r
   If the label Label does not already exist and CreateIfNotFound is FALSE, then\r
   EFI_NOT_FOUND is returned.\r
-  \r
+\r
   @param[in]      This                A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
   @param[in]      BeforeOrAfter       Specifies whether the label is stored before (TRUE) or after (FALSE) the position in\r
                                       the boot script table specified by Position. If Position is NULL or points to\r
@@ -157,45 +116,46 @@ EFI_STATUS
                                       either before or after, depending on BeforeOrAfter. On exit, specifies the position\r
                                       of the inserted label in the boot script table.\r
   @param[in]      Label               Points to the label which will be inserted in the boot script table.\r
-  \r
+\r
   @retval    EFI_SUCCESS              The label already exists or was inserted.\r
   @retval    EFI_NOT_FOUND            The label did not already exist and CreateifNotFound was FALSE.\r
-  @retval    EFI_INVALID_PARAMETER    The Opcode is an invalid opcode value.\r
+  @retval    EFI_INVALID_PARAMETER    The Label is NULL or points to an empty string.\r
   @retval    EFI_INVALID_PARAMETER    The Position is not a valid position in the boot script table.\r
   @retval    EFI_OUT_OF_RESOURCES     There is insufficient memory to store the boot script.\r
 **/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI *EFI_S3_SAVE_STATE_LABEL)(\r
-   IN     struct _EFI_S3_SAVE_STATE_PROTOCOL    *This,\r
-   IN     BOOLEAN                               BeforeOrAfter,\r
-   IN     BOOLEAN                               CreateIfNotFound,\r
-   IN OUT EFI_S3_BOOT_SCRIPT_POSITION           *Position OPTIONAL,\r
-   IN     CONST CHAR8                           *Label\r
+   IN CONST  EFI_S3_SAVE_STATE_PROTOCOL      *This,\r
+   IN        BOOLEAN                         BeforeOrAfter,\r
+   IN        BOOLEAN                         CreateIfNotFound,\r
+   IN OUT    EFI_S3_BOOT_SCRIPT_POSITION     *Position OPTIONAL,\r
+   IN CONST  CHAR8                           *Label\r
 );\r
 \r
 /**\r
   Compare two positions in the boot script table and return their relative position.\r
-  \r
+\r
   This function compares two positions in the boot script table and returns their relative positions. If\r
   Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r
   then 0 is returned. If Position1 is after Position2, then 1 is returned.\r
-  \r
+\r
   @param[in]    This                A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
   @param[in]    Position1           The positions in the boot script table to compare.\r
   @param[in]    Position2           The positions in the boot script table to compare.\r
   @param[out]   RelativePosition    On return, points to the result of the comparison.\r
-  \r
-  @retval   EFI_SUCCESS             The label already exists or was inserted.\r
+\r
+  @retval   EFI_SUCCESS             The operation succeeded.\r
   @retval   EFI_INVALID_PARAMETER   The Position1 or Position2 is not a valid position in the boot script table.\r
+  @retval   EFI_INVALID_PARAMETER   The RelativePosition is NULL.\r
 **/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI *EFI_S3_SAVE_STATE_COMPARE)(\r
-   IN   struct _EFI_S3_SAVE_STATE_PROTOCOL  *This,\r
-   IN   EFI_S3_BOOT_SCRIPT_POSITION         Position1,\r
-   IN   EFI_S3_BOOT_SCRIPT_POSITION         Position2,\r
-   OUT  UINTN                               *RelativePosition\r
+   IN CONST EFI_S3_SAVE_STATE_PROTOCOL          *This,\r
+   IN       EFI_S3_BOOT_SCRIPT_POSITION         Position1,\r
+   IN       EFI_S3_BOOT_SCRIPT_POSITION         Position2,\r
+   OUT      UINTN                               *RelativePosition\r
 );\r
 \r
 struct _EFI_S3_SAVE_STATE_PROTOCOL {\r