• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 - 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _SMM_VARIABLE_COMMON_H_
16 #define _SMM_VARIABLE_COMMON_H_
17 
18 #include <Protocol/VarCheck.h>
19 
20 #define EFI_SMM_VARIABLE_WRITE_GUID \
21   { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 } }
22 
23 extern EFI_GUID gSmmVariableWriteGuid;
24 
25 //
26 // This structure is used for SMM variable. the collected statistics data is saved in SMRAM. It can be got from
27 // SMI handler. The communication buffer should be:
28 // EFI_SMM_COMMUNICATE_HEADER + SMM_VARIABLE_COMMUNICATE_HEADER + payload.
29 //
30 typedef struct {
31   UINTN       Function;
32   EFI_STATUS  ReturnStatus;
33   UINT8       Data[1];
34 } SMM_VARIABLE_COMMUNICATE_HEADER;
35 
36 //
37 // The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
38 //
39 #define SMM_VARIABLE_FUNCTION_GET_VARIABLE            1
40 //
41 // The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME.
42 //
43 #define SMM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME  2
44 //
45 // The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
46 //
47 #define SMM_VARIABLE_FUNCTION_SET_VARIABLE            3
48 //
49 // The payload for this function is SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO.
50 //
51 #define SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO     4
52 //
53 // It is a notify event, no extra payload for this function.
54 //
55 #define SMM_VARIABLE_FUNCTION_READY_TO_BOOT           5
56 //
57 // It is a notify event, no extra payload for this function.
58 //
59 #define SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE       6
60 //
61 // The payload for this function is VARIABLE_INFO_ENTRY. The GUID in EFI_SMM_COMMUNICATE_HEADER
62 // is gEfiSmmVariableProtocolGuid.
63 //
64 #define SMM_VARIABLE_FUNCTION_GET_STATISTICS          7
65 //
66 // The payload for this function is SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE
67 //
68 #define SMM_VARIABLE_FUNCTION_LOCK_VARIABLE           8
69 
70 #define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_SET  9
71 
72 #define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_GET  10
73 
74 #define SMM_VARIABLE_FUNCTION_GET_PAYLOAD_SIZE        11
75 
76 ///
77 /// Size of SMM communicate header, without including the payload.
78 ///
79 #define SMM_COMMUNICATE_HEADER_SIZE  (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data))
80 
81 ///
82 /// Size of SMM variable communicate header, without including the payload.
83 ///
84 #define SMM_VARIABLE_COMMUNICATE_HEADER_SIZE  (OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data))
85 
86 ///
87 /// This structure is used to communicate with SMI handler by SetVariable and GetVariable.
88 ///
89 typedef struct {
90   EFI_GUID    Guid;
91   UINTN       DataSize;
92   UINTN       NameSize;
93   UINT32      Attributes;
94   CHAR16      Name[1];
95 } SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE;
96 
97 ///
98 /// This structure is used to communicate with SMI handler by GetNextVariableName.
99 ///
100 typedef struct {
101   EFI_GUID    Guid;
102   UINTN       NameSize;     // Return name buffer size
103   CHAR16      Name[1];
104 } SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME;
105 
106 ///
107 /// This structure is used to communicate with SMI handler by QueryVariableInfo.
108 ///
109 typedef struct {
110   UINT64          MaximumVariableStorageSize;
111   UINT64          RemainingVariableStorageSize;
112   UINT64          MaximumVariableSize;
113   UINT32          Attributes;
114 } SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO;
115 
116 typedef SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE;
117 
118 typedef struct {
119   EFI_GUID                      Guid;
120   UINTN                         NameSize;
121   VAR_CHECK_VARIABLE_PROPERTY   VariableProperty;
122   CHAR16                        Name[1];
123 } SMM_VARIABLE_COMMUNICATE_VAR_CHECK_VARIABLE_PROPERTY;
124 
125 typedef struct {
126   UINTN                         VariablePayloadSize;
127 } SMM_VARIABLE_COMMUNICATE_GET_PAYLOAD_SIZE;
128 
129 #endif // _SMM_VARIABLE_COMMON_H_
130