]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Acpi/SmmS3SaveState/InternalSmmSaveState.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / SmmS3SaveState / InternalSmmSaveState.h
CommitLineData
bdfde462 1/** @file\r
2 Internal header file for SMM 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_SMM_S3_SAVE_STATE_H_\r
10#define _INTERNAL_SMM_S3_SAVE_STATE_H_\r
11#include <PiDxe.h>\r
12\r
13#include <Protocol/S3SmmSaveState.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/SmmServicesTableLib.h>\r
19#include <Library/S3BootScriptLib.h>\r
20#include <Library/PcdLib.h>\r
21#include <Library/SmbusLib.h>\r
22#include <IndustryStandard/SmBus.h>\r
23/**\r
24 Adds a record into S3 boot script table.\r
25\r
26 This function is used to store a boot script record into a given boot\r
d1102dba
LG
27 script table. If the table specified by TableName is nonexistent in the\r
28 system, a new table will automatically be created and then the script record\r
29 will be added into the new table. This function is responsible for allocating\r
bdfde462 30 necessary memory for the script.\r
31\r
d1102dba
LG
32 This function has a variable parameter list. The exact parameter list depends on\r
33 the OpCode that is passed into the function. If an unsupported OpCode or illegal\r
bdfde462 34 parameter list is passed in, this function returns EFI_INVALID_PARAMETER.\r
35 If there are not enough resources available for storing more scripts, this function returns\r
36 EFI_OUT_OF_RESOURCES.\r
37\r
38 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
39 @param OpCode The operation code (opcode) number.\r
d1102dba 40 @param ... Argument list that is specific to each opcode.\r
bdfde462 41\r
42 @retval EFI_SUCCESS The operation succeeded. A record was added into the\r
43 specified script table.\r
44 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
d1102dba 45 If the opcode is unknow or not supported because of the PCD\r
bdfde462 46 Feature Flags.\r
47 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
48\r
49**/\r
50EFI_STATUS\r
51EFIAPI\r
52BootScriptWrite (\r
53 IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
69544d22 54 IN UINTN OpCode,\r
bdfde462 55 ...\r
56 );\r
57/**\r
58 Insert a record into a specified Framework boot script table.\r
59\r
60 This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r
61 assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r
62 during the S3 resume.\r
63 The opcode is inserted before or after the specified position in the boot script table. If Position is\r
64 NULL then that position is after the last opcode in the table (BeforeOrAfter is FALSE) or before\r
65 the first opcode in the table (BeforeOrAfter is TRUE). The position which is pointed to by\r
66 Position upon return can be used for subsequent insertions.\r
67\r
68 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
69 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
70 in the boot script table specified by Position. If Position is NULL or points to\r
71 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r
72 of the table (if FALSE).\r
73 @param Position On entry, specifies the position in the boot script table where the opcode will be\r
74 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r
75 the position of the inserted opcode in the boot script table.\r
76 @param OpCode The operation code (opcode) number.\r
d1102dba 77 @param ... Argument list that is specific to each opcode.\r
bdfde462 78\r
79 @retval EFI_SUCCESS The operation succeeded. A record was added into the\r
80 specified script table.\r
81 @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
82 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
83\r
84**/\r
85EFI_STATUS\r
86EFIAPI\r
87BootScriptInsert (\r
88 IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
89 IN BOOLEAN BeforeOrAfter,\r
90 IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r
69544d22 91 IN UINTN OpCode,\r
bdfde462 92 ...\r
93 );\r
94/**\r
95 Find a label within the boot script table and, if not present, optionally create it.\r
96\r
97 If the label Label is already exists in the boot script table, then no new label is created, the\r
98 position of the Label is returned in *Position and EFI_SUCCESS is returned.\r
99 If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be\r
100 created before or after the specified position and EFI_SUCCESS is returned.\r
101 If the label Label does not already exist and CreateIfNotFound is FALSE, then\r
102 EFI_NOT_FOUND is returned.\r
103\r
104 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
105 @param BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in\r
106 the boot script table specified by Position. If Position is NULL or points to\r
107 NULL then the new label is inserted at the beginning of the table (if TRUE) or end of\r
108 the table (if FALSE).\r
109 @param CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not\r
110 (FALSE).\r
111 @param Position On entry, specifies the position in the boot script table where the label will be inserted,\r
112 either before or after, depending on BeforeOrAfter. On exit, specifies the position\r
113 of the inserted label in the boot script table.\r
114 @param Label Points to the label which will be inserted in the boot script table.\r
115\r
116 @retval EFI_SUCCESS The label already exists or was inserted.\r
117 @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 118\r
bdfde462 119**/\r
120EFI_STATUS\r
121EFIAPI\r
122BootScriptLabel (\r
123 IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
124 IN BOOLEAN BeforeOrAfter,\r
125 IN BOOLEAN CreateIfNotFound,\r
126 IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r
127 IN CONST CHAR8 *Label\r
128 );\r
129/**\r
130 Compare two positions in the boot script table and return their relative position.\r
d1102dba 131\r
bdfde462 132 This function compares two positions in the boot script table and returns their relative positions. If\r
133 Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r
134 then 0 is returned. If Position1 is after Position2, then 1 is returned.\r
d1102dba 135\r
bdfde462 136 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
137 @param Position1 The positions in the boot script table to compare\r
138 @param Position2 The positions in the boot script table to compare\r
139 @param RelativePosition On return, points to the result of the comparison\r
140\r
d1102dba 141 @retval EFI_SUCCESS The operation succeeded.\r
bdfde462 142 @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r
143\r
144**/\r
145EFI_STATUS\r
d1102dba 146EFIAPI\r
bdfde462 147BootScriptCompare (\r
148 IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
149 IN EFI_S3_BOOT_SCRIPT_POSITION Position1,\r
150 IN EFI_S3_BOOT_SCRIPT_POSITION Position2,\r
151 OUT UINTN *RelativePosition\r
152 );\r
d1102dba 153\r
bdfde462 154#endif //_INTERNAL_SMM_S3_SAVE_STATE_H_\r