]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmPowerButtonDispatch.h
Minor code enhancement.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmPowerButtonDispatch.h
1 /** @file
2 Provides the parent dispatch service for the power button SMI source generator.
3
4 Copyright (c) 2007 - 2009, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 @par Revision Reference:
14 This Protocol is defined in Framework of EFI SMM Core Interface Spec
15 Version 0.9.
16
17 **/
18
19 #ifndef _EFI_SMM_POWER_BUTTON_DISPATCH_H_
20 #define _EFI_SMM_POWER_BUTTON_DISPATCH_H_
21
22
23 //
24 // Global ID for the Power Button SMI Protocol
25 //
26 #define EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL_GUID \
27 { \
28 0xb709efa0, 0x47a6, 0x4b41, {0xb9, 0x31, 0x12, 0xec, 0xe7, 0xa8, 0xee, 0x56 } \
29 }
30
31 typedef struct _EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL;
32
33 //
34 // Related Definitions
35 //
36 //
37 // Power Button. Example, Use for changing LEDs before ACPI OS is on.
38 // - DXE/BDS Phase
39 // - OS Install Phase
40 //
41 typedef enum {
42 PowerButtonEntry,
43 PowerButtonExit
44 } EFI_POWER_BUTTON_PHASE;
45
46 typedef struct {
47 EFI_POWER_BUTTON_PHASE Phase;
48 } EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT;
49
50 //
51 // Member functions
52 //
53 /**
54 Dispatch function for a Power Button SMI handler.
55
56 @param[in] DispatchHandle Handle of this dispatch function.
57 @param[in] DispatchContext Pointer to the dispatch function's context.
58 The DispatchContext fields are filled in
59 by the dispatching driver prior to
60 invoking this dispatch function.
61
62 **/
63 typedef
64 VOID
65 (EFIAPI *EFI_SMM_POWER_BUTTON_DISPATCH)(
66 IN EFI_HANDLE DispatchHandle,
67 IN EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT *DispatchContext
68 );
69
70 /**
71 Provides the parent dispatch service for a given SMI source generator
72
73 @param[in] This Pointer to the EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
74 @param[in] DispatchFunction Function to install.
75 @param[in] DispatchContext Pointer to the dispatch function's context.
76 Indicates to the register
77 function the Power Button SMI phase for which to invoke the dispatch
78 function.
79 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.
80
81 @retval EFI_SUCCESS The dispatch function has been successfully
82 registered and the SMI source has been enabled.
83 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
84 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
85 child.
86 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The Power Button SMI
87 phase is not within valid range.
88
89 **/
90 typedef
91 EFI_STATUS
92 (EFIAPI *EFI_SMM_POWER_BUTTON_REGISTER)(
93 IN EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL *This,
94 IN EFI_SMM_POWER_BUTTON_DISPATCH DispatchFunction,
95 IN EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT *DispatchContext,
96 OUT EFI_HANDLE *DispatchHandle
97 );
98
99 /**
100 Unregisters a power-button service.
101
102 @param[in] This Pointer to the EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
103 @param[in] DispatchHandle Handle of the service to remove.
104
105 @retval EFI_SUCCESS The dispatch function has been successfully
106 unregistered and the SMI source has been
107 disabled if there are no other registered
108 child dispatch functions for this SMI
109 source.
110 @retval EFI_INVALID_PARAMETER Handle is invalid.
111
112 **/
113 typedef
114 EFI_STATUS
115 (EFIAPI *EFI_SMM_POWER_BUTTON_UNREGISTER)(
116 IN EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL *This,
117 IN EFI_HANDLE DispatchHandle
118 );
119
120 /**
121 @par Protocol Description:
122 Provides the parent dispatch service for the SMM power button SMI source generator.
123
124 **/
125 struct _EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL {
126 ///
127 /// Installs a child service to be dispatched by this protocol.
128 ///
129 EFI_SMM_POWER_BUTTON_REGISTER Register;
130
131 ///
132 /// Removes a child service dispatched by this protocol.
133 ///
134 EFI_SMM_POWER_BUTTON_UNREGISTER UnRegister;
135 };
136
137 extern EFI_GUID gEfiSmmPowerButtonDispatchProtocolGuid;
138
139 #endif