• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   This file declares the Smm Gpi Smi Child Protocol.
3 
4   The EFI_SMM_GPI_DISPATCH_PROTOCOL is defined in Framework of EFI SMM Core Interface Spec
5   Version 0.9. It provides the ability to install child handlers for the given event types.
6   Several inputs can be enabled. This purpose of this interface is to generate an
7   SMI in response to any of these inputs having a true value provided.
8 
9 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
10 This program and the accompanying materials are licensed and made available under
11 the terms and conditions of the BSD License that accompanies this distribution.
12 The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php.
14 
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 
18 **/
19 
20 #ifndef _SMM_GPI_DISPATCH_H_
21 #define _SMM_GPI_DISPATCH_H_
22 
23 
24 //
25 // Global ID for the GPI SMI Protocol
26 //
27 #define EFI_SMM_GPI_DISPATCH_PROTOCOL_GUID \
28   { \
29     0xe0744b81, 0x9513, 0x49cd, {0x8c, 0xea, 0xe9, 0x24, 0x5e, 0x70, 0x39, 0xda } \
30   }
31 
32 typedef struct _EFI_SMM_GPI_DISPATCH_PROTOCOL  EFI_SMM_GPI_DISPATCH_PROTOCOL;
33 
34 //
35 // Related Definitions
36 //
37 
38 //
39 // GpiMask is a bit mask of 32 possible general purpose inputs that can generate
40 // an SMI. Bit 0 corresponds to logical GPI[0], 1 corresponds to logical GPI[1], and so on.
41 //
42 // The logical GPI index to physical pin on device is described by the GPI device name
43 // found on the same handle as the GpiSmi child dispatch protocol.  The GPI device name
44 // is defined as protocol with a GUID name and NULL protocol pointer.
45 //
46 typedef struct {
47   UINTN GpiNum;
48 } EFI_SMM_GPI_DISPATCH_CONTEXT;
49 
50 //
51 // Member functions
52 //
53 
54 /**
55   Dispatch function for a GPI SMI handler.
56 
57   @param  DispatchHandle        The handle of this dispatch function.
58   @param  DispatchContext       The pointer to the dispatch function's context.
59                                 The DispatchContext fields are filled in by the
60                                 dispatching driver prior to invoking this dispatch
61                                 function.
62 **/
63 typedef
64 VOID
65 (EFIAPI *EFI_SMM_GPI_DISPATCH)(
66   IN  EFI_HANDLE                    DispatchHandle,
67   IN  EFI_SMM_GPI_DISPATCH_CONTEXT  *DispatchContext
68   );
69 
70 /**
71   Register a child SMI source dispatch function with a parent SMM driver
72 
73   @param  This                  The pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
74   @param  DispatchFunction      Function to install.
75   @param  DispatchContext       The pointer to the dispatch function's context.
76                                 Indicates to the register
77                                 function the GPI(s) for which the dispatch function
78                                 should be invoked.
79   @param  DispatchHandle        The handle generated by the dispatcher to track the
80                                 function instance.
81 
82   @retval EFI_SUCCESS           The dispatch function has been successfully
83                                 registered, and the SMI source has been enabled.
84   @retval EFI_DEVICE_ERROR      The driver was unable to enable the SMI source.
85   @retval EFI_OUT_OF_RESOURCES  Not enough memory (system or SMM) to manage this
86                                 child.
87   @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The GPI input value
88                                 is not within valid range.
89 
90 **/
91 typedef
92 EFI_STATUS
93 (EFIAPI *EFI_SMM_GPI_REGISTER)(
94   IN EFI_SMM_GPI_DISPATCH_PROTOCOL           *This,
95   IN EFI_SMM_GPI_DISPATCH                    DispatchFunction,
96   IN EFI_SMM_GPI_DISPATCH_CONTEXT            *DispatchContext,
97   OUT EFI_HANDLE                             *DispatchHandle
98   );
99 
100 /**
101   Unregisters a General Purpose Input (GPI) service.
102 
103   @param  This                  The pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
104   @param  DispatchHandle        The handle of the service to remove.
105 
106   @retval EFI_SUCCESS           The dispatch function has been successfully
107                                 unregistered, and the SMI source has been disabled,
108                                 if there are no other registered child dispatch
109                                 functions for this SMI source.
110   @retval EFI_INVALID_PARAMETER DispatchHandle is invalid.
111 
112 **/
113 typedef
114 EFI_STATUS
115 (EFIAPI *EFI_SMM_GPI_UNREGISTER)(
116   IN EFI_SMM_GPI_DISPATCH_PROTOCOL           *This,
117   IN EFI_HANDLE                              DispatchHandle
118   );
119 
120 //
121 // Interface structure for the SMM GPI SMI Dispatch Protocol
122 //
123 struct _EFI_SMM_GPI_DISPATCH_PROTOCOL {
124   EFI_SMM_GPI_REGISTER    Register;
125   EFI_SMM_GPI_UNREGISTER  UnRegister;
126 
127   ///
128   /// Denotes the maximum value of inputs that can have handlers attached.
129   ///
130   UINTN                   NumSupportedGpis;
131 };
132 
133 extern EFI_GUID gEfiSmmGpiDispatchProtocolGuid;
134 
135 #endif
136 
137