1 | /** @file
|
---|
2 | The file defined some common structures used for communicating between SMM variable module and SMM variable wrapper module.
|
---|
3 |
|
---|
4 | Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _SMM_VARIABLE_COMMON_H_
|
---|
10 | #define _SMM_VARIABLE_COMMON_H_
|
---|
11 |
|
---|
12 | #include <Guid/VariableFormat.h>
|
---|
13 | #include <Protocol/VarCheck.h>
|
---|
14 |
|
---|
15 | #define EFI_SMM_VARIABLE_WRITE_GUID \
|
---|
16 | { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 } }
|
---|
17 |
|
---|
18 | extern EFI_GUID gSmmVariableWriteGuid;
|
---|
19 |
|
---|
20 | //
|
---|
21 | // This structure is used for SMM variable. the collected statistics data is saved in SMRAM. It can be got from
|
---|
22 | // SMI handler. The communication buffer should be:
|
---|
23 | // EFI_MM_COMMUNICATE_HEADER + SMM_VARIABLE_COMMUNICATE_HEADER + payload.
|
---|
24 | //
|
---|
25 | typedef struct {
|
---|
26 | UINTN Function;
|
---|
27 | EFI_STATUS ReturnStatus;
|
---|
28 | UINT8 Data[1];
|
---|
29 | } SMM_VARIABLE_COMMUNICATE_HEADER;
|
---|
30 |
|
---|
31 | //
|
---|
32 | // The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
|
---|
33 | //
|
---|
34 | #define SMM_VARIABLE_FUNCTION_GET_VARIABLE 1
|
---|
35 | //
|
---|
36 | // The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME.
|
---|
37 | //
|
---|
38 | #define SMM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME 2
|
---|
39 | //
|
---|
40 | // The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
|
---|
41 | //
|
---|
42 | #define SMM_VARIABLE_FUNCTION_SET_VARIABLE 3
|
---|
43 | //
|
---|
44 | // The payload for this function is SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO.
|
---|
45 | //
|
---|
46 | #define SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO 4
|
---|
47 | //
|
---|
48 | // It is a notify event, no extra payload for this function.
|
---|
49 | //
|
---|
50 | #define SMM_VARIABLE_FUNCTION_READY_TO_BOOT 5
|
---|
51 | //
|
---|
52 | // It is a notify event, no extra payload for this function.
|
---|
53 | //
|
---|
54 | #define SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE 6
|
---|
55 | //
|
---|
56 | // The payload for this function is VARIABLE_INFO_ENTRY. The GUID in EFI_MM_COMMUNICATE_HEADER
|
---|
57 | // is gEfiSmmVariableProtocolGuid.
|
---|
58 | //
|
---|
59 | #define SMM_VARIABLE_FUNCTION_GET_STATISTICS 7
|
---|
60 | //
|
---|
61 | // The payload for this function is SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE
|
---|
62 | //
|
---|
63 | #define SMM_VARIABLE_FUNCTION_LOCK_VARIABLE 8
|
---|
64 |
|
---|
65 | #define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_SET 9
|
---|
66 |
|
---|
67 | #define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_GET 10
|
---|
68 |
|
---|
69 | #define SMM_VARIABLE_FUNCTION_GET_PAYLOAD_SIZE 11
|
---|
70 | //
|
---|
71 | // The payload for this function is SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT
|
---|
72 | //
|
---|
73 | #define SMM_VARIABLE_FUNCTION_INIT_RUNTIME_VARIABLE_CACHE_CONTEXT 12
|
---|
74 |
|
---|
75 | #define SMM_VARIABLE_FUNCTION_SYNC_RUNTIME_CACHE 13
|
---|
76 | //
|
---|
77 | // The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO
|
---|
78 | //
|
---|
79 | #define SMM_VARIABLE_FUNCTION_GET_RUNTIME_CACHE_INFO 14
|
---|
80 |
|
---|
81 | ///
|
---|
82 | /// Size of SMM communicate header, without including the payload.
|
---|
83 | ///
|
---|
84 | #define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data))
|
---|
85 |
|
---|
86 | ///
|
---|
87 | /// Size of SMM variable communicate header, without including the payload.
|
---|
88 | ///
|
---|
89 | #define SMM_VARIABLE_COMMUNICATE_HEADER_SIZE (OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data))
|
---|
90 |
|
---|
91 | ///
|
---|
92 | /// This structure is used to communicate with SMI handler by SetVariable and GetVariable.
|
---|
93 | ///
|
---|
94 | typedef struct {
|
---|
95 | EFI_GUID Guid;
|
---|
96 | UINTN DataSize;
|
---|
97 | UINTN NameSize;
|
---|
98 | UINT32 Attributes;
|
---|
99 | CHAR16 Name[1];
|
---|
100 | } SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE;
|
---|
101 |
|
---|
102 | ///
|
---|
103 | /// This structure is used to communicate with SMI handler by GetNextVariableName.
|
---|
104 | ///
|
---|
105 | typedef struct {
|
---|
106 | EFI_GUID Guid;
|
---|
107 | UINTN NameSize; // Return name buffer size
|
---|
108 | CHAR16 Name[1];
|
---|
109 | } SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME;
|
---|
110 |
|
---|
111 | ///
|
---|
112 | /// This structure is used to communicate with SMI handler by QueryVariableInfo.
|
---|
113 | ///
|
---|
114 | typedef struct {
|
---|
115 | UINT64 MaximumVariableStorageSize;
|
---|
116 | UINT64 RemainingVariableStorageSize;
|
---|
117 | UINT64 MaximumVariableSize;
|
---|
118 | UINT32 Attributes;
|
---|
119 | } SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO;
|
---|
120 |
|
---|
121 | typedef SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE;
|
---|
122 |
|
---|
123 | typedef struct {
|
---|
124 | EFI_GUID Guid;
|
---|
125 | UINTN NameSize;
|
---|
126 | VAR_CHECK_VARIABLE_PROPERTY VariableProperty;
|
---|
127 | CHAR16 Name[1];
|
---|
128 | } SMM_VARIABLE_COMMUNICATE_VAR_CHECK_VARIABLE_PROPERTY;
|
---|
129 |
|
---|
130 | typedef struct {
|
---|
131 | UINTN VariablePayloadSize;
|
---|
132 | } SMM_VARIABLE_COMMUNICATE_GET_PAYLOAD_SIZE;
|
---|
133 |
|
---|
134 | typedef struct {
|
---|
135 | BOOLEAN *ReadLock;
|
---|
136 | BOOLEAN *PendingUpdate;
|
---|
137 | BOOLEAN *HobFlushComplete;
|
---|
138 | VARIABLE_STORE_HEADER *RuntimeHobCache;
|
---|
139 | VARIABLE_STORE_HEADER *RuntimeNvCache;
|
---|
140 | VARIABLE_STORE_HEADER *RuntimeVolatileCache;
|
---|
141 | } SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT;
|
---|
142 |
|
---|
143 | typedef struct {
|
---|
144 | UINTN TotalHobStorageSize;
|
---|
145 | UINTN TotalNvStorageSize;
|
---|
146 | UINTN TotalVolatileStorageSize;
|
---|
147 | BOOLEAN AuthenticatedVariableUsage;
|
---|
148 | } SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO;
|
---|
149 |
|
---|
150 | #endif // _SMM_VARIABLE_COMMON_H_
|
---|