]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h
MdeModulePkg: eliminate all implicit library dependencies for all modules in MdeModul...
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / S3SaveStateDxe / InternalS3SaveState.h
CommitLineData
bdfde462 1/** @file\r
2 Internal header file for S3 Boot Script Saver state driver.\r
3\r
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions\r
8 of the BSD License which accompanies this distribution. The\r
9 full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16#ifndef _INTERNAL_S3_SAVE_STATE_H_\r
17#define _INTERNAL_S3_SAVE_STATE_H_\r
18#include <PiDxe.h>\r
19\r
20#include <Protocol/S3SaveState.h>\r
21\r
22#include <Library/BaseLib.h>\r
23#include <Library/DebugLib.h>\r
24#include <Library/UefiDriverEntryPoint.h>\r
25#include <Library/UefiBootServicesTableLib.h>\r
26#include <Library/UefiRuntimeServicesTableLib.h>\r
27#include <Library/S3BootScriptLib.h>\r
bdfde462 28#include <Library/SmbusLib.h>\r
29#include <IndustryStandard/SmBus.h>\r
30/**\r
31 Adds a record into S3 boot script table.\r
32\r
33 This function is used to store a boot script record into a given boot\r
34 script table. If the table specified by TableName is nonexistent in the \r
35 system, a new table will automatically be created and then the script record \r
36 will be added into the new table. This function is responsible for allocating \r
37 necessary memory for the script.\r
38\r
39 This function has a variable parameter list. The exact parameter list depends on \r
40 the OpCode that is passed into the function. If an unsupported OpCode or illegal \r
41 parameter list is passed in, this function returns EFI_INVALID_PARAMETER.\r
42 If there are not enough resources available for storing more scripts, this function returns\r
43 EFI_OUT_OF_RESOURCES.\r
44\r
45 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
46 @param OpCode The operation code (opcode) number.\r
47 @param ... Argument list that is specific to each opcode. \r
48\r
49 @retval EFI_SUCCESS The operation succeeded. A record was added into the\r
50 specified script table.\r
51 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
52 If the opcode is unknow or not supported because of the PCD \r
53 Feature Flags.\r
54 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
55\r
56**/\r
57EFI_STATUS\r
58EFIAPI\r
59BootScriptWrite (\r
60 IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
61 IN UINT16 OpCode,\r
62 ...\r
63 );\r
64/**\r
65 Insert a record into a specified Framework boot script table.\r
66\r
67 This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r
68 assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r
69 during the S3 resume.\r
70 The opcode is inserted before or after the specified position in the boot script table. If Position is\r
71 NULL then that position is after the last opcode in the table (BeforeOrAfter is FALSE) or before\r
72 the first opcode in the table (BeforeOrAfter is TRUE). The position which is pointed to by\r
73 Position upon return can be used for subsequent insertions.\r
74\r
75 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
76 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
77 in the boot script table specified by Position. If Position is NULL or points to\r
78 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r
79 of the table (if FALSE).\r
80 @param Position On entry, specifies the position in the boot script table where the opcode will be\r
81 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r
82 the position of the inserted opcode in the boot script table.\r
83 @param OpCode The operation code (opcode) number.\r
84 @param ... Argument list that is specific to each opcode. \r
85\r
86 @retval EFI_SUCCESS The operation succeeded. A record was added into the\r
87 specified script table.\r
88 @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value or the Position is not a valid position in the boot script table..\r
89 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
90\r
91**/\r
92EFI_STATUS\r
93EFIAPI\r
94BootScriptInsert (\r
95 IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
96 IN BOOLEAN BeforeOrAfter,\r
97 IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r
98 IN UINT16 OpCode,\r
99 ...\r
100 );\r
101/**\r
102 Find a label within the boot script table and, if not present, optionally create it.\r
103\r
104 If the label Label is already exists in the boot script table, then no new label is created, the\r
105 position of the Label is returned in *Position and EFI_SUCCESS is returned.\r
106 If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be\r
107 created before or after the specified position and EFI_SUCCESS is returned.\r
108 If the label Label does not already exist and CreateIfNotFound is FALSE, then\r
109 EFI_NOT_FOUND is returned.\r
110\r
111 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
112 @param BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in\r
113 the boot script table specified by Position. If Position is NULL or points to\r
114 NULL then the new label is inserted at the beginning of the table (if TRUE) or end of\r
115 the table (if FALSE).\r
116 @param CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not\r
117 (FALSE).\r
118 @param Position On entry, specifies the position in the boot script table where the label will be inserted,\r
119 either before or after, depending on BeforeOrAfter. On exit, specifies the position\r
120 of the inserted label in the boot script table.\r
121 @param Label Points to the label which will be inserted in the boot script table.\r
122\r
123 @retval EFI_SUCCESS The label already exists or was inserted.\r
124 @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value or the Position is not a valid position in the boot script table..\r
125 \r
126**/\r
127EFI_STATUS\r
128EFIAPI\r
129BootScriptLabel (\r
130 IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
131 IN BOOLEAN BeforeOrAfter,\r
132 IN BOOLEAN CreateIfNotFound,\r
133 IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r
134 IN CONST CHAR8 *Label\r
135 );\r
136/**\r
137 Compare two positions in the boot script table and return their relative position.\r
138 \r
139 This function compares two positions in the boot script table and returns their relative positions. If\r
140 Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r
141 then 0 is returned. If Position1 is after Position2, then 1 is returned.\r
142 \r
143 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
144 @param Position1 The positions in the boot script table to compare\r
145 @param Position2 The positions in the boot script table to compare\r
146 @param RelativePosition On return, points to the result of the comparison\r
147\r
148 @retval EFI_SUCCESS The operation succeeded. \r
149 @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r
150\r
151**/\r
152EFI_STATUS\r
153EFIAPI \r
154BootScriptCompare (\r
155 IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
156 IN EFI_S3_BOOT_SCRIPT_POSITION Position1,\r
157 IN EFI_S3_BOOT_SCRIPT_POSITION Position2,\r
158 OUT UINTN *RelativePosition\r
159 );\r
160 \r
161#endif //_INTERNAL_S3_SAVE_STATE_H_\r