Home | History | Annotate | Download | only in Protocol
      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 - 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_POWER_BUTTON_DISPATCH2_H_
     22 #define _SMM_POWER_BUTTON_DISPATCH2_H_
     23 
     24 #include <Pi/PiSmmCis.h>
     25 
     26 #define EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL_GUID \
     27   { \
     28     0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d } \
     29   }
     30 
     31 ///
     32 /// Power Button phases.
     33 ///
     34 typedef enum {
     35   EfiPowerButtonEntry,
     36   EfiPowerButtonExit,
     37   EfiPowerButtonMax
     38 } EFI_POWER_BUTTON_PHASE;
     39 
     40 ///
     41 /// The dispatch function's context.
     42 ///
     43 typedef struct {
     44   ///
     45   /// Designates whether this handler should be invoked upon entry or exit.
     46   ///
     47   EFI_POWER_BUTTON_PHASE  Phase;
     48 } EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT;
     49 
     50 typedef struct _EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL;
     51 
     52 /**
     53   Provides the parent dispatch service for a power button event.
     54 
     55   This service registers a function (DispatchFunction) which will be called when an SMI is
     56   generated because the power button was pressed or released, as specified by RegisterContext.
     57   On return, DispatchHandle contains a unique handle which may be used later to unregister the
     58   function using UnRegister().
     59   The DispatchFunction will be called with Context set to the same value as was passed into
     60   this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL.
     61 
     62   @param[in]  This               Pointer to the EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL instance.
     63   @param[in]  DispatchFunction   Function to register for handler when power button is pressed or released.
     64   @param[in]  RegisterContext    Pointer to the dispatch function's context. The caller fills in this context
     65                                  before calling the Register() function to indicate to the Register() function
     66                                  the power button SMI phase for which the dispatch function should be invoked.
     67   @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance.
     68 
     69   @retval EFI_SUCCESS            The dispatch function has been successfully
     70                                  registered and the SMI source has been enabled.
     71   @retval EFI_DEVICE_ERROR       The driver was unable to enable the SMI source.
     72   @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The power button input value
     73                                  is not within valid range.
     74   @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or SMM) to manage this child.
     75 **/
     76 typedef
     77 EFI_STATUS
     78 (EFIAPI *EFI_SMM_POWER_BUTTON_REGISTER2)(
     79   IN CONST EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL  *This,
     80   IN       EFI_SMM_HANDLER_ENTRY_POINT2             DispatchFunction,
     81   IN       EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT    *RegisterContext,
     82   OUT      EFI_HANDLE                               *DispatchHandle
     83   );
     84 
     85 /**
     86   Unregisters a power-button service.
     87 
     88   This service removes the handler associated with DispatchHandle so that it will no longer be
     89   called when the standby button is pressed or released.
     90 
     91   @param[in] This                Pointer to the EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL instance.
     92   @param[in] DispatchHandle      Handle of the service to remove.
     93 
     94   @retval EFI_SUCCESS            The service has been successfully removed.
     95   @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
     96 **/
     97 typedef
     98 EFI_STATUS
     99 (EFIAPI *EFI_SMM_POWER_BUTTON_UNREGISTER2)(
    100   IN CONST EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL  *This,
    101   IN       EFI_HANDLE                               DispatchHandle
    102   );
    103 
    104 ///
    105 /// Interface structure for the SMM Power Button Dispatch2 Protocol.
    106 ///
    107 /// This protocol provides the parent dispatch service for the power button SMI source generator.
    108 ///
    109 struct _EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL {
    110   EFI_SMM_POWER_BUTTON_REGISTER2    Register;
    111   EFI_SMM_POWER_BUTTON_UNREGISTER2  UnRegister;
    112 };
    113 
    114 extern EFI_GUID gEfiSmmPowerButtonDispatch2ProtocolGuid;
    115 
    116 #endif
    117 
    118