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