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 - 2015, 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 number from one of 2^64 possible GPIs that can generate an SMI. 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_SMM_GPI_REGISTER_CONTEXT; 47 48 typedef struct _EFI_SMM_GPI_DISPATCH2_PROTOCOL EFI_SMM_GPI_DISPATCH2_PROTOCOL; 49 50 /** 51 Registers a child SMI source dispatch function with a parent SMM driver. 52 53 This service registers a function (DispatchFunction) which will be called when an SMI 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_SMM_GPI_REGISTER_CONTEXT describing the GPIs which actually caused the SMI and 60 CommBufferSize pointing to the size of the structure. 61 62 @param[in] This Pointer to the EFI_SMM_GPI_DISPATCH2_PROTOCOL instance. 63 @param[in] DispatchFunction Function to register for handler when the specified GPI causes an SMI. 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 SMI source has been enabled. 74 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI 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 SMM) to manage this child. 78 **/ 79 typedef 80 EFI_STATUS 81 (EFIAPI *EFI_SMM_GPI_REGISTER2)( 82 IN CONST EFI_SMM_GPI_DISPATCH2_PROTOCOL *This, 83 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction, 84 IN CONST EFI_SMM_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 SMI. 93 94 @param[in] This Pointer to the EFI_SMM_GPI_DISPATCH2_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_SMM_GPI_UNREGISTER2)( 103 IN CONST EFI_SMM_GPI_DISPATCH2_PROTOCOL *This, 104 IN EFI_HANDLE DispatchHandle 105 ); 106 107 /// 108 /// Interface structure for the SMM GPI SMI Dispatch Protocol 109 /// 110 /// The SMM GPI SMI Dispatch Protocol provides the parent dispatch service 111 /// for the General Purpose Input (GPI) SMI source generator. 112 /// 113 struct _EFI_SMM_GPI_DISPATCH2_PROTOCOL { 114 EFI_SMM_GPI_REGISTER2 Register; 115 EFI_SMM_GPI_UNREGISTER2 UnRegister; 116 /// 117 /// Denotes the maximum value of inputs that can have handlers attached. 118 /// 119 UINTN NumSupportedGpis; 120 }; 121 122 extern EFI_GUID gEfiSmmGpiDispatch2ProtocolGuid; 123 124 #endif 125 126