2 The file defined some common structures used for communicating between SMM variable module and SMM variable wrapper module.
4 Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _SMM_VARIABLE_COMMON_H_
10 #define _SMM_VARIABLE_COMMON_H_
12 #include <Guid/VariableFormat.h>
13 #include <Protocol/VarCheck.h>
15 #define EFI_SMM_VARIABLE_WRITE_GUID \
16 { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 } }
18 extern EFI_GUID gSmmVariableWriteGuid
;
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.
27 EFI_STATUS ReturnStatus
;
29 } SMM_VARIABLE_COMMUNICATE_HEADER
;
32 // The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
34 #define SMM_VARIABLE_FUNCTION_GET_VARIABLE 1
36 // The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME.
38 #define SMM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME 2
40 // The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
42 #define SMM_VARIABLE_FUNCTION_SET_VARIABLE 3
44 // The payload for this function is SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO.
46 #define SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO 4
48 // It is a notify event, no extra payload for this function.
50 #define SMM_VARIABLE_FUNCTION_READY_TO_BOOT 5
52 // It is a notify event, no extra payload for this function.
54 #define SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE 6
56 // The payload for this function is VARIABLE_INFO_ENTRY. The GUID in EFI_MM_COMMUNICATE_HEADER
57 // is gEfiSmmVariableProtocolGuid.
59 #define SMM_VARIABLE_FUNCTION_GET_STATISTICS 7
61 // The payload for this function is SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE
63 #define SMM_VARIABLE_FUNCTION_LOCK_VARIABLE 8
65 #define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_SET 9
67 #define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_GET 10
69 #define SMM_VARIABLE_FUNCTION_GET_PAYLOAD_SIZE 11
71 // The payload for this function is SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT
73 #define SMM_VARIABLE_FUNCTION_INIT_RUNTIME_VARIABLE_CACHE_CONTEXT 12
75 #define SMM_VARIABLE_FUNCTION_SYNC_RUNTIME_CACHE 13
77 // The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO
79 #define SMM_VARIABLE_FUNCTION_GET_RUNTIME_CACHE_INFO 14
82 /// Size of SMM communicate header, without including the payload.
84 #define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data))
87 /// Size of SMM variable communicate header, without including the payload.
89 #define SMM_VARIABLE_COMMUNICATE_HEADER_SIZE (OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data))
92 /// This structure is used to communicate with SMI handler by SetVariable and GetVariable.
100 } SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE
;
103 /// This structure is used to communicate with SMI handler by GetNextVariableName.
107 UINTN NameSize
; // Return name buffer size
109 } SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME
;
112 /// This structure is used to communicate with SMI handler by QueryVariableInfo.
115 UINT64 MaximumVariableStorageSize
;
116 UINT64 RemainingVariableStorageSize
;
117 UINT64 MaximumVariableSize
;
119 } SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO
;
121 typedef SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE
;
126 VAR_CHECK_VARIABLE_PROPERTY VariableProperty
;
128 } SMM_VARIABLE_COMMUNICATE_VAR_CHECK_VARIABLE_PROPERTY
;
131 UINTN VariablePayloadSize
;
132 } SMM_VARIABLE_COMMUNICATE_GET_PAYLOAD_SIZE
;
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
;
144 UINTN TotalHobStorageSize
;
145 UINTN TotalNvStorageSize
;
146 UINTN TotalVolatileStorageSize
;
147 BOOLEAN AuthenticatedVariableUsage
;
148 } SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO
;
150 #endif // _SMM_VARIABLE_COMMON_H_