-/** @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