summaryrefslogtreecommitdiff
path: root/Chipset/SB/SmmChildDispatch.h
blob: 01458d065ed99e48fc3c23cdd5404f23635e6032 (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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//*************************************************************************
// $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/SmmChildDispatcher/SmmChildDispatch.h 2     4/25/12 9:35a Victortu $
//
// $Revision: 2 $
//
// $Date: 4/25/12 9:35a $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/SmmChildDispatcher/SmmChildDispatch.h $
// 
// 2     4/25/12 9:35a Victortu
// [TAG]         None
// [Category]    Improvement
// [Description] Reprogram SMM ChildDispatcher drivers.
// [Files]       SmiHandlerGeneric.c; SmiHandlerPorting.c;
// SmiHandlerGeneric2.c; SmmChildDispatch2Main.c; SmmChildDispatcher2.mak;
// SmmChildDispatcher2.sdl; SmmChildDispatch.h; SmmChildDispatchMain.c;
// SmmChildDispatchProtocol.c; SmmChildDispatcher.dxs;
// PchSmiDispatcher.sdl
// 
// 1     2/08/12 8:27a Yurenlai
// Intel Lynx Point/SB eChipset initially releases.
// 
//*************************************************************************
//<AMI_FHDR_START>
//
// Name:        SmmChildDispatch.h
//
// Description: SMM Child dispatcher functions and data structures
//              definition.
//
//<AMI_FHDR_END>
//*************************************************************************

#ifndef __SMM_CHILD_DISPATCH__H__
#define __SMM_CHILD_DISPATCH__H__
#ifdef __cplusplus
extern "C" {
#endif

#include <AmiDxeLib.h>
#include <Protocol\SmmSwDispatch.h>
#include <Protocol\SmmSxDispatch.h>
#include <Protocol\SmmPeriodicTimerDispatch.h>
#include <Protocol\SmmUsbDispatch.h>
#include <Protocol\SmmGpiDispatch.h>
#include <Protocol\SmmStandbyButtonDispatch.h>
#include <Protocol\SmmPowerButtonDispatch.h>
#include <Protocol\SmmTcoDispatch.h>
#include <Protocol\SmmIoTrapDispatch.h>

#include <Protocol\SmmBiosWriteDispatch.h>

#ifndef INTEL_RC_SMI_DISPATCHER_SUPPORT
#define INTEL_RC_SMI_DISPATCHER_SUPPORT 0
#endif

#pragma pack(push, 1)

typedef enum {
    EfiSmmSwSmi,
    EfiSmmSxSmi,
    EfiSmmPeriodicTimerSmi,
    EfiSmmUsbSmi,
    EfiSmmGpiSmi,
    EfiSmmStandbyButtonSmi,
    EfiSmmPowerButtonSmi,
    EfiSmmTcoSmi,
    EfiSmmIoTrapSmi,
    EfiSmmMaxSmi
} EFI_SMM_SMI;

typedef union {
    EFI_SMM_SW_DISPATCH_CONTEXT             SwContext;
    EFI_SMM_SX_DISPATCH_CONTEXT             SxContext;
    EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT TimerContext;
    EFI_SMM_USB_DISPATCH_CONTEXT            UsbContext;
    EFI_SMM_GPI_DISPATCH_CONTEXT            GpiContext;
    EFI_SMM_STANDBY_BUTTON_DISPATCH_CONTEXT SBtnContext;
    EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT   PBtnContext;
    EFI_SMM_TCO_DISPATCH_CONTEXT            TcoContext;
    EFI_SMM_IO_TRAP_DISPATCH_CONTEXT        IoTrapContext;
} EFI_SMM_SMI_CONTEXT;

typedef VOID ( *SMI_GENERIC_CALLBACK ) (
    IN EFI_HANDLE           DispatchHandle,
    IN VOID                 *DispatchContext
);

typedef struct {
    DLINK                   Link;
    UINT32                  Signature;
    SMI_GENERIC_CALLBACK    Callback;
    UINT8                   Context[1];
} HANDLER_LINK;

typedef VOID ( *SMI_GENERIC_NEW_CALLBACK ) (
	IN EFI_HANDLE           DispatchHandle,
	IN VOID                 *DispatchContext,
	IN OUT VOID             *CommBuffer,
	IN OUT UINTN            *CommBufferSize	
);


typedef struct {
    DLINK                           Link;
    UINT32                          Signature;
    SMI_GENERIC_NEW_CALLBACK        Callback;
    UINT8                           Context[1];
} HANDLER_NEW_LINK;

//---------------------------------------------------------------------------
//                SMI Handler protocol functions prototypes
//---------------------------------------------------------------------------

typedef EFI_STATUS ( *ADD_HANDLER ) (
    IN VOID                 *Context
);

typedef EFI_STATUS ( *REMOVE_HANDLER ) (
    IN VOID                 *Context
);

typedef EFI_STATUS ( *VERIFY_CONTEXT) (
    IN VOID                 *Context
);

typedef BOOLEAN ( *GET_CONTEXT ) (
    VOID
);

typedef VOID ( *DISPATCH_SMI ) (
    VOID
);

typedef struct {
    ADD_HANDLER             AddHandler;
    REMOVE_HANDLER          RemoveHandler;
    VERIFY_CONTEXT          VerifyContext;
    GET_CONTEXT             GetContext;
    DISPATCH_SMI            DispatchSmi;
} SMI_HANDLER_PROTOCOL;

typedef struct {
    EFI_SMM_SMI             SmiType;
    SMI_HANDLER_PROTOCOL    HandlerProtocol;
    DLIST                   RegisteredCallbacks;
} SMM_CHILD_DISPATCHER;

#pragma pack(pop)

//---------------------------------------------------------------------------
//                         SW SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmSwAddHandler( IN VOID *Context );
EFI_STATUS  SmmSwRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmSwVerifyContext( IN VOID *Context );
BOOLEAN     SmmSwGetContext( VOID );
VOID        SmmSwDispatchSmi( VOID );

//---------------------- SW SMI Handler Porting hooks -----------------------

VOID        SwSmiEnable( VOID );
VOID        SwSmiDisable( VOID );
VOID        SwSmiClear( VOID );
BOOLEAN     SwSmiDetect( OUT UINT16 *Type );
UINTN       GetEAX( VOID );

//---------------------------------------------------------------------------
//                         SX SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmSxAddHandler( IN VOID *Context );
EFI_STATUS  SmmSxRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmSxVerifyContext( IN VOID *Context );
BOOLEAN     SmmSxGetContext( VOID );
VOID        SmmSxDispatchSmi( VOID );

//---------------------- SX SMI Handler Porting hooks -----------------------

VOID        SxSmiEnable( VOID );
VOID        SxSmiDisable( VOID );
VOID        SxSmiClear( VOID );
VOID        PutToSleep( IN VOID *Context );
BOOLEAN     SxSmiDetect( OUT UINT16 *Type );

//---------------------------------------------------------------------------
//                   Periodic timer SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmTimerAddHandler( IN VOID *Context );
EFI_STATUS  SmmTimerRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmTimerVerifyContext( IN VOID *Context );
BOOLEAN     SmmTimerGetContext( VOID );
VOID        SmmTimerDispatchSmi( VOID );

//---------------- Periodic timer SMI Handler Porting hooks -----------------

VOID        TimerSmiEnable( VOID );
VOID        TimerSmiDisable( VOID );
VOID        TimerSmiClear( VOID );
BOOLEAN     TimerSmiDetect( OUT UINT16 *Type );
VOID        TimerSetInterval( IN UINT64 Interval);

//---------------------------------------------------------------------------
//                         USB SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmUsbAddHandler( IN VOID *Context );
EFI_STATUS  SmmUsbRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmUsbVerifyContext( IN VOID *Context );
BOOLEAN     SmmUsbGetContext( VOID );
VOID        SmmUsbDispatchSmi( VOID );

//---------------------- USB SMI Handler Porting hooks ----------------------

VOID        UsbSmiSet( IN UINT16 ControllerType );
VOID        UsbSmiClear( IN UINT16 ControllerType );
BOOLEAN     UsbSmiDetect( OUT UINT16 *Type );
UINT16      GetControllerType( OUT EFI_DEVICE_PATH_PROTOCOL *Device );

//---------------------------------------------------------------------------
//                         GPI SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmGpiAddHandler( IN VOID *Context );
EFI_STATUS  SmmGpiRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmGpiVerifyContext( IN VOID *Context );
BOOLEAN     SmmGpiGetContext( VOID );
VOID        SmmGpiDispatchSmi( VOID );

//---------------------- GPI SMI Handler Porting hooks ----------------------

VOID        GpiSmiSet( IN UINT32 GpiEnableBit );
VOID        GpiSmiReset( IN UINT32 GpiDisableBit );
VOID        GpiSmiClear( IN UINT32 GpiClearBit );
BOOLEAN     GpiSmiDetect( OUT UINT32 *Gpi );

//---------------------------------------------------------------------------
//                  Standby button SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmSButtonAddHandler( IN VOID *Context );
EFI_STATUS  SmmSButtonRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmSButtonVerifyContext( IN VOID *Context );
BOOLEAN     SmmSButtonGetContext( VOID );
VOID        SmmSButtonDispatchSmi( VOID );

//---------------- Standby button SMI Handler Porting hooks -----------------

VOID        SButtonSmiEnable( VOID );
VOID        SButtonSmiDisable( VOID );
VOID        SButtonSmiClear( VOID );
BOOLEAN     SButtonSmiDetect( OUT UINT16 *Type );

//---------------------------------------------------------------------------
//                   Power button SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmPButtonAddHandler( IN VOID *Context );
EFI_STATUS  SmmPButtonRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmPButtonVerifyContext( IN VOID *Context );
BOOLEAN     SmmPButtonGetContext( VOID );
VOID        SmmPButtonDispatchSmi( VOID );

//---------------- Power button SMI Handler Porting hooks -------------------

VOID        PButtonSmiEnable( VOID );
VOID        PButtonSmiDisable( VOID );
VOID        PButtonSmiClear( VOID );
BOOLEAN     PButtonSmiDetect( OUT UINT16 *Type );

//---------------------------------------------------------------------------
//                        TCO SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmTcoAddHandler( IN VOID *Context );
EFI_STATUS  SmmTcoRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmTcoVerifyContext( IN VOID *Context );
BOOLEAN     SmmTcoGetContext( VOID );
VOID        SmmTcoDispatchSmi( VOID );

//--------------------- TCO SMI Handler Porting hooks -----------------------

VOID        TcoSmiSet( IN UINT32 TcoBitOffset );
VOID        TcoSmiReset( IN UINT32 TcoBitOffset );
VOID        TcoSmiEnable( VOID );
VOID        TcoSmiDisable( VOID );
VOID        TcoSmiClear( VOID );
BOOLEAN     TcoSmiDetect( OUT UINT32 *TcoStatus );

//---------------------------------------------------------------------------
//                     I/O Trap SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmIoTrapAddHandler( IN VOID *Context );
EFI_STATUS  SmmIoTrapRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmIoTrapVerifyContext( IN VOID *Context );
BOOLEAN     SmmIoTrapGetContext( VOID );
VOID        SmmIoTrapDispatchSmi( VOID );

//------------------ I/O Trap SMI Handler Porting hooks ---------------------

VOID        IoTrapSmiSet( IN EFI_SMM_IO_TRAP_DISPATCH_CONTEXT *Context );
VOID        IoTrapSmiReset( IN EFI_SMM_IO_TRAP_DISPATCH_CONTEXT *Context );
VOID        IoTrapSmiEnable( VOID );
VOID        IoTrapSmiDisable( VOID );
VOID        IoTrapSmiClear( VOID );
BOOLEAN     IoTrapSmiDetect( OUT EFI_SMM_IO_TRAP_DISPATCH_CONTEXT *Context );

//---------------------------------------------------------------------------
//                    BIOS Write SMI Handler functions
//---------------------------------------------------------------------------

EFI_STATUS  SmmBiosWriteAddHandler( IN VOID *Context );
EFI_STATUS  SmmBiosWriteRemoveHandler( IN VOID *Context );
EFI_STATUS  SmmBiosWriteVerifyContext( IN VOID *Context );
BOOLEAN     SmmBiosWriteGetContext( VOID );
VOID        SmmBiosWriteDispatchSmi( VOID );

//----------------- BIOS Write SMI Handler Porting hooks --------------------

VOID        BiosWriteSmiEnable( VOID );
VOID        BiosWriteSmiDisable( VOID );
VOID        BiosWriteSmiClear( VOID );
BOOLEAN     BiosWriteSmiDetect( VOID );

//---------------------------------------------------------------------------
//                      All purpose SMI Porting hooks
//---------------------------------------------------------------------------
VOID        ClearAllSmi( VOID );

VOID        SbSmiWorkaround( VOID );

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

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