]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SmmGpiDispatch2.h
MdePkg: Add UEFI2.5 EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL definitions
[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 - 2010, 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.1.
23
24 **/
25
26 #ifndef _SMM_GPI_DISPATCH2_H_
27 #define _SMM_GPI_DISPATCH2_H_
28
29 #include <Pi/PiSmmCis.h>
30
31 #define EFI_SMM_GPI_DISPATCH2_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 bit mask of 64 possible GPIs that can generate an SMI. Bit 0 corresponds to logical
42 /// GPI[0], 1 corresponds to logical GPI[1], and so on.
43 ///
44 UINT64 GpiNum;
45 } EFI_SMM_GPI_REGISTER_CONTEXT;
46
47 typedef struct _EFI_SMM_GPI_DISPATCH2_PROTOCOL EFI_SMM_GPI_DISPATCH2_PROTOCOL;
48
49 /**
50 Registers a child SMI source dispatch function with a parent SMM driver.
51
52 This service registers a function (DispatchFunction) which will be called when an SMI is
53 generated because of one or more of the GPIs specified by RegisterContext. On return,
54 DispatchHandle contains a unique handle which may be used later to unregister the function
55 using UnRegister().
56 The DispatchFunction will be called with Context set to the same value as was passed into
57 this function in RegisterContext and with CommBuffer pointing to another instance of
58 EFI_SMM_GPI_REGISTER_CONTEXT describing the GPIs which actually caused the SMI and
59 CommBufferSize pointing to the size of the structure.
60
61 @param[in] This Pointer to the EFI_SMM_GPI_DISPATCH2_PROTOCOL instance.
62 @param[in] DispatchFunction Function to register for handler when the specified GPI causes an SMI.
63 @param[in] RegisterContext Pointer to the dispatch function's context.
64 The caller fills this context in before calling
65 the register function to indicate to the register
66 function the GPI(s) for which the dispatch function
67 should be invoked.
68 @param[out] DispatchHandle Handle generated by the dispatcher to track the
69 function instance.
70
71 @retval EFI_SUCCESS The dispatch function has been successfully
72 registered and the SMI source has been enabled.
73 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
74 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The GPI input value
75 is not within valid range.
76 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.
77 **/
78 typedef
79 EFI_STATUS
80 (EFIAPI *EFI_SMM_GPI_REGISTER2)(
81 IN CONST EFI_SMM_GPI_DISPATCH2_PROTOCOL *This,
82 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,
83 IN CONST EFI_SMM_GPI_REGISTER_CONTEXT *RegisterContext,
84 OUT EFI_HANDLE *DispatchHandle
85 );
86
87 /**
88 Unregisters a General Purpose Input (GPI) service.
89
90 This service removes the handler associated with DispatchHandle so that it will no longer be
91 called when the GPI triggers an SMI.
92
93 @param[in] This Pointer to the EFI_SMM_GPI_DISPATCH2_PROTOCOL instance.
94 @param[in] DispatchHandle Handle of the service to remove.
95
96 @retval EFI_SUCCESS Handle of the service to remove.
97 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
98 **/
99 typedef
100 EFI_STATUS
101 (EFIAPI *EFI_SMM_GPI_UNREGISTER2)(
102 IN CONST EFI_SMM_GPI_DISPATCH2_PROTOCOL *This,
103 IN EFI_HANDLE DispatchHandle
104 );
105
106 ///
107 /// Interface structure for the SMM GPI SMI Dispatch Protocol
108 ///
109 /// The SMM GPI SMI Dispatch Protocol provides the parent dispatch service
110 /// for the General Purpose Input (GPI) SMI source generator.
111 ///
112 struct _EFI_SMM_GPI_DISPATCH2_PROTOCOL {
113 EFI_SMM_GPI_REGISTER2 Register;
114 EFI_SMM_GPI_UNREGISTER2 UnRegister;
115 ///
116 /// Denotes the maximum value of inputs that can have handlers attached.
117 ///
118 UINTN NumSupportedGpis;
119 };
120
121 extern EFI_GUID gEfiSmmGpiDispatch2ProtocolGuid;
122
123 #endif
124