]>
Commit | Line | Data |
---|---|---|
bdfde462 | 1 | /** @file\r |
2 | Internal header file for S3 Boot Script Saver state driver.\r | |
3 | \r | |
d1102dba | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
bdfde462 | 5 | \r |
9d510e61 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
bdfde462 | 7 | \r |
8 | **/\r | |
9 | #ifndef _INTERNAL_S3_SAVE_STATE_H_\r | |
10 | #define _INTERNAL_S3_SAVE_STATE_H_\r | |
11 | #include <PiDxe.h>\r | |
12 | \r | |
13 | #include <Protocol/S3SaveState.h>\r | |
14 | \r | |
15 | #include <Library/BaseLib.h>\r | |
16 | #include <Library/DebugLib.h>\r | |
17 | #include <Library/UefiDriverEntryPoint.h>\r | |
18 | #include <Library/UefiBootServicesTableLib.h>\r | |
19 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
20 | #include <Library/S3BootScriptLib.h>\r | |
bdfde462 | 21 | #include <Library/SmbusLib.h>\r |
125e0938 | 22 | #include <Library/PcdLib.h>\r |
bdfde462 | 23 | #include <IndustryStandard/SmBus.h>\r |
bd890a73 SZ |
24 | #include <Guid/EventGroup.h>\r |
25 | \r | |
26 | /**\r | |
27 | Callback function executed when the EndOfDxe event group is signaled.\r | |
28 | \r | |
29 | @param[in] Event Event whose notification function is being invoked.\r | |
30 | @param[in] Context The pointer to the notification function's context, which\r | |
31 | is implementation-dependent.\r | |
32 | **/\r | |
33 | VOID\r | |
34 | EFIAPI\r | |
35 | AcpiS3ContextSaveOnEndOfDxe (\r | |
36 | IN EFI_EVENT Event,\r | |
37 | IN VOID *Context\r | |
38 | );\r | |
39 | \r | |
bdfde462 | 40 | /**\r |
41 | Adds a record into S3 boot script table.\r | |
42 | \r | |
43 | This function is used to store a boot script record into a given boot\r | |
d1102dba LG |
44 | script table. If the table specified by TableName is nonexistent in the\r |
45 | system, a new table will automatically be created and then the script record\r | |
46 | will be added into the new table. This function is responsible for allocating\r | |
bdfde462 | 47 | necessary memory for the script.\r |
48 | \r | |
d1102dba LG |
49 | This function has a variable parameter list. The exact parameter list depends on\r |
50 | the OpCode that is passed into the function. If an unsupported OpCode or illegal\r | |
bdfde462 | 51 | parameter list is passed in, this function returns EFI_INVALID_PARAMETER.\r |
52 | If there are not enough resources available for storing more scripts, this function returns\r | |
53 | EFI_OUT_OF_RESOURCES.\r | |
54 | \r | |
55 | @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
56 | @param OpCode The operation code (opcode) number.\r | |
d1102dba | 57 | @param ... Argument list that is specific to each opcode.\r |
bdfde462 | 58 | \r |
59 | @retval EFI_SUCCESS The operation succeeded. A record was added into the\r | |
60 | specified script table.\r | |
61 | @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r | |
d1102dba | 62 | If the opcode is unknow or not supported because of the PCD\r |
bdfde462 | 63 | Feature Flags.\r |
64 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r | |
65 | \r | |
66 | **/\r | |
67 | EFI_STATUS\r | |
68 | EFIAPI\r | |
69 | BootScriptWrite (\r | |
70 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
5bdcfe33 | 71 | IN UINTN OpCode,\r |
bdfde462 | 72 | ...\r |
73 | );\r | |
74 | /**\r | |
75 | Insert a record into a specified Framework boot script table.\r | |
76 | \r | |
77 | This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r | |
78 | assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r | |
79 | during the S3 resume.\r | |
80 | The opcode is inserted before or after the specified position in the boot script table. If Position is\r | |
81 | NULL then that position is after the last opcode in the table (BeforeOrAfter is FALSE) or before\r | |
82 | the first opcode in the table (BeforeOrAfter is TRUE). The position which is pointed to by\r | |
83 | Position upon return can be used for subsequent insertions.\r | |
84 | \r | |
85 | @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
86 | @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r | |
87 | in the boot script table specified by Position. If Position is NULL or points to\r | |
88 | NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r | |
89 | of the table (if FALSE).\r | |
90 | @param Position On entry, specifies the position in the boot script table where the opcode will be\r | |
91 | inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r | |
92 | the position of the inserted opcode in the boot script table.\r | |
93 | @param OpCode The operation code (opcode) number.\r | |
d1102dba | 94 | @param ... Argument list that is specific to each opcode.\r |
bdfde462 | 95 | \r |
96 | @retval EFI_SUCCESS The operation succeeded. A record was added into the\r | |
97 | specified script table.\r | |
98 | @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 | |
99 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r | |
100 | \r | |
101 | **/\r | |
102 | EFI_STATUS\r | |
103 | EFIAPI\r | |
104 | BootScriptInsert (\r | |
105 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
106 | IN BOOLEAN BeforeOrAfter,\r | |
107 | IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r | |
5bdcfe33 | 108 | IN UINTN OpCode,\r |
bdfde462 | 109 | ...\r |
110 | );\r | |
111 | /**\r | |
112 | Find a label within the boot script table and, if not present, optionally create it.\r | |
113 | \r | |
114 | If the label Label is already exists in the boot script table, then no new label is created, the\r | |
115 | position of the Label is returned in *Position and EFI_SUCCESS is returned.\r | |
116 | If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be\r | |
117 | created before or after the specified position and EFI_SUCCESS is returned.\r | |
118 | If the label Label does not already exist and CreateIfNotFound is FALSE, then\r | |
119 | EFI_NOT_FOUND is returned.\r | |
120 | \r | |
121 | @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
122 | @param BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in\r | |
123 | the boot script table specified by Position. If Position is NULL or points to\r | |
124 | NULL then the new label is inserted at the beginning of the table (if TRUE) or end of\r | |
125 | the table (if FALSE).\r | |
126 | @param CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not\r | |
127 | (FALSE).\r | |
128 | @param Position On entry, specifies the position in the boot script table where the label will be inserted,\r | |
129 | either before or after, depending on BeforeOrAfter. On exit, specifies the position\r | |
130 | of the inserted label in the boot script table.\r | |
131 | @param Label Points to the label which will be inserted in the boot script table.\r | |
132 | \r | |
133 | @retval EFI_SUCCESS The label already exists or was inserted.\r | |
134 | @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 | |
d1102dba | 135 | \r |
bdfde462 | 136 | **/\r |
137 | EFI_STATUS\r | |
138 | EFIAPI\r | |
139 | BootScriptLabel (\r | |
140 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
141 | IN BOOLEAN BeforeOrAfter,\r | |
142 | IN BOOLEAN CreateIfNotFound,\r | |
143 | IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r | |
144 | IN CONST CHAR8 *Label\r | |
145 | );\r | |
146 | /**\r | |
147 | Compare two positions in the boot script table and return their relative position.\r | |
d1102dba | 148 | \r |
bdfde462 | 149 | This function compares two positions in the boot script table and returns their relative positions. If\r |
150 | Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r | |
151 | then 0 is returned. If Position1 is after Position2, then 1 is returned.\r | |
d1102dba | 152 | \r |
bdfde462 | 153 | @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r |
154 | @param Position1 The positions in the boot script table to compare\r | |
155 | @param Position2 The positions in the boot script table to compare\r | |
156 | @param RelativePosition On return, points to the result of the comparison\r | |
157 | \r | |
d1102dba | 158 | @retval EFI_SUCCESS The operation succeeded.\r |
bdfde462 | 159 | @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r |
160 | \r | |
161 | **/\r | |
162 | EFI_STATUS\r | |
d1102dba | 163 | EFIAPI\r |
bdfde462 | 164 | BootScriptCompare (\r |
165 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
166 | IN EFI_S3_BOOT_SCRIPT_POSITION Position1,\r | |
167 | IN EFI_S3_BOOT_SCRIPT_POSITION Position2,\r | |
168 | OUT UINTN *RelativePosition\r | |
169 | );\r | |
d1102dba | 170 | \r |
bdfde462 | 171 | #endif //_INTERNAL_S3_SAVE_STATE_H_\r |