]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkPkg/Include/Protocol/SmmGpiDispatch.h
Minor code enhancement.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmGpiDispatch.h
CommitLineData
79964ac8 1/** @file\r
b530f741 2 This file declares Smm Gpi Smi Child Protocol.\r
3 \r
4 The EFI_SMM_GPI_DISPATCH_PROTOCOL is defined in Framework of EFI SMM Core Interface Spec\r
5 Version 0.9. It provides the ability to install child handlers for the given event types.\r
6 Several inputs can be enabled. This purpose of this interface is to generate an\r
8411f1c0 7 SMI in response to any of these inputs having a true value provided.\r
8 \r
b530f741 9 Copyright (c) 2007 - 2009, Intel Corporation\r
79964ac8 10 All rights reserved. This program and the accompanying materials\r
11 are licensed and made available under the terms and conditions of the BSD License\r
12 which accompanies this distribution. The full text of the license may be found at\r
13 http://opensource.org/licenses/bsd-license.php\r
14\r
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17\r
79964ac8 18**/\r
19\r
b530f741 20#ifndef _SMM_GPI_DISPATCH_H_\r
21#define _SMM_GPI_DISPATCH_H_\r
79964ac8 22\r
b80fbe85 23\r
79964ac8 24//\r
25// Global ID for the GPI SMI Protocol\r
26//\r
27#define EFI_SMM_GPI_DISPATCH_PROTOCOL_GUID \\r
28 { \\r
29 0xe0744b81, 0x9513, 0x49cd, {0x8c, 0xea, 0xe9, 0x24, 0x5e, 0x70, 0x39, 0xda } \\r
30 }\r
31\r
32typedef struct _EFI_SMM_GPI_DISPATCH_PROTOCOL EFI_SMM_GPI_DISPATCH_PROTOCOL;\r
33\r
34//\r
35// Related Definitions\r
36//\r
b530f741 37\r
79964ac8 38//\r
5259c97d 39// GpiMask is a bit mask of 32 possible general purpose inputs that can generate \r
40// an SMI. Bit 0 corresponds to logical GPI[0], 1 corresponds to logical GPI[1], and so on.\r
79964ac8 41//\r
42// The logical GPI index to physical pin on device is described by the GPI device name\r
43// found on the same handle as the GpiSmi child dispatch protocol. The GPI device name\r
44// is defined as protocol with a GUID name and NULL protocol pointer.\r
45//\r
46typedef struct {\r
47 UINTN GpiNum;\r
48} EFI_SMM_GPI_DISPATCH_CONTEXT;\r
49\r
50//\r
51// Member functions\r
52//\r
b530f741 53\r
79964ac8 54/**\r
55 Dispatch function for a GPI SMI handler.\r
56\r
57 @param DispatchHandle Handle of this dispatch function.\r
58 @param DispatchContext Pointer to the dispatch function's context.\r
59 The DispatchContext fields are filled in by the dispatching driver prior to\r
60 invoking this dispatch function.\r
79964ac8 61**/\r
62typedef\r
63VOID\r
69686d56 64(EFIAPI *EFI_SMM_GPI_DISPATCH)(\r
79964ac8 65 IN EFI_HANDLE DispatchHandle,\r
66 IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext\r
67 );\r
68\r
69/**\r
70 Register a child SMI source dispatch function with a parent SMM driver\r
71\r
700a7869 72 @param This Pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.\r
73 @param DispatchFunction Function to install.\r
79964ac8 74 @param DispatchContext Pointer to the dispatch function's context.\r
5259c97d 75 Indicates to the register\r
79964ac8 76 function the GPI(s) for which the dispatch function\r
77 should be invoked.\r
700a7869 78 @param DispatchHandle Handle generated by the dispatcher to track the \r
79 function instance.\r
79964ac8 80\r
81 @retval EFI_SUCCESS The dispatch function has been successfully\r
82 registered and the SMI source has been enabled.\r
83 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.\r
84 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this\r
85 child.\r
86 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The GPI input value\r
87 is not within valid range.\r
88\r
89**/\r
90typedef\r
91EFI_STATUS\r
69686d56 92(EFIAPI *EFI_SMM_GPI_REGISTER)(\r
700a7869 93 IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,\r
94 IN EFI_SMM_GPI_DISPATCH DispatchFunction,\r
95 IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext,\r
96 OUT EFI_HANDLE *DispatchHandle\r
79964ac8 97 );\r
98\r
99/**\r
700a7869 100 Unregisters a General Purpose Input (GPI) service.\r
79964ac8 101\r
700a7869 102 @param This Pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.\r
103 @param DispatchHandle Handle of the service to remove.\r
79964ac8 104\r
105 @retval EFI_SUCCESS The dispatch function has been successfully\r
106 unregistered and the SMI source has been disabled\r
107 if there are no other registered child dispatch\r
108 functions for this SMI source.\r
ec87b52a 109 @retval EFI_INVALID_PARAMETER DispatchHandle is invalid.\r
79964ac8 110\r
111**/\r
112typedef\r
113EFI_STATUS\r
69686d56 114(EFIAPI *EFI_SMM_GPI_UNREGISTER)(\r
700a7869 115 IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,\r
116 IN EFI_HANDLE DispatchHandle\r
79964ac8 117 );\r
118\r
119//\r
120// Interface structure for the SMM GPI SMI Dispatch Protocol\r
121//\r
79964ac8 122struct _EFI_SMM_GPI_DISPATCH_PROTOCOL {\r
123 EFI_SMM_GPI_REGISTER Register;\r
124 EFI_SMM_GPI_UNREGISTER UnRegister;\r
b530f741 125\r
f391357d 126 ///\r
127 /// Denotes the maximum value of inputs that can have handlers attached.\r
128 ///\r
79964ac8 129 UINTN NumSupportedGpis;\r
130};\r
131\r
132extern EFI_GUID gEfiSmmGpiDispatchProtocolGuid;\r
133\r
134#endif\r
b530f741 135\r