1 /** @file
2   SMM Standby 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 standby button SMI source generator.
6 
7   Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
8   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_STANDBY_BUTTON_DISPATCH2_H_
22 #define _SMM_STANDBY_BUTTON_DISPATCH2_H_
23 
24 #include <Pi/PiSmmCis.h>
25 
26 #define EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL_GUID \
27   { \
28     0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b } \
29   }
30 
31 ///
32 /// Standby Button phases
33 ///
34 typedef enum {
35   EfiStandbyButtonEntry,
36   EfiStandbyButtonExit,
37   EfiStandbyButtonMax
38 } EFI_STANDBY_BUTTON_PHASE;
39 
40 ///
41 /// The dispatch function's context.
42 ///
43 typedef struct {
44   ///
45   /// Describes whether the child handler should be invoked upon the entry to the button
46   /// activation or upon exit.
47   ///
48   EFI_STANDBY_BUTTON_PHASE  Phase;
49 } EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT;
50 
51 typedef struct _EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL;
52 
53 /**
54   Provides the parent dispatch service for a standby button event.
55 
56   This service registers a function (DispatchFunction) which will be called when an SMI is
57   generated because the standby button was pressed or released, as specified by
58   RegisterContext. On return, DispatchHandle contains a unique handle which may be used
59   later to unregister the function using UnRegister().
60   The DispatchFunction will be called with Context set to the same value as was passed into
61   this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL.
62 
63   @param[in]  This               Pointer to the EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL instance.
64   @param[in]  DispatchFunction   Function to register for handler when the standby button is pressed or released.
65   @param[in]  RegisterContext    Pointer to the dispatch function's context. The caller fills in this context
66                                  before calling the register function to indicate to the register function the
67                                  standby button SMI source for which the dispatch function should be invoked.
68   @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance.
69 
70   @retval EFI_SUCCESS            The dispatch function has been successfully
71                                  registered and the SMI source has been enabled.
72   @retval EFI_DEVICE_ERROR       The driver was unable to enable the SMI source.
73   @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The standby button input value
74                                  is not within valid range.
75   @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or SMM) to manage this child.
76 **/
77 typedef
78 EFI_STATUS
79 (EFIAPI *EFI_SMM_STANDBY_BUTTON_REGISTER2)(
80   IN CONST EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL  *This,
81   IN       EFI_SMM_HANDLER_ENTRY_POINT2               DispatchFunction,
82   IN       EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT    *RegisterContext,
83   OUT      EFI_HANDLE                                 *DispatchHandle
84   );
85 
86 /**
87   Unregisters a child SMI source dispatch function with a parent SMM driver.
88 
89   This service removes the handler associated with DispatchHandle so that it will no longer be
90   called when the standby button is pressed or released.
91 
92   @param[in] This                Pointer to the EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL instance.
93   @param[in] DispatchHandle      Handle of the service to remove.
94 
95   @retval EFI_SUCCESS            The service has been successfully removed.
96   @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
97 **/
98 typedef
99 EFI_STATUS
100 (EFIAPI *EFI_SMM_STANDBY_BUTTON_UNREGISTER2)(
101   IN CONST EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL  *This,
102   IN       EFI_HANDLE                                 DispatchHandle
103   );
104 
105 ///
106 /// Interface structure for the SMM Standby Button Dispatch2 Protocol.
107 ///
108 /// This protocol provides the parent dispatch service for the standby
109 /// button SMI source generator.
110 ///
111 struct _EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL {
112   EFI_SMM_STANDBY_BUTTON_REGISTER2    Register;
113   EFI_SMM_STANDBY_BUTTON_UNREGISTER2  UnRegister;
114 };
115 
116 extern EFI_GUID gEfiSmmStandbyButtonDispatch2ProtocolGuid;
117 
118 #endif
119 
120