]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmGpiDispatch.h
e0bfa142eac622ec39fd5d27914e58116b2168e9
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmGpiDispatch.h
1 /** @file
2 This file declares 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 - 2009, Intel Corporation
10 All rights reserved. This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. 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 a
40 // a SMI. Bit 0 corresponds to logical GPI[0], 1 corresponds to logical GPI[1], etc.
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 Handle of this dispatch function.
58 @param DispatchContext Pointer to the dispatch function's context.
59 The DispatchContext fields are filled in by the dispatching driver prior to
60 invoking this dispatch function.
61 **/
62 typedef
63 VOID
64 (EFIAPI *EFI_SMM_GPI_DISPATCH)(
65 IN EFI_HANDLE DispatchHandle,
66 IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext
67 );
68
69 /**
70 Register a child SMI source dispatch function with a parent SMM driver
71
72 @param This Pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
73 @param DispatchFunction Function to install.
74 @param DispatchContext Pointer to the dispatch function's context.
75 The caller fills this context in before calling
76 the register function to indicate to the register
77 function the GPI(s) for which the dispatch function
78 should be invoked.
79 @param DispatchHandle 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 Pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
104 @param DispatchHandle 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