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