]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/MmGpiDispatch.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / MmGpiDispatch.h
1 /** @file
2 MM General Purpose Input (GPI) Dispatch Protocol as defined in PI 1.5 Specification
3 Volume 4 Management Mode Core Interface.
4
5 This protocol provides the parent dispatch service for the General Purpose Input
6 (GPI) MMI source generator.
7
8 The EFI_MM_GPI_DISPATCH_PROTOCOL provides the ability to install child handlers for the
9 given event types. Several inputs can be enabled. This purpose of this interface is to generate an
10 MMI in response to any of these inputs having a true value provided.
11
12 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
13 SPDX-License-Identifier: BSD-2-Clause-Patent
14
15 @par Revision Reference:
16 This protocol is from PI Version 1.5.
17
18 **/
19
20 #ifndef _MM_GPI_DISPATCH_H_
21 #define _MM_GPI_DISPATCH_H_
22
23 #include <Pi/PiMmCis.h>
24
25 #define EFI_MM_GPI_DISPATCH_PROTOCOL_GUID \
26 { \
27 0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 } \
28 }
29
30 ///
31 /// The dispatch function's context.
32 ///
33 typedef struct {
34 ///
35 /// A number from one of 2^64 possible GPIs that can generate an MMI. A
36 /// 0 corresponds to logical GPI[0]; 1 corresponds to logical GPI[1]; and
37 /// GpiNum of N corresponds to GPI[N], where N can span from 0 to 2^64-1.
38 ///
39 UINT64 GpiNum;
40 } EFI_MM_GPI_REGISTER_CONTEXT;
41
42 typedef struct _EFI_MM_GPI_DISPATCH_PROTOCOL EFI_MM_GPI_DISPATCH_PROTOCOL;
43
44 /**
45 Registers a child MMI source dispatch function with a parent MM driver.
46
47 This service registers a function (DispatchFunction) which will be called when an MMI is
48 generated because of one or more of the GPIs specified by RegisterContext. On return,
49 DispatchHandle contains a unique handle which may be used later to unregister the function
50 using UnRegister().
51 The DispatchFunction will be called with Context set to the same value as was passed into
52 this function in RegisterContext and with CommBuffer pointing to another instance of
53 EFI_MM_GPI_REGISTER_CONTEXT describing the GPIs which actually caused the MMI and
54 CommBufferSize pointing to the size of the structure.
55
56 @param[in] This Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL instance.
57 @param[in] DispatchFunction Function to register for handler when the specified GPI causes an MMI.
58 @param[in] RegisterContext Pointer to the dispatch function's context.
59 The caller fills this context in before calling
60 the register function to indicate to the register
61 function the GPI(s) for which the dispatch function
62 should be invoked.
63 @param[out] DispatchHandle Handle generated by the dispatcher to track the
64 function instance.
65
66 @retval EFI_SUCCESS The dispatch function has been successfully
67 registered and the MMI source has been enabled.
68 @retval EFI_DEVICE_ERROR The driver was unable to enable the MMI source.
69 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The GPI input value
70 is not within valid range.
71 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this child.
72 **/
73 typedef
74 EFI_STATUS
75 (EFIAPI *EFI_MM_GPI_REGISTER)(
76 IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL *This,
77 IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,
78 IN CONST EFI_MM_GPI_REGISTER_CONTEXT *RegisterContext,
79 OUT EFI_HANDLE *DispatchHandle
80 );
81
82 /**
83 Unregisters a General Purpose Input (GPI) service.
84
85 This service removes the handler associated with DispatchHandle so that it will no longer be
86 called when the GPI triggers an MMI.
87
88 @param[in] This Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL instance.
89 @param[in] DispatchHandle Handle of the service to remove.
90
91 @retval EFI_SUCCESS Handle of the service to remove.
92 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
93 **/
94 typedef
95 EFI_STATUS
96 (EFIAPI *EFI_MM_GPI_UNREGISTER)(
97 IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL *This,
98 IN EFI_HANDLE DispatchHandle
99 );
100
101 ///
102 /// Interface structure for the MM GPI MMI Dispatch Protocol
103 ///
104 /// The MM GPI MMI Dispatch Protocol provides the parent dispatch service
105 /// for the General Purpose Input (GPI) MMI source generator.
106 ///
107 struct _EFI_MM_GPI_DISPATCH_PROTOCOL {
108 EFI_MM_GPI_REGISTER Register;
109 EFI_MM_GPI_UNREGISTER UnRegister;
110 ///
111 /// Denotes the maximum value of inputs that can have handlers attached.
112 ///
113 UINTN NumSupportedGpis;
114 };
115
116 extern EFI_GUID gEfiMmGpiDispatchProtocolGuid;
117
118 #endif
119