Comment update.
[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 #include <PiDxe.h>
24
25 //
26 // Global ID for the GPI SMI Protocol
27 //
28 #define EFI_SMM_GPI_DISPATCH_PROTOCOL_GUID \
29 { \
30 0xe0744b81, 0x9513, 0x49cd, {0x8c, 0xea, 0xe9, 0x24, 0x5e, 0x70, 0x39, 0xda } \
31 }
32
33 typedef struct _EFI_SMM_GPI_DISPATCH_PROTOCOL EFI_SMM_GPI_DISPATCH_PROTOCOL;
34
35 //
36 // Related Definitions
37 //
38
39 //
40 // GpiMask is a bit mask of 32 possible general purpose inputs that can generate a
41 // a SMI. Bit 0 corresponds to logical GPI[0], 1 corresponds to logical GPI[1], etc.
42 //
43 // The logical GPI index to physical pin on device is described by the GPI device name
44 // found on the same handle as the GpiSmi child dispatch protocol. The GPI device name
45 // is defined as protocol with a GUID name and NULL protocol pointer.
46 //
47 typedef struct {
48 UINTN GpiNum;
49 } EFI_SMM_GPI_DISPATCH_CONTEXT;
50
51 //
52 // Member functions
53 //
54
55 /**
56 Dispatch function for a GPI SMI handler.
57
58 @param DispatchHandle Handle of this dispatch function.
59 @param DispatchContext Pointer to the dispatch function's context.
60 The DispatchContext fields are filled in by the dispatching driver prior to
61 invoking this dispatch 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 Pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
74 @param DispatchFunction Function to install.
75 @param DispatchContext Pointer to the dispatch function's context.
76 The caller fills this context in before calling
77 the register function to indicate to the register
78 function the GPI(s) for which the dispatch function
79 should be invoked.
80 @param DispatchHandle Handle generated by the dispatcher to track the
81 function instance.
82
83 @retval EFI_SUCCESS The dispatch function has been successfully
84 registered and the SMI source has been enabled.
85 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
86 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
87 child.
88 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The GPI input value
89 is not within valid range.
90
91 **/
92 typedef
93 EFI_STATUS
94 (EFIAPI *EFI_SMM_GPI_REGISTER)(
95 IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,
96 IN EFI_SMM_GPI_DISPATCH DispatchFunction,
97 IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext,
98 OUT EFI_HANDLE *DispatchHandle
99 );
100
101 /**
102 Unregisters a General Purpose Input (GPI) service.
103
104 @param This Pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
105 @param DispatchHandle Handle of the service to remove.
106
107 @retval EFI_SUCCESS The dispatch function has been successfully
108 unregistered and the SMI source has been disabled
109 if there are no other registered child dispatch
110 functions for this SMI source.
111 @retval EFI_INVALID_PARAMETER DispatchHandle is invalid.
112
113 **/
114 typedef
115 EFI_STATUS
116 (EFIAPI *EFI_SMM_GPI_UNREGISTER)(
117 IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,
118 IN EFI_HANDLE DispatchHandle
119 );
120
121 //
122 // Interface structure for the SMM GPI SMI Dispatch Protocol
123 //
124 struct _EFI_SMM_GPI_DISPATCH_PROTOCOL {
125 EFI_SMM_GPI_REGISTER Register;
126 EFI_SMM_GPI_UNREGISTER UnRegister;
127
128 //
129 // Denotes the maximum value of inputs that can have handlers attached.
130 //
131 UINTN NumSupportedGpis;
132 };
133
134 extern EFI_GUID gEfiSmmGpiDispatchProtocolGuid;
135
136 #endif
137