1 /** @file
2   Provides the parent dispatch service for a given SMI source generator.
3   The EFI_SMM_ICHN_DISPATCH_PROTOCOL provides the ability to install child handlers for
4   the given event types.
5 
6 Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available under
8 the terms and conditions of the BSD License that accompanies this distribution.
9 The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
11 
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15   @par Revision Reference:
16   This Protocol is defined in Framework of EFI SMM Core Interface Spec
17   Version 0.9.
18 
19 **/
20 
21 #ifndef _EFI_SMM_ICHN_DISPATCH_H_
22 #define _EFI_SMM_ICHN_DISPATCH_H_
23 
24 
25 //
26 // Global ID for the ICH SMI Protocol
27 //
28 #define EFI_SMM_ICHN_DISPATCH_PROTOCOL_GUID \
29   { \
30     0xc50b323e, 0x9075, 0x4f2a, {0xac, 0x8e, 0xd2, 0x59, 0x6a, 0x10, 0x85, 0xcc } \
31   }
32 
33 typedef struct _EFI_SMM_ICHN_DISPATCH_PROTOCOL  EFI_SMM_ICHN_DISPATCH_PROTOCOL;
34 
35 //
36 // Related Definitions
37 //
38 //
39 // ICHN Specific SMIs.  These are miscellaneous SMI sources that are supported by the
40 // ICHN specific SMI implementation.  These may change over time.  TrapNumber is only
41 // valid if the Type is Trap.
42 //
43 typedef enum {
44   //
45   // NOTE: NEVER delete items from this list/enumeration!  Doing so will prevent other versions
46   // of the code from compiling.  If the ICH version your driver is written for doesn't support
47   // some of these SMIs, then simply return EFI_UNSUPPORTED when a child/client tries to register
48   // for them.
49   //
50   IchnMch,
51   IchnPme,
52   IchnRtcAlarm,
53   IchnRingIndicate,
54   IchnAc97Wake,
55   IchnSerialIrq,
56   IchnY2KRollover,
57   IchnTcoTimeout,
58   IchnOsTco,
59   IchnNmi,
60   IchnIntruderDetect,
61   IchnBiosWp,
62   IchnMcSmi,
63   IchnPmeB0,
64   IchnThrmSts,
65   IchnSmBus,
66   IchnIntelUsb2,
67   IchnMonSmi7,
68   IchnMonSmi6,
69   IchnMonSmi5,
70   IchnMonSmi4,
71   IchnDevTrap13,
72   IchnDevTrap12,
73   IchnDevTrap11,
74   IchnDevTrap10,
75   IchnDevTrap9,
76   IchnDevTrap8,
77   IchnDevTrap7,
78   IchnDevTrap6,
79   IchnDevTrap5,
80   IchnDevTrap3,
81   IchnDevTrap2,
82   IchnDevTrap1,
83   IchnDevTrap0,
84   IchnIoTrap3,
85   IchnIoTrap2,
86   IchnIoTrap1,
87   IchnIoTrap0,
88   IchnPciExpress,
89   IchnMonitor,
90   IchnSpi,
91   IchnQRT,
92   IchnGpioUnlock,
93   //
94   // INSERT NEW ITEMS JUST BEFORE THIS LINE
95   //
96   NUM_ICHN_TYPES  // the number of items in this enumeration
97 } EFI_SMM_ICHN_SMI_TYPE;
98 
99 typedef struct {
100   EFI_SMM_ICHN_SMI_TYPE Type;
101 } EFI_SMM_ICHN_DISPATCH_CONTEXT;
102 
103 //
104 // Member functions
105 //
106 /**
107   Dispatch function for a ICHN specific SMI handler.
108 
109   @param  DispatchHandle        The handle of this dispatch function.
110   @param  DispatchContext       The pointer to the dispatch function's context.
111                                 The DispatchContext fields are filled in
112                                 by the dispatching driver prior to
113                                 invoking this dispatch function.
114 
115   @return None
116 
117 **/
118 typedef
119 VOID
120 (EFIAPI *EFI_SMM_ICHN_DISPATCH)(
121   IN  EFI_HANDLE                      DispatchHandle,
122   IN  EFI_SMM_ICHN_DISPATCH_CONTEXT   *DispatchContext
123   );
124 
125 /**
126   Register a child SMI source dispatch function with a parent SMM driver.
127 
128   @param  This                  The pointer to the EFI_SMM_ICHN_DISPATCH_PROTOCOL instance.
129   @param  DispatchFunction      The function to install.
130   @param  DispatchContext       The pointer to the dispatch function's context.
131                                 The caller fills in this context before calling
132                                 the register function to indicate to the register
133                                 function the ICHN SMI source for which the dispatch
134                                 function should be invoked.
135   @param  DispatchHandle        The handle generated by the dispatcher to track the function
136                                 instance.
137 
138   @retval EFI_SUCCESS           The dispatch function has been successfully
139                                 registered and the SMI source has been enabled.
140   @retval EFI_DEVICE_ERROR      The driver could not enable the SMI source.
141   @retval EFI_OUT_OF_RESOURCES  Not enough memory (system or SMM) to manage this
142                                 child.
143   @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The ICHN input value
144                                 is not within valid range.
145 
146 **/
147 typedef
148 EFI_STATUS
149 (EFIAPI *EFI_SMM_ICHN_REGISTER)(
150   IN EFI_SMM_ICHN_DISPATCH_PROTOCOL            *This,
151   IN EFI_SMM_ICHN_DISPATCH                     DispatchFunction,
152   IN EFI_SMM_ICHN_DISPATCH_CONTEXT             *DispatchContext,
153   OUT EFI_HANDLE                               *DispatchHandle
154   );
155 
156 /**
157   Unregister a child SMI source dispatch function with a parent SMM driver
158 
159   @param  This                  The pointer to the EFI_SMM_ICHN_DISPATCH_PROTOCOL instance.
160   @param  DispatchHandle        The handle of the service to remove.
161 
162   @retval EFI_SUCCESS           The dispatch function has been successfully
163                                 unregistered, and the SMI source has been disabled,
164                                 if there are no other registered child dispatch
165                                 functions for this SMI source.
166   @retval EFI_INVALID_PARAMETER The handle is invalid.
167 
168 **/
169 typedef
170 EFI_STATUS
171 (EFIAPI *EFI_SMM_ICHN_UNREGISTER)(
172   IN EFI_SMM_ICHN_DISPATCH_PROTOCOL            *This,
173   IN EFI_HANDLE                                DispatchHandle
174   );
175 
176 //
177 // Interface structure for the SMM ICHN specific SMI Dispatch Protocol
178 //
179 /**
180   Provides the parent dispatch service for a given SMI source generator.
181 **/
182 struct _EFI_SMM_ICHN_DISPATCH_PROTOCOL {
183   EFI_SMM_ICHN_REGISTER   Register;     ///< Installs a child service to be dispatched by this protocol.
184   EFI_SMM_ICHN_UNREGISTER UnRegister;   ///< Removes a child service dispatched by this protocol.
185 };
186 
187 extern EFI_GUID gEfiSmmIchnDispatchProtocolGuid;
188 
189 #endif
190