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