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