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