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