]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmGpiDispatch.h
8acd6c5817d3940592983d95fec181da5e4db718
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmGpiDispatch.h
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 - 2018, Intel Corporation. All rights reserved.<BR>
10 SPDX-License-Identifier: BSD-2-Clause-Patent
11
12 **/
13
14 #ifndef _SMM_GPI_DISPATCH_H_
15 #define _SMM_GPI_DISPATCH_H_
16
17
18 //
19 // Global ID for the GPI SMI Protocol
20 //
21 #define EFI_SMM_GPI_DISPATCH_PROTOCOL_GUID \
22 { \
23 0xe0744b81, 0x9513, 0x49cd, {0x8c, 0xea, 0xe9, 0x24, 0x5e, 0x70, 0x39, 0xda } \
24 }
25
26 typedef struct _EFI_SMM_GPI_DISPATCH_PROTOCOL EFI_SMM_GPI_DISPATCH_PROTOCOL;
27
28 //
29 // Related Definitions
30 //
31
32 //
33 // GpiMask is a bit mask of 32 possible general purpose inputs that can generate
34 // an SMI. Bit 0 corresponds to logical GPI[0], 1 corresponds to logical GPI[1], and so on.
35 //
36 // The logical GPI index to physical pin on device is described by the GPI device name
37 // found on the same handle as the GpiSmi child dispatch protocol. The GPI device name
38 // is defined as protocol with a GUID name and NULL protocol pointer.
39 //
40 typedef struct {
41 UINTN GpiNum;
42 } EFI_SMM_GPI_DISPATCH_CONTEXT;
43
44 //
45 // Member functions
46 //
47
48 /**
49 Dispatch function for a GPI SMI handler.
50
51 @param DispatchHandle The handle of this dispatch function.
52 @param DispatchContext The pointer to the dispatch function's context.
53 The DispatchContext fields are filled in by the
54 dispatching driver prior to invoking this dispatch
55 function.
56 **/
57 typedef
58 VOID
59 (EFIAPI *EFI_SMM_GPI_DISPATCH)(
60 IN EFI_HANDLE DispatchHandle,
61 IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext
62 );
63
64 /**
65 Register a child SMI source dispatch function with a parent SMM driver
66
67 @param This The pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
68 @param DispatchFunction Function to install.
69 @param DispatchContext The pointer to the dispatch function's context.
70 Indicates to the register
71 function the GPI(s) for which the dispatch function
72 should be invoked.
73 @param DispatchHandle The handle generated by the dispatcher to track the
74 function instance.
75
76 @retval EFI_SUCCESS The dispatch function has been successfully
77 registered, and the SMI source has been enabled.
78 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
79 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
80 child.
81 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The GPI input value
82 is not within valid range.
83
84 **/
85 typedef
86 EFI_STATUS
87 (EFIAPI *EFI_SMM_GPI_REGISTER)(
88 IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,
89 IN EFI_SMM_GPI_DISPATCH DispatchFunction,
90 IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext,
91 OUT EFI_HANDLE *DispatchHandle
92 );
93
94 /**
95 Unregisters a General Purpose Input (GPI) service.
96
97 @param This The pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
98 @param DispatchHandle The handle of the service to remove.
99
100 @retval EFI_SUCCESS The dispatch function has been successfully
101 unregistered, and the SMI source has been disabled,
102 if there are no other registered child dispatch
103 functions for this SMI source.
104 @retval EFI_INVALID_PARAMETER DispatchHandle is invalid.
105
106 **/
107 typedef
108 EFI_STATUS
109 (EFIAPI *EFI_SMM_GPI_UNREGISTER)(
110 IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,
111 IN EFI_HANDLE DispatchHandle
112 );
113
114 //
115 // Interface structure for the SMM GPI SMI Dispatch Protocol
116 //
117 struct _EFI_SMM_GPI_DISPATCH_PROTOCOL {
118 EFI_SMM_GPI_REGISTER Register;
119 EFI_SMM_GPI_UNREGISTER UnRegister;
120
121 ///
122 /// Denotes the maximum value of inputs that can have handlers attached.
123 ///
124 UINTN NumSupportedGpis;
125 };
126
127 extern EFI_GUID gEfiSmmGpiDispatchProtocolGuid;
128
129 #endif
130