summaryrefslogtreecommitdiff
path: root/Include/SmmPi.h
blob: d967a60ec866d47148b6866974fe32e850f98714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//**********************************************************************
// $Header: /Alaska/SOURCE/Modules/SMM/SmmPi.h 3     6/22/11 2:38p Markw $
//
// $Revision: 3 $
//
// $Date: 6/22/11 2:38p $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/SMM/SmmPi.h $
// 
// 3     6/22/11 2:38p Markw
// Add exclusions around typedef EFI_AP_PROCEDURE.
// 
// 2     3/04/11 3:33p Markw
// Update headers.
// 
// 1     2/07/11 3:58p Markw
// [TAG]  		EIP53481
// [Category]  	New Feature
// [Description]  	Add PIWG 1.1 SMM support
// [Files]  		Smm.sdl, SmmPrivateShared.h, SmmDispatcher.mak,
// SmmDispatcher.h, SmmDispatcher.c,
// Smst.c, SmmPiSmst.c, SmmInit.c, SmmBase.c, SmmBase2.c,
// SmmDriverDispatcher.c, Smm Framewwork Protocol files, SmmPi.h,
// Smm Pi Protocol files, SmmPciRbio files
// 
//**********************************************************************

//<AMI_FHDR_START>
//----------------------------------------------------------------------------
//
// Name: SmmPi.h
//
// Description: Smst table definitions.
//
//----------------------------------------------------------------------------
//<AMI_FHDR_END>

#ifndef __SMMPI__H__
#define __SMMPI__H__

#if PI_SPECIFICATION_VERSION >= 0x0001000A

#include <efi.h>
#include <Protocol\SmmCpuIo2.h>

#ifdef __cplusplus
extern "C" {
#endif

#define SMM_SMST_SIGNATURE 'TSMS'
#define EFI_SMM_SYSTEM_TABLE_REVISION (0<<16) | (0x09)

typedef struct _EFI_SMM_SYSTEM_TABLE2 EFI_SMM_SYSTEM_TABLE2;


typedef EFI_STATUS (EFIAPI *EFI_SMM_INSTALL_CONFIGURATION_TABLE2) (
    IN EFI_SMM_SYSTEM_TABLE2 *SystemTable,
    IN EFI_GUID             *Guid,
    IN VOID                 *Table,
    IN UINTN                TableSize
);

#ifndef EFI_AP_PROCEDURE_TYPE_DEFINED
#define EFI_AP_PROCEDURE_TYPE_DEFINED

typedef VOID (*EFI_AP_PROCEDURE) (
    IN VOID                     *Buffer
);

#endif

typedef EFI_STATUS (EFIAPI *EFI_SMM_STARTUP_THIS_AP) (
    IN EFI_AP_PROCEDURE         Procedure,
    IN UINTN                    CpuNumber,
    IN OUT VOID                 *ProcArguments  OPTIONAL
);

#define EFI_SMM_SYSTEM_TABLE_REVISION2 (1<<16) | (0x0A)


typedef struct _EFI_SMM_ENTRY_CONTEXT {
    EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;
    UINTN CurrentlyExecutingCpu;
    UINTN NumberOfCpus;
    UINTN *CpuSaveStateSize;
    VOID **CpuSaveState;
} EFI_SMM_ENTRY_CONTEXT;

typedef EFI_STATUS (EFIAPI *EFI_SMM_NOTIFY_FN)(
	IN CONST EFI_GUID *Protocol,
	IN VOID *Interface,
	IN EFI_HANDLE Handle
);


typedef EFI_STATUS (EFIAPI *EFI_SMM_INSTALL_PROTOCOL_INTERFACE) (
		IN OUT EFI_HANDLE *UserHandle, 
		IN EFI_GUID *Protocol,
		IN EFI_INTERFACE_TYPE InterfaceType, 
		IN VOID *Interface
);		

typedef EFI_STATUS (EFIAPI *EFI_SMM_UNINSTALL_PROTOCOL_INTERFACE)(
		IN EFI_HANDLE UserHandle, 
		IN EFI_GUID *Protocol, 
		IN VOID *Interface
);

typedef EFI_STATUS (EFIAPI *EFI_SMM_HANDLE_PROTOCOL)(
		IN EFI_HANDLE Handle, 
		IN EFI_GUID *Protocol,
		OUT VOID **Interface
);


typedef EFI_STATUS (EFIAPI *EFI_SMM_REGISTER_PROTOCOL_NOTIFY)(
		IN CONST EFI_GUID *Protocol, 
		IN EFI_SMM_NOTIFY_FN Function, 
		OUT VOID **Registration
);

typedef EFI_STATUS (EFIAPI *EFI_SMM_LOCATE_HANDLE)(
		IN EFI_LOCATE_SEARCH_TYPE SearchType, 
		IN EFI_GUID *Protocol OPTIONAL, 
		IN VOID *SearchKey OPTIONAL,
		IN OUT UINTN *BufferSize, 
		OUT EFI_HANDLE *Buffer
);

typedef EFI_STATUS (EFIAPI *EFI_SMM_LOCATE_PROTOCOL)(
		IN EFI_GUID *Protocol, 
		IN VOID *Registration OPTIONAL,
		OUT VOID **Interface
);

typedef EFI_STATUS (EFIAPI *EFI_SMM_INTERRUPT_MANAGE)(
		IN CONST EFI_GUID *HandlerType,
		IN CONST VOID *Context OPTIONAL,
		IN OUT VOID *CommBuffer OPTIONAL,
		IN OUT UINTN *CommBufferSize OPTIONAL
);

typedef EFI_STATUS (EFIAPI *EFI_SMM_HANDLER_ENTRY_POINT2) (
		IN EFI_HANDLE DispatchHandle,
		IN CONST VOID *Context OPTIONAL,
		IN OUT VOID *CommBuffer OPTIONAL,
		IN OUT UINTN *CommBufferSize OPTIONAL
);

typedef EFI_STATUS (EFIAPI *EFI_SMM_INTERRUPT_REGISTER) (
		IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
		IN CONST EFI_GUID *HandlerType OPTIONAL,
		OUT EFI_HANDLE *DispatchHandle
);

typedef EFI_STATUS (EFIAPI *EFI_SMM_INTERRUPT_UNREGISTER)(
		IN EFI_HANDLE DispatchHandle
);


typedef struct _EFI_SMM_SYSTEM_TABLE2 {
    EFI_TABLE_HEADER                    Hdr;
    CHAR16                              *SmmFirmwareVendor;
    UINT32                              SmmFirmwareRevision;
    
    EFI_SMM_INSTALL_CONFIGURATION_TABLE2 SmmInstallConfigurationTable;
    
    // I/O Services
    EFI_SMM_CPU_IO2_PROTOCOL             SmmIo;
    
    // Runtime memory service
    EFI_ALLOCATE_POOL                   SmmAllocatePool;
    EFI_FREE_POOL                       SmmFreePool;
    EFI_ALLOCATE_PAGES                  SmmAllocatePages;
    EFI_FREE_PAGES                      SmmFreePages;
    
    // Mp service
    EFI_SMM_STARTUP_THIS_AP             SmmStartupThisAp;

    // CPU information records
    UINTN                               CurrentlyExecutingCpu;
    UINTN                               NumberOfCpus;
    UINTN                               *CpuSaveStateSize;
    VOID                                **CpuSaveState;

    // Extensibility table
    UINTN                               NumberOfTableEntries;
    EFI_CONFIGURATION_TABLE             *SmmConfigurationTable;

    // Protocol services
	EFI_SMM_INSTALL_PROTOCOL_INTERFACE 	SmmInstallProtocolInterface;
	EFI_SMM_UNINSTALL_PROTOCOL_INTERFACE SmmUninstallProtocolInterface;
	EFI_SMM_HANDLE_PROTOCOL 			SmmHandleProtocol;
	EFI_SMM_REGISTER_PROTOCOL_NOTIFY	SmmRegisterProtocolNotify;
	EFI_SMM_LOCATE_HANDLE 				SmmLocateHandle;
	EFI_SMM_LOCATE_PROTOCOL 			SmmLocateProtocol;

	// SMI management functions
	EFI_SMM_INTERRUPT_MANAGE 			SmiManage;
	EFI_SMM_INTERRUPT_REGISTER 			SmiHandlerRegister;
	EFI_SMM_INTERRUPT_UNREGISTER 		SmiHandlerUnRegister;
} EFI_SMM_SYSTEM_TABLE2;

/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif
#endif

//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************