]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SmmGpiDispatch2.h
Rename PI SMM definitions which has same name with those of Framework SMM spec but...
[mirror_edk2.git] / MdePkg / Include / Protocol / SmmGpiDispatch2.h
1 /** @file
2 SMM General Purpose Input (GPI) Dispatch2 Protocol as defined in PI 1.1 Specification
3 Volume 4 System Management Mode Core Interface.
4
5 This protocol provides the parent dispatch service for the General Purpose Input
6 (GPI) SMI source generator.
7
8 The EFI_SMM_GPI_DISPATCH2_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 SMI in response to any of these inputs having a true value provided.
11
12 Copyright (c) 2009, Intel Corporation
13 All rights reserved. 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.1.
23
24 **/
25
26 #ifndef _SMM_GPI_DISPATCH2_H_
27 #define _SMM_GPI_DISPATCH2_H_
28
29 #include <Pi/PiSmmCis.h>
30
31 ///
32 /// Note:
33 /// To avoid name conflict between PI and Framework SMM spec, the following names defined
34 /// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.
35 ///
36 /// EFI_SMM_GPI_REGISTER -> EFI_SMM_GPI_REGISTER2
37 /// EFI_SMM_GPI_UNREGISTER -> EFI_SMM_GPI_UNREGISTER2
38 ///
39
40 #define EFI_SMM_GPI_DISPATCH2_PROTOCOL_GUID \
41 { \
42 0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 } \
43 }
44
45 ///
46 /// The dispatch function's context.
47 ///
48 typedef struct {
49 ///
50 /// A bit mask of 64 possible GPIs that can generate an SMI. Bit 0 corresponds to logical
51 /// GPI[0], 1 corresponds to logical GPI[1], and so on.
52 ///
53 UINT64 GpiNum;
54 } EFI_SMM_GPI_REGISTER_CONTEXT;
55
56 typedef struct _EFI_SMM_GPI_DISPATCH2_PROTOCOL EFI_SMM_GPI_DISPATCH2_PROTOCOL;
57
58 /**
59 Registers a child SMI source dispatch function with a parent SMM driver.
60
61 This service registers a function (DispatchFunction) which will be called when an SMI is
62 generated because of one or more of the GPIs specified by RegisterContext. On return,
63 DispatchHandle contains a unique handle which may be used later to unregister the function
64 using UnRegister().
65 The DispatchFunction will be called with Context set to the same value as was passed into
66 this function in RegisterContext and with CommBuffer pointing to another instance of
67 EFI_SMM_GPI_REGISTER_CONTEXT describing the GPIs which actually caused the SMI and
68 CommBufferSize pointing to the size of the structure.
69
70 @param[in] This Pointer to the EFI_SMM_GPI_DISPATCH2_PROTOCOL instance.
71 @param[in] DispatchFunction Function to register for handler when the specified GPI causes an SMI.
72 @param[in] RegisterContext Pointer to the dispatch function's context.
73 The caller fills this context in before calling
74 the register function to indicate to the register
75 function the GPI(s) for which the dispatch function
76 should be invoked.
77 @param[out] DispatchHandle Handle generated by the dispatcher to track the
78 function instance.
79
80 @retval EFI_SUCCESS The dispatch function has been successfully
81 registered and the SMI source has been enabled.
82 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
83 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The GPI input value
84 is not within valid range.
85 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.
86 **/
87 typedef
88 EFI_STATUS
89 (EFIAPI *EFI_SMM_GPI_REGISTER2)(
90 IN CONST EFI_SMM_GPI_DISPATCH2_PROTOCOL *This,
91 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,
92 IN CONST EFI_SMM_GPI_REGISTER_CONTEXT *RegisterContext,
93 OUT EFI_HANDLE *DispatchHandle
94 );
95
96 /**
97 Unregisters a General Purpose Input (GPI) service.
98
99 This service removes the handler associated with DispatchHandle so that it will no longer be
100 called when the GPI triggers an SMI.
101
102 @param[in] This Pointer to the EFI_SMM_GPI_DISPATCH2_PROTOCOL instance.
103 @param[in] DispatchHandle Handle of the service to remove.
104
105 @retval EFI_SUCCESS Handle of the service to remove.
106 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
107 **/
108 typedef
109 EFI_STATUS
110 (EFIAPI *EFI_SMM_GPI_UNREGISTER2)(
111 IN CONST EFI_SMM_GPI_DISPATCH2_PROTOCOL *This,
112 IN EFI_HANDLE DispatchHandle
113 );
114
115 ///
116 /// Interface structure for the SMM GPI SMI Dispatch Protocol
117 ///
118 /// The SMM GPI SMI Dispatch Protocol provides the parent dispatch service
119 /// for the General Purpose Input (GPI) SMI source generator.
120 ///
121 struct _EFI_SMM_GPI_DISPATCH2_PROTOCOL {
122 EFI_SMM_GPI_REGISTER2 Register;
123 EFI_SMM_GPI_UNREGISTER2 UnRegister;
124 ///
125 /// Denotes the maximum value of inputs that can have handlers attached.
126 ///
127 UINTN NumSupportedGpis;
128 };
129
130 extern EFI_GUID gEfiSmmGpiDispatch2ProtocolGuid;
131
132 #endif
133