]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/MmGpiDispatch.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[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 This program and the accompanying materials
14 are licensed and made available under the terms and conditions of the BSD License
15 which accompanies this distribution. The full text of the license may be found at
16 http://opensource.org/licenses/bsd-license.php
17
18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
19 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20
21 @par Revision Reference:
22 This protocol is from PI Version 1.5.
23
24 **/
25
26 #ifndef _MM_GPI_DISPATCH_H_
27 #define _MM_GPI_DISPATCH_H_
28
29 #include <Pi/PiMmCis.h>
30
31 #define EFI_MM_GPI_DISPATCH_PROTOCOL_GUID \
32 { \
33 0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 } \
34 }
35
36 ///
37 /// The dispatch function's context.
38 ///
39 typedef struct {
40 ///
41 /// A number from one of 2^64 possible GPIs that can generate an MMI. A
42 /// 0 corresponds to logical GPI[0]; 1 corresponds to logical GPI[1]; and
43 /// GpiNum of N corresponds to GPI[N], where N can span from 0 to 2^64-1.
44 ///
45 UINT64 GpiNum;
46 } EFI_MM_GPI_REGISTER_CONTEXT;
47
48 typedef struct _EFI_MM_GPI_DISPATCH_PROTOCOL EFI_MM_GPI_DISPATCH_PROTOCOL;
49
50 /**
51 Registers a child MMI source dispatch function with a parent MM driver.
52
53 This service registers a function (DispatchFunction) which will be called when an MMI is
54 generated because of one or more of the GPIs specified by RegisterContext. On return,
55 DispatchHandle contains a unique handle which may be used later to unregister the function
56 using UnRegister().
57 The DispatchFunction will be called with Context set to the same value as was passed into
58 this function in RegisterContext and with CommBuffer pointing to another instance of
59 EFI_MM_GPI_REGISTER_CONTEXT describing the GPIs which actually caused the MMI and
60 CommBufferSize pointing to the size of the structure.
61
62 @param[in] This Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL instance.
63 @param[in] DispatchFunction Function to register for handler when the specified GPI causes an MMI.
64 @param[in] RegisterContext Pointer to the dispatch function's context.
65 The caller fills this context in before calling
66 the register function to indicate to the register
67 function the GPI(s) for which the dispatch function
68 should be invoked.
69 @param[out] DispatchHandle Handle generated by the dispatcher to track the
70 function instance.
71
72 @retval EFI_SUCCESS The dispatch function has been successfully
73 registered and the MMI source has been enabled.
74 @retval EFI_DEVICE_ERROR The driver was unable to enable the MMI source.
75 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The GPI input value
76 is not within valid range.
77 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this child.
78 **/
79 typedef
80 EFI_STATUS
81 (EFIAPI *EFI_MM_GPI_REGISTER)(
82 IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL *This,
83 IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,
84 IN CONST EFI_MM_GPI_REGISTER_CONTEXT *RegisterContext,
85 OUT EFI_HANDLE *DispatchHandle
86 );
87
88 /**
89 Unregisters a General Purpose Input (GPI) service.
90
91 This service removes the handler associated with DispatchHandle so that it will no longer be
92 called when the GPI triggers an MMI.
93
94 @param[in] This Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL instance.
95 @param[in] DispatchHandle Handle of the service to remove.
96
97 @retval EFI_SUCCESS Handle of the service to remove.
98 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
99 **/
100 typedef
101 EFI_STATUS
102 (EFIAPI *EFI_MM_GPI_UNREGISTER)(
103 IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL *This,
104 IN EFI_HANDLE DispatchHandle
105 );
106
107 ///
108 /// Interface structure for the MM GPI MMI Dispatch Protocol
109 ///
110 /// The MM GPI MMI Dispatch Protocol provides the parent dispatch service
111 /// for the General Purpose Input (GPI) MMI source generator.
112 ///
113 struct _EFI_MM_GPI_DISPATCH_PROTOCOL {
114 EFI_MM_GPI_REGISTER Register;
115 EFI_MM_GPI_UNREGISTER UnRegister;
116 ///
117 /// Denotes the maximum value of inputs that can have handlers attached.
118 ///
119 UINTN NumSupportedGpis;
120 };
121
122 extern EFI_GUID gEfiMmGpiDispatchProtocolGuid;
123
124 #endif
125