]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SmmPowerButtonDispatch2.h
Rename PI SMM definitions which has same name with those of Framework SMM spec but...
[mirror_edk2.git] / MdePkg / Include / Protocol / SmmPowerButtonDispatch2.h
CommitLineData
55b19d7f 1/** @file\r
2 SMM Power Button Dispatch2 Protocol as defined in PI 1.1 Specification\r
3 Volume 4 System Management Mode Core Interface.\r
4\r
5 This protocol provides the parent dispatch service for the power button SMI source generator.\r
6\r
7 Copyright (c) 2009, Intel Corporation\r
8 All rights reserved. This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16 @par Revision Reference:\r
17 This protocol is from PI Version 1.1.\r
18\r
19**/\r
20\r
21#ifndef _SMM_POWER_BUTTON_DISPATCH2_H_\r
22#define _SMM_POWER_BUTTON_DISPATCH2_H_\r
23\r
24#include <Pi/PiSmmCis.h>\r
25\r
a2bb197e 26///\r
27/// Note:\r
28/// To avoid name conflict between PI and Framework SMM spec, the following names defined\r
29/// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.\r
30///\r
31/// EFI_SMM_POWER_BUTTON_REGISTER -> EFI_SMM_POWER_BUTTON_REGISTER2\r
32/// EFI_SMM_POWER_BUTTON_UNREGISTER -> EFI_SMM_POWER_BUTTON_UNREGISTER2\r
33///\r
34\r
55b19d7f 35#define EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL_GUID \\r
36 { \\r
37 0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d } \\r
38 }\r
39\r
40///\r
41/// Power Button phases.\r
42///\r
43typedef enum {\r
44 EfiPowerButtonEntry,\r
45 EfiPowerButtonExit,\r
46 EfiPowerButtonMax\r
47} EFI_POWER_BUTTON_PHASE;\r
48\r
49///\r
50/// The dispatch function's context.\r
51///\r
52typedef struct {\r
53 ///\r
54 /// Designates whether this handler should be invoked upon entry or exit.\r
55 ///\r
56 EFI_POWER_BUTTON_PHASE Phase;\r
57} EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT;\r
58\r
59typedef struct _EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL;\r
60\r
61/**\r
62 Provides the parent dispatch service for a power button event.\r
63\r
64 This service registers a function (DispatchFunction) which will be called when an SMI is \r
65 generated because the power button was pressed or released, as specified by RegisterContext. \r
66 On return, DispatchHandle contains a unique handle which may be used later to unregister the \r
67 function using UnRegister().\r
68 The DispatchFunction will be called with Context set to the same value as was passed into \r
69 this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL.\r
70\r
71 @param[in] This Pointer to the EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL instance.\r
72 @param[in] DispatchFunction Function to register for handler when power button is pressed or released.\r
fa3e7746 73 @param[in] RegisterContext Pointer to the dispatch function's context. The caller fills in this context\r
55b19d7f 74 before calling the Register() function to indicate to the Register() function\r
75 the power button SMI phase for which the dispatch function should be invoked.\r
76 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance. \r
77\r
78 @retval EFI_SUCCESS The dispatch function has been successfully\r
79 registered and the SMI source has been enabled.\r
80 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.\r
81 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The power button input value\r
82 is not within valid range.\r
83 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.\r
84**/\r
85typedef\r
86EFI_STATUS\r
a2bb197e 87(EFIAPI *EFI_SMM_POWER_BUTTON_REGISTER2)(\r
55b19d7f 88 IN CONST EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL *This,\r
89 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,\r
90 IN EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT *RegisterContext,\r
91 OUT EFI_HANDLE *DispatchHandle\r
92 );\r
93\r
94/**\r
95 Unregisters a power-button service.\r
96\r
97 This service removes the handler associated with DispatchHandle so that it will no longer be \r
98 called when the standby button is pressed or released. \r
99\r
100 @param[in] This Pointer to the EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL instance.\r
101 @param[in] DispatchHandle Handle of the service to remove.\r
102\r
103 @retval EFI_SUCCESS The service has been successfully removed.\r
104 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
105**/\r
106typedef\r
107EFI_STATUS\r
a2bb197e 108(EFIAPI *EFI_SMM_POWER_BUTTON_UNREGISTER2)(\r
55b19d7f 109 IN CONST EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL *This,\r
110 IN EFI_HANDLE DispatchHandle\r
111 );\r
112\r
113///\r
114/// Interface structure for the SMM Power Button Dispatch2 Protocol.\r
115///\r
116/// This protocol provides the parent dispatch service for the power button SMI source generator.\r
117///\r
118struct _EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL {\r
a2bb197e 119 EFI_SMM_POWER_BUTTON_REGISTER2 Register;\r
120 EFI_SMM_POWER_BUTTON_UNREGISTER2 UnRegister;\r
55b19d7f 121};\r
122\r
123extern EFI_GUID gEfiSmmPowerButtonDispatch2ProtocolGuid;\r
124\r
125#endif\r
126\r