]>
Commit | Line | Data |
---|---|---|
07c6a47e ED |
1 | /** @file\r |
2 | MM Power Button Dispatch Protocol as defined in PI 1.5 Specification\r | |
3 | Volume 4 Management Mode Core Interface.\r | |
4 | \r | |
5 | This protocol provides the parent dispatch service for the power button MMI source generator.\r | |
6 | \r | |
7 | Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r | |
9344f092 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
07c6a47e ED |
9 | \r |
10 | @par Revision Reference:\r | |
11 | This protocol is from PI Version 1.5.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _MM_POWER_BUTTON_DISPATCH_H_\r | |
16 | #define _MM_POWER_BUTTON_DISPATCH_H_\r | |
17 | \r | |
18 | #include <Pi/PiMmCis.h>\r | |
19 | \r | |
20 | #define EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL_GUID \\r | |
21 | { \\r | |
22 | 0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d } \\r | |
23 | }\r | |
24 | \r | |
25 | ///\r | |
26 | /// Power Button phases.\r | |
27 | ///\r | |
28 | typedef enum {\r | |
29 | EfiPowerButtonEntry,\r | |
30 | EfiPowerButtonExit,\r | |
31 | EfiPowerButtonMax\r | |
32 | } EFI_POWER_BUTTON_PHASE;\r | |
33 | \r | |
34 | ///\r | |
35 | /// The dispatch function's context.\r | |
36 | ///\r | |
37 | typedef struct {\r | |
38 | ///\r | |
39 | /// Designates whether this handler should be invoked upon entry or exit.\r | |
40 | ///\r | |
41 | EFI_POWER_BUTTON_PHASE Phase;\r | |
42 | } EFI_MM_POWER_BUTTON_REGISTER_CONTEXT;\r | |
43 | \r | |
44 | typedef struct _EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL;\r | |
45 | \r | |
46 | /**\r | |
47 | Provides the parent dispatch service for a power button event.\r | |
48 | \r | |
49 | This service registers a function (DispatchFunction) which will be called when an MMI is\r | |
50 | generated because the power button was pressed or released, as specified by RegisterContext.\r | |
51 | On return, DispatchHandle contains a unique handle which may be used later to unregister the\r | |
52 | function using UnRegister().\r | |
53 | The DispatchFunction will be called with Context set to the same value as was passed into\r | |
54 | this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL.\r | |
55 | \r | |
56 | @param[in] This Pointer to the EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL instance.\r | |
57 | @param[in] DispatchFunction Function to register for handler when power button is pressed or released.\r | |
58 | @param[in] RegisterContext Pointer to the dispatch function's context. The caller fills in this context\r | |
59 | before calling the Register() function to indicate to the Register() function\r | |
60 | the power button MMI phase for which the dispatch function should be invoked.\r | |
61 | @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.\r | |
62 | \r | |
63 | @retval EFI_SUCCESS The dispatch function has been successfully\r | |
64 | registered and the MMI source has been enabled.\r | |
65 | @retval EFI_DEVICE_ERROR The driver was unable to enable the MMI source.\r | |
66 | @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The power button input value\r | |
67 | is not within valid range.\r | |
68 | @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this child.\r | |
69 | **/\r | |
70 | typedef\r | |
71 | EFI_STATUS\r | |
72 | (EFIAPI *EFI_MM_POWER_BUTTON_REGISTER)(\r | |
73 | IN CONST EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL *This,\r | |
74 | IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,\r | |
75 | IN EFI_MM_POWER_BUTTON_REGISTER_CONTEXT *RegisterContext,\r | |
76 | OUT EFI_HANDLE *DispatchHandle\r | |
77 | );\r | |
78 | \r | |
79 | /**\r | |
80 | Unregisters a power-button service.\r | |
81 | \r | |
82 | This service removes the handler associated with DispatchHandle so that it will no longer be\r | |
83 | called when the standby button is pressed or released.\r | |
84 | \r | |
85 | @param[in] This Pointer to the EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL instance.\r | |
86 | @param[in] DispatchHandle Handle of the service to remove.\r | |
87 | \r | |
88 | @retval EFI_SUCCESS The service has been successfully removed.\r | |
89 | @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r | |
90 | **/\r | |
91 | typedef\r | |
92 | EFI_STATUS\r | |
93 | (EFIAPI *EFI_MM_POWER_BUTTON_UNREGISTER)(\r | |
94 | IN CONST EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL *This,\r | |
95 | IN EFI_HANDLE DispatchHandle\r | |
96 | );\r | |
97 | \r | |
98 | ///\r | |
99 | /// Interface structure for the MM Power Button Dispatch Protocol.\r | |
100 | ///\r | |
101 | /// This protocol provides the parent dispatch service for the power button MMI source generator.\r | |
102 | ///\r | |
103 | struct _EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL {\r | |
104 | EFI_MM_POWER_BUTTON_REGISTER Register;\r | |
105 | EFI_MM_POWER_BUTTON_UNREGISTER UnRegister;\r | |
106 | };\r | |
107 | \r | |
108 | extern EFI_GUID gEfiMmPowerButtonDispatchProtocolGuid;\r | |
109 | \r | |
110 | #endif\r | |
111 | \r |