2 Internal header file for S3 Boot Script Saver state driver.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _INTERNAL_S3_SAVE_STATE_H_
10 #define _INTERNAL_S3_SAVE_STATE_H_
13 #include <Protocol/S3SaveState.h>
15 #include <Library/BaseLib.h>
16 #include <Library/DebugLib.h>
17 #include <Library/UefiDriverEntryPoint.h>
18 #include <Library/UefiBootServicesTableLib.h>
19 #include <Library/UefiRuntimeServicesTableLib.h>
20 #include <Library/S3BootScriptLib.h>
21 #include <Library/SmbusLib.h>
22 #include <Library/PcdLib.h>
23 #include <IndustryStandard/SmBus.h>
24 #include <Guid/EventGroup.h>
27 Callback function executed when the EndOfDxe event group is signaled.
29 @param[in] Event Event whose notification function is being invoked.
30 @param[in] Context The pointer to the notification function's context, which
31 is implementation-dependent.
35 AcpiS3ContextSaveOnEndOfDxe (
41 Adds a record into S3 boot script table.
43 This function is used to store a boot script record into a given boot
44 script table. If the table specified by TableName is nonexistent in the
45 system, a new table will automatically be created and then the script record
46 will be added into the new table. This function is responsible for allocating
47 necessary memory for the script.
49 This function has a variable parameter list. The exact parameter list depends on
50 the OpCode that is passed into the function. If an unsupported OpCode or illegal
51 parameter list is passed in, this function returns EFI_INVALID_PARAMETER.
52 If there are not enough resources available for storing more scripts, this function returns
55 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
56 @param OpCode The operation code (opcode) number.
57 @param ... Argument list that is specific to each opcode.
59 @retval EFI_SUCCESS The operation succeeded. A record was added into the
60 specified script table.
61 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
62 If the opcode is unknow or not supported because of the PCD
64 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
70 IN CONST EFI_S3_SAVE_STATE_PROTOCOL
*This
,
75 Insert a record into a specified Framework boot script table.
77 This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is
78 assumed this protocol has platform specific mechanism to store the OpCode set and replay them
80 The opcode is inserted before or after the specified position in the boot script table. If Position is
81 NULL then that position is after the last opcode in the table (BeforeOrAfter is FALSE) or before
82 the first opcode in the table (BeforeOrAfter is TRUE). The position which is pointed to by
83 Position upon return can be used for subsequent insertions.
85 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
86 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position
87 in the boot script table specified by Position. If Position is NULL or points to
88 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end
89 of the table (if FALSE).
90 @param Position On entry, specifies the position in the boot script table where the opcode will be
91 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies
92 the position of the inserted opcode in the boot script table.
93 @param OpCode The operation code (opcode) number.
94 @param ... Argument list that is specific to each opcode.
96 @retval EFI_SUCCESS The operation succeeded. A record was added into the
97 specified script table.
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..
99 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
105 IN CONST EFI_S3_SAVE_STATE_PROTOCOL
*This
,
106 IN BOOLEAN BeforeOrAfter
,
107 IN OUT EFI_S3_BOOT_SCRIPT_POSITION
*Position OPTIONAL
,
112 Find a label within the boot script table and, if not present, optionally create it.
114 If the label Label is already exists in the boot script table, then no new label is created, the
115 position of the Label is returned in *Position and EFI_SUCCESS is returned.
116 If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be
117 created before or after the specified position and EFI_SUCCESS is returned.
118 If the label Label does not already exist and CreateIfNotFound is FALSE, then
119 EFI_NOT_FOUND is returned.
121 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
122 @param BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in
123 the boot script table specified by Position. If Position is NULL or points to
124 NULL then the new label is inserted at the beginning of the table (if TRUE) or end of
125 the table (if FALSE).
126 @param CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not
128 @param Position On entry, specifies the position in the boot script table where the label will be inserted,
129 either before or after, depending on BeforeOrAfter. On exit, specifies the position
130 of the inserted label in the boot script table.
131 @param Label Points to the label which will be inserted in the boot script table.
133 @retval EFI_SUCCESS The label already exists or was inserted.
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..
140 IN CONST EFI_S3_SAVE_STATE_PROTOCOL
*This
,
141 IN BOOLEAN BeforeOrAfter
,
142 IN BOOLEAN CreateIfNotFound
,
143 IN OUT EFI_S3_BOOT_SCRIPT_POSITION
*Position OPTIONAL
,
144 IN CONST CHAR8
*Label
147 Compare two positions in the boot script table and return their relative position.
149 This function compares two positions in the boot script table and returns their relative positions. If
150 Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,
151 then 0 is returned. If Position1 is after Position2, then 1 is returned.
153 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
154 @param Position1 The positions in the boot script table to compare
155 @param Position2 The positions in the boot script table to compare
156 @param RelativePosition On return, points to the result of the comparison
158 @retval EFI_SUCCESS The operation succeeded.
159 @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.
165 IN CONST EFI_S3_SAVE_STATE_PROTOCOL
*This
,
166 IN EFI_S3_BOOT_SCRIPT_POSITION Position1
,
167 IN EFI_S3_BOOT_SCRIPT_POSITION Position2
,
168 OUT UINTN
*RelativePosition
171 #endif //_INTERNAL_S3_SAVE_STATE_H_