]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmGpiDispatch.h
Clarify @pram b in Base.h. Accepted and edited in Qing Huang changes for @retval...
[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
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 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 Indicates to the register
76 function the GPI(s) for which the dispatch function
77 should be invoked.
78 @param DispatchHandle Handle generated by the dispatcher to track the
79 function instance.
80
81 @retval EFI_SUCCESS The dispatch function has been successfully
82 registered and the SMI source has been enabled.
83 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
84 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
85 child.
86 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The GPI input value
87 is not within valid range.
88
89 **/
90 typedef
91 EFI_STATUS
92 (EFIAPI *EFI_SMM_GPI_REGISTER)(
93 IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,
94 IN EFI_SMM_GPI_DISPATCH DispatchFunction,
95 IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext,
96 OUT EFI_HANDLE *DispatchHandle
97 );
98
99 /**
100 Unregisters a General Purpose Input (GPI) service.
101
102 @param This Pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
103 @param DispatchHandle Handle of the service to remove.
104
105 @retval EFI_SUCCESS The dispatch function has been successfully
106 unregistered and the SMI source has been disabled
107 if there are no other registered child dispatch
108 functions for this SMI source.
109 @retval EFI_INVALID_PARAMETER DispatchHandle is invalid.
110
111 **/
112 typedef
113 EFI_STATUS
114 (EFIAPI *EFI_SMM_GPI_UNREGISTER)(
115 IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,
116 IN EFI_HANDLE DispatchHandle
117 );
118
119 //
120 // Interface structure for the SMM GPI SMI Dispatch Protocol
121 //
122 struct _EFI_SMM_GPI_DISPATCH_PROTOCOL {
123 EFI_SMM_GPI_REGISTER Register;
124 EFI_SMM_GPI_UNREGISTER UnRegister;
125
126 ///
127 /// Denotes the maximum value of inputs that can have handlers attached.
128 ///
129 UINTN NumSupportedGpis;
130 };
131
132 extern EFI_GUID gEfiSmmGpiDispatchProtocolGuid;
133
134 #endif
135