]> git.proxmox.com Git - mirror_edk2.git/commitdiff
fix the typo error for the name of BootScriptSaveOnS3SaveStateThunk thunk driver
authorjchen20 <jchen20@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Jan 2010 01:15:26 +0000 (01:15 +0000)
committerjchen20 <jchen20@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Jan 2010 01:15:26 +0000 (01:15 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9813 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/BootScriptSaveOnS3SaveStateThunk.inf [new file with mode: 0644]
EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c [new file with mode: 0644]
EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.h [new file with mode: 0644]
EdkCompatibilityPkg/EdkCompatibilityPkg.dsc

diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/BootScriptSaveOnS3SaveStateThunk.inf b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/BootScriptSaveOnS3SaveStateThunk.inf
new file mode 100644 (file)
index 0000000..0ffcdd4
--- /dev/null
@@ -0,0 +1,61 @@
+#/** @file\r
+#  To implement Framework Boot Script Save protocol based on PI S3 Save State protocol\r
+# \r
+#  Intel's Framework Boot Script Save Protocol is replaced by S3 Save State Protocol in PI.\r
+#  This module produces Framework Boot Script Save protocol by consuming PI S3 Save State protocol\r
+#  \r
+#  Copyright (c) 2010, Intel Corporation\r
+#\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
+#  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
+#\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = BootScriptSaveOnS3SaveStateThunk\r
+  FILE_GUID                      = 062ACC82-1D1E-4f61-AA94-8B0C47236A3D\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+\r
+  ENTRY_POINT                    = InitializeScriptSaveOnS3SaveState\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+  ScriptSave.c\r
+  ScriptSave.h\r
+\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
+  TianoModulePkg/TianoModulePkg.dec\r
+\r
+\r
+[LibraryClasses]\r
+  UefiBootServicesTableLib\r
+  UefiDriverEntryPoint\r
+  BaseMemoryLib\r
+  DebugLib\r
+  BaseLib\r
+\r
+[Protocols]\r
+  gEfiBootScriptSaveProtocolGuid          ## PRODUCES\r
+  gEfiS3SaveStateProtocolGuid             ## CONSUMES\r
+\r
+\r
+[Depex]\r
+  gEfiS3SaveStateProtocolGuid\r
+\r
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c
new file mode 100644 (file)
index 0000000..dbd3c3d
--- /dev/null
@@ -0,0 +1,727 @@
+/** @file\r
+  Implementation for S3 Boot Script Save thunk driver.\r
+  This thunk driver consumes PI S3SaveState protocol to produce framework S3BootScriptSave Protocol \r
+  \r
+  Copyright (c) 2010 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
+\r
+**/\r
+#include "ScriptSave.h"\r
+\r
+EFI_HANDLE                    mHandle;\r
+EFI_BOOT_SCRIPT_SAVE_PROTOCOL mS3ScriptSave = {\r
+                                  BootScriptWrite,\r
+                                  BootScriptCloseTable\r
+                                 };\r
+EFI_S3_SAVE_STATE_PROTOCOL    *mS3SaveState;\r
+/**\r
+  Internal function to add IO write opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptIoWrite (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT64                Address;\r
+  UINTN                 Count;\r
+  UINT8                 *Buffer;\r
+\r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  Count       = VA_ARG (Marker, UINTN);\r
+  Buffer      = VA_ARG (Marker, UINT8 *);\r
+  \r
+  return mS3SaveState->Write (\r
+                        mS3SaveState,\r
+                        EFI_BOOT_SCRIPT_IO_WRITE_OPCODE,\r
+                        Width, \r
+                        Address, \r
+                        Count, \r
+                        Buffer\r
+                        );\r
+}\r
+/**\r
+  Internal function to add IO read/write opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptIoReadWrite (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT64                Address;\r
+  UINT8                 *Data;\r
+  UINT8                 *DataMask;\r
\r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  Data        = VA_ARG (Marker, UINT8 *);\r
+  DataMask    = VA_ARG (Marker, UINT8 *);\r
+  \r
+   return mS3SaveState->Write (\r
+                         mS3SaveState,\r
+                         EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE,\r
+                         Width, \r
+                         Address, \r
+                         Data, \r
+                         DataMask\r
+                         );\r
+}\r
+\r
+/**\r
+  Internal function to add memory write opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptMemWrite (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT64                Address;\r
+  UINTN                 Count;\r
+  UINT8                 *Buffer;\r
\r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  Count       = VA_ARG (Marker, UINTN);\r
+  Buffer      = VA_ARG (Marker, UINT8 *);\r
+\r
+  return mS3SaveState->Write (\r
+                        mS3SaveState,\r
+                        EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE,\r
+                        Width, \r
+                        Address, \r
+                        Count, \r
+                        Buffer\r
+                        );\r
+}\r
+\r
+/**\r
+  Internal function to add memory read/write opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptMemReadWrite (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT64                Address;\r
+  UINT8                 *Data;\r
+  UINT8                 *DataMask;\r
+  \r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  Data        = VA_ARG (Marker, UINT8 *);\r
+  DataMask    = VA_ARG (Marker, UINT8 *);\r
+\r
+ return mS3SaveState->Write (\r
+                        mS3SaveState,\r
+                        EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE,\r
+                        Width, \r
+                        Address, \r
+                        Data, \r
+                        DataMask\r
+                        );\r
+}\r
+\r
+/**\r
+  Internal function to add PciCfg write opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptPciCfgWrite (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT64                Address;\r
+  UINTN                 Count;\r
+  UINT8                 *Buffer;\r
+\r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  Count       = VA_ARG (Marker, UINTN);\r
+  Buffer      = VA_ARG (Marker, UINT8 *);\r
+\r
+  return mS3SaveState->Write (\r
+                        mS3SaveState,\r
+                        EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE,\r
+                        Width, \r
+                        Address, \r
+                        Count, \r
+                        Buffer\r
+                        );\r
+}\r
+\r
+/**\r
+  Internal function to PciCfg read/write opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptPciCfgReadWrite (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT64                Address;\r
+  UINT8                 *Data;\r
+  UINT8                 *DataMask;\r
+\r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  Data        = VA_ARG (Marker, UINT8 *);\r
+  DataMask    = VA_ARG (Marker, UINT8 *);\r
+\r
+  return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE,\r
+                          Width,\r
+                          Address,\r
+                          Data,\r
+                          DataMask\r
+                         );\r
+}\r
+/**\r
+  Internal function to add PciCfg2 write opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptPciCfg2Write (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT64                Address;\r
+  UINTN                 Count;\r
+  UINT8                 *Buffer;\r
+  UINT16                Segment;\r
+\r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  Count       = VA_ARG (Marker, UINTN);\r
+  Buffer      = VA_ARG (Marker, UINT8 *);\r
+  Segment     = VA_ARG (Marker, UINT16);\r
+\r
+  return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE,\r
+                          Width, \r
+                          Segment, \r
+                          Address, \r
+                          Count, \r
+                          Buffer\r
+                         );\r
+}\r
+\r
+/**\r
+  Internal function to PciCfg2 read/write opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptPciCfg2ReadWrite (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT16                Segment;\r
+  UINT64                Address;\r
+  UINT8                 *Data;\r
+  UINT8                 *DataMask;\r
\r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  Segment     = VA_ARG (Marker, UINT16);\r
+  Data        = VA_ARG (Marker, UINT8 *);\r
+  DataMask    = VA_ARG (Marker, UINT8 *);\r
\r
+  return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE,\r
+                          Width, \r
+                          Segment,\r
+                          Address,\r
+                          Data,\r
+                          DataMask\r
+                          );\r
+}\r
+/**\r
+  Internal function to add smbus excute opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptSmbusExecute (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_SMBUS_DEVICE_ADDRESS  SlaveAddress;\r
+  EFI_SMBUS_DEVICE_COMMAND  Command;\r
+  EFI_SMBUS_OPERATION       Operation;\r
+  BOOLEAN                   PecCheck;\r
+  VOID                     *Buffer;\r
+  UINTN                    *DataSize;\r
+  \r
+  SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN);\r
+  Command                         = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND);\r
+  Operation                       = VA_ARG (Marker, EFI_SMBUS_OPERATION);\r
+  PecCheck                        = VA_ARG (Marker, BOOLEAN);\r
+  DataSize                        = VA_ARG (Marker, UINTN *);    \r
+  Buffer                          = VA_ARG (Marker, VOID *);\r
\r
+  return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE,\r
+                          SlaveAddress,\r
+                          Command, \r
+                          Operation, \r
+                          PecCheck,\r
+                          DataSize, \r
+                          Buffer\r
+                         );\r
+}\r
+/**\r
+  Internal function to add stall opcode to the table.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptStall (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  UINT32                Duration;\r
+\r
+  Duration    = VA_ARG (Marker, UINT32);\r
+\r
+  return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_STALL_OPCODE,\r
+                          Duration\r
+                         );\r
+}\r
+\r
+/**\r
+  Internal function to add Save jmp address according to DISPATCH_OPCODE. \r
+  We ignore "Context" parameter\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptDispatch (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  VOID        *EntryPoint;\r
+\r
+  EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
+  return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_DISPATCH_OPCODE,\r
+                          EntryPoint\r
+                         );\r
+}\r
+\r
+/**\r
+  Internal function to add memory pool operation to the table. \r
\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptMemPoll (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  EFI_BOOT_SCRIPT_WIDTH Width;\r
+  UINT64                Address;\r
+  UINT8                 *BitMask;\r
+  UINT8                 *BitValue;\r
+  UINT64                Duration;\r
+  UINT64                LoopTimes;\r
+  UINT64                Delay;\r
+\r
+  Width       = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);\r
+  Address     = VA_ARG (Marker, UINT64);\r
+  BitMask     = VA_ARG (Marker, UINT8 *);\r
+  BitValue    = VA_ARG (Marker, UINT8 *);\r
+  Duration    = (UINT64)VA_ARG (Marker, UINT64);\r
+  LoopTimes   = (UINT64)VA_ARG (Marker, UINT64);\r
+  Delay       = MultU64x64 (DivU64x32(Duration, 100), LoopTimes);\r
+  \r
+  return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_MEM_POLL_OPCODE,\r
+                          Width, \r
+                          Address, \r
+                          BitMask, \r
+                          BitValue, \r
+                          Delay\r
+                          );\r
+}\r
+\r
+/**\r
+  Internal function to add Save jmp address according to DISPATCH_OPCODE2. \r
+  The "Context" parameter is not ignored.\r
+\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough resource to do operation.\r
+  @retval EFI_SUCCESS           Opcode is added.\r
+\r
+**/\r
+EFI_STATUS\r
+BootScriptDispatch2 (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  VOID                  *EntryPoint;\r
+  VOID                  *Context;  \r
+\r
+  EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
+  Context    = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
+\r
+ return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE,\r
+                          EntryPoint, \r
+                          Context\r
+                         );\r
+}\r
+/**\r
+  Internal function to add the opcode link node to the link\r
+  list.\r
+  @param  Marker                The variable argument list to get the opcode\r
+                                and associated attributes.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enought resource to complete the operations.\r
+  @retval EFI_SUCCESS           The opcode entry is added to the link list\r
+                                successfully.\r
+**/\r
+EFI_STATUS\r
+BootScriptInformation (\r
+  IN VA_LIST                       Marker\r
+  )\r
+{\r
+  UINT32                InformationLength;\r
+  EFI_PHYSICAL_ADDRESS  Information;  \r
+\r
+  InformationLength = VA_ARG (Marker, UINT32);\r
+  Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
+  \r
+  return mS3SaveState->Write (\r
+                          mS3SaveState,\r
+                          EFI_BOOT_SCRIPT_INFORMATION_OPCODE,\r
+                          InformationLength, \r
+                          (VOID*)(UINTN)Information\r
+                         );\r
+}\r
+\r
+/**\r
+  Adds a record into a specified Framework boot script table.\r
+\r
+  This function is used to store a boot script record into a given boot\r
+  script table. If the table specified by TableName is nonexistent in the \r
+  system, a new table will automatically be created and then the script record \r
+  will be added into the new table. A boot script table can add new script records\r
+  until EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is called. Currently, the only \r
+  meaningful table name is EFI_ACPI_S3_RESUME_SCRIPT_TABLE. This function is\r
+  responsible for allocating necessary memory for the script.\r
+\r
+  This function has a variable parameter list. The exact parameter list depends on \r
+  the OpCode that is passed into the function. If an unsupported OpCode or illegal \r
+  parameter list is passed in, this 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
+\r
+  @param  This                  A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.\r
+  @param  TableName             Name of the script table. Currently, the only meaningful value is\r
+                                EFI_ACPI_S3_RESUME_SCRIPT_TABLE.\r
+  @param  OpCode                The operation code (opcode) number.\r
+\r
+  @retval EFI_SUCCESS           The operation succeeded. A record was added into the\r
+                                specified script table.\r
+  @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
+                                If the opcode is unknow or not supported because of the PCD \r
+                                Feature Flags.\r
+  @retval EFI_OUT_OF_RESOURCES  There is insufficient memory to store the boot script.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptWrite (\r
+  IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL    *This,\r
+  IN UINT16                           TableName,\r
+  IN UINT16                           OpCode,\r
+  ...\r
+  )\r
+{\r
+  EFI_STATUS                Status;\r
+  VA_LIST                   Marker;\r
+  \r
+  if (TableName != FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE) {\r
+       //\r
+       // Only S3 boot script is supported for now\r
+       //\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+  //\r
+  // Build script according to opcode\r
+  //\r
+  switch (OpCode) {\r
+\r
+  case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptIoWrite (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptIoReadWrite (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptMemWrite (Marker);\r
+    VA_END (Marker); \r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptMemReadWrite (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptPciCfgWrite (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptPciCfgReadWrite (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptSmbusExecute (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_STALL_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptStall (Marker);\r
+    VA_END (Marker);\r
+  \r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptDispatch (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case FRAMEWORK_EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptDispatch2 (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptInformation (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case FRAMEWORK_EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptMemPoll (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptPciCfg2Write (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:\r
+    VA_START (Marker, OpCode);\r
+    Status = BootScriptPciCfg2ReadWrite (Marker);\r
+    VA_END (Marker);\r
+    break;\r
+\r
+  default:\r
+    Status = EFI_INVALID_PARAMETER;\r
+    break;\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Closes the specified script table.\r
+\r
+  This function closes the specified boot script table and returns the base address \r
+  of the table. It allocates a new pool to duplicate all the boot scripts in the specified \r
+  table. Once this function is called, the specified table will be destroyed after it is \r
+  copied into the allocated pool. As a result, any attempts to add a script record into a \r
+  closed table will cause a new table to be created. The base address of the allocated pool \r
+  will be returned in Address. After using the boot script table, the caller is responsible \r
+  for freeing the pool that is allocated by this function. If the boot script table,\r
+  such as EFI_ACPI_S3_RESUME_SCRIPT_TABLE, is required to be stored in a nonperturbed\r
+  memory region, the caller should copy the table into the nonperturbed memory region by itself.\r
+\r
+  @param  This                  A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.\r
+  @param  TableName             Name of the script table. Currently, the only meaningful value is\r
+                                 EFI_ACPI_S3_RESUME_SCRIPT_TABLE.\r
+  @param  Address               A pointer to the physical address where the table begins. \r
+                               \r
+  @retval EFI_SUCCESS           The table was successfully returned.\r
+  @retval EFI_NOT_FOUND         The specified table was not created previously.\r
+  @retval EFI_OUT_OF_RESOURCE   Memory is insufficient to hold the reorganized boot script table.\r
+  @retval EFI_UNSUPPORTED       the table type is not EFI_ACPI_S3_RESUME_SCRIPT_TABLE\r
+  \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptCloseTable (\r
+  IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL    *This,\r
+  IN UINT16                           TableName,\r
+  OUT EFI_PHYSICAL_ADDRESS            *Address\r
+  )\r
+{ \r
+  if (TableName != FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE) {\r
+    //\r
+    // Only S3 boot script is supported for now\r
+    //\r
+    return EFI_NOT_FOUND;\r
+  }\r
+  //\r
+  // Here the close table is not implemented. \r
+  //  \r
\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  This routine is entry point of ScriptSave driver.\r
+\r
+  @param  Imagehandle           Handle for this drivers loaded image protocol.\r
+  @param  SystemTable           EFI system table.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  No enough resource\r
+  @retval EFI_SUCCESS           Succesfully installed the ScriptSave driver.\r
+  @retval other                 Errors occured.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeScriptSaveOnS3SaveState (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
+{\r
+   EFI_STATUS                Status;\r
+  //\r
+  // Locate and cache PI S3 Save State Protocol.\r
+  //\r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiS3SaveStateProtocolGuid, \r
+                  NULL, \r
+                  (VOID **) &mS3SaveState\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return  gBS->InstallProtocolInterface (\r
+                  &mHandle,\r
+                  &gEfiBootScriptSaveProtocolGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  &mS3ScriptSave\r
+                  );\r
+\r
+}\r
+\r
+\r
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.h b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.h
new file mode 100644 (file)
index 0000000..daf84c1
--- /dev/null
@@ -0,0 +1,98 @@
+/** @file\r
+  Header file for S3 Boot Script Saver thunk driver.\r
+\r
+  Copyright (c) 2010 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
+\r
+**/\r
+#ifndef __BOOT_SCRIPT_SAVE_ON_S3_SAVE_STATE_H__\r
+#define __BOOT_SCRIPT_SAVE_ON_S3_SAVE_STATE_H__\r
+#include <FrameworkDxe.h>\r
+\r
+#include <Protocol/BootScriptSave.h>\r
+#include <Protocol/S3SaveState.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/SmbusLib.h>\r
+#include <IndustryStandard/SmBus.h>\r
+\r
+/**\r
+  Adds a record into a specified Framework boot script table.\r
+\r
+  This function is used to store a boot script record into a given boot\r
+  script table. If the table specified by TableName is nonexistent in the \r
+  system, a new table will automatically be created and then the script record \r
+  will be added into the new table. A boot script table can add new script records\r
+  until EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is called. Currently, the only \r
+  meaningful table name is EFI_ACPI_S3_RESUME_SCRIPT_TABLE. This function is\r
+  responsible for allocating necessary memory for the script.\r
+\r
+  This function has a variable parameter list. The exact parameter list depends on \r
+  the OpCode that is passed into the function. If an unsupported OpCode or illegal \r
+  parameter list is passed in, this 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
+\r
+  @param  This                  A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.\r
+  @param  TableName             Name of the script table. Currently, the only meaningful value is\r
+                                EFI_ACPI_S3_RESUME_SCRIPT_TABLE.\r
+  @param  OpCode                The operation code (opcode) number.\r
+\r
+  @retval EFI_SUCCESS           The operation succeeded. A record was added into the\r
+                                specified script table.\r
+  @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
+                                If the opcode is unknow or not supported because of the PCD \r
+                                Feature Flags.\r
+  @retval EFI_OUT_OF_RESOURCES  There is insufficient memory to store the boot script.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptWrite (\r
+  IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL    *This,\r
+  IN UINT16                           TableName,\r
+  IN UINT16                           OpCode,\r
+  ...\r
+  );\r
+\r
+/**\r
+  Closes the specified script table.\r
+\r
+  This function closes the specified boot script table and returns the base address \r
+  of the table. It allocates a new pool to duplicate all the boot scripts in the specified \r
+  table. Once this function is called, the specified table will be destroyed after it is \r
+  copied into the allocated pool. As a result, any attempts to add a script record into a \r
+  closed table will cause a new table to be created. The base address of the allocated pool \r
+  will be returned in Address. After using the boot script table, the caller is responsible \r
+  for freeing the pool that is allocated by this function. If the boot script table,\r
+  such as EFI_ACPI_S3_RESUME_SCRIPT_TABLE, is required to be stored in a nonperturbed\r
+  memory region, the caller should copy the table into the nonperturbed memory region by itself.\r
+\r
+  @param  This                  A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.\r
+  @param  TableName             Name of the script table. Currently, the only meaningful value is\r
+                                 EFI_ACPI_S3_RESUME_SCRIPT_TABLE.\r
+  @param  Address               A pointer to the physical address where the table begins. \r
+                               \r
+  @retval EFI_SUCCESS           The table was successfully returned.\r
+  @retval EFI_NOT_FOUND         The specified table was not created previously.\r
+  @retval EFI_OUT_OF_RESOURCE   Memory is insufficient to hold the reorganized boot script table.\r
+  @retval EFI_UNSUPPORTED       the table type is not EFI_ACPI_S3_RESUME_SCRIPT_TABLE\r
+  \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptCloseTable (\r
+  IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL    *This,\r
+  IN UINT16                           TableName,\r
+  OUT EFI_PHYSICAL_ADDRESS            *Address\r
+  );\r
+\r
+#endif\r
index 639063e0bb93f27c4b5259e2caa2ebc09d52c8d4..40e38fc0f0cf437be5447430620883de1b5b0147 100644 (file)
@@ -252,7 +252,7 @@ define GCC_MACRO                 = -DEFI_SPECIFICATION_VERSION=0x00020000 -DPI_S
   EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.inf\r
   EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/PiSmbiosRecordOnDataHubSmbiosRecordThunk.inf\r
   EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.inf\r
-  EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateTunk/BootScriptSaveOnS3SaveStateTunk.inf\r
+  EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/BootScriptSaveOnS3SaveStateThunk.inf\r
 \r
   #\r
   # User needs to turn on the compatibility switches for VFRC and EDK II build tool for Framework HII modules \r