SmmPowerButtonDispatch.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /** @file
  2. Provides the parent dispatch service for the power button SMI source generator.
  3. Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. @par Revision Reference:
  6. This Protocol is defined in Framework of EFI SMM Core Interface Spec
  7. Version 0.9.
  8. **/
  9. #ifndef _EFI_SMM_POWER_BUTTON_DISPATCH_H_
  10. #define _EFI_SMM_POWER_BUTTON_DISPATCH_H_
  11. //
  12. // Global ID for the Power Button SMI Protocol
  13. //
  14. #define EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL_GUID \
  15. { \
  16. 0xb709efa0, 0x47a6, 0x4b41, {0xb9, 0x31, 0x12, 0xec, 0xe7, 0xa8, 0xee, 0x56 } \
  17. }
  18. typedef struct _EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL;
  19. //
  20. // Related Definitions
  21. //
  22. //
  23. // Power Button. Example, Use for changing LEDs before ACPI OS is on.
  24. // - DXE/BDS Phase
  25. // - OS Install Phase
  26. //
  27. typedef enum {
  28. PowerButtonEntry,
  29. PowerButtonExit
  30. } EFI_POWER_BUTTON_PHASE;
  31. typedef struct {
  32. EFI_POWER_BUTTON_PHASE Phase;
  33. } EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT;
  34. //
  35. // Member functions
  36. //
  37. /**
  38. Dispatch function for a Power Button SMI handler.
  39. @param[in] DispatchHandle The handle of this dispatch function.
  40. @param[in] DispatchContext The pointer to the dispatch function's context.
  41. The DispatchContext fields are filled in
  42. by the dispatching driver prior to
  43. invoking this dispatch function.
  44. **/
  45. typedef
  46. VOID
  47. (EFIAPI *EFI_SMM_POWER_BUTTON_DISPATCH)(
  48. IN EFI_HANDLE DispatchHandle,
  49. IN EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT *DispatchContext
  50. );
  51. /**
  52. Provides the parent dispatch service for a given SMI source generator
  53. @param[in] This The pointer to the
  54. EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
  55. @param[in] DispatchFunction The function to install.
  56. @param[in] DispatchContext The pointer to the dispatch function's context.
  57. Indicates to the register
  58. function the Power Button SMI phase for which
  59. to invoke the dispatch function.
  60. @param[out] DispatchHandle Handle generated by the dispatcher to track
  61. the function instance.
  62. @retval EFI_SUCCESS The dispatch function has been successfully
  63. registered and the SMI source has been enabled.
  64. @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
  65. @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
  66. child.
  67. @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The Power Button SMI
  68. phase is not within valid range.
  69. **/
  70. typedef
  71. EFI_STATUS
  72. (EFIAPI *EFI_SMM_POWER_BUTTON_REGISTER)(
  73. IN EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL *This,
  74. IN EFI_SMM_POWER_BUTTON_DISPATCH DispatchFunction,
  75. IN EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT *DispatchContext,
  76. OUT EFI_HANDLE *DispatchHandle
  77. );
  78. /**
  79. Unregisters a power-button service.
  80. @param[in] This The pointer to the EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
  81. @param[in] DispatchHandle The handle of the service to remove.
  82. @retval EFI_SUCCESS The dispatch function has been successfully
  83. unregistered, and the SMI source has been
  84. disabled, if there are no other registered
  85. child dispatch functions for this SMI
  86. source.
  87. @retval EFI_INVALID_PARAMETER The handle is invalid.
  88. **/
  89. typedef
  90. EFI_STATUS
  91. (EFIAPI *EFI_SMM_POWER_BUTTON_UNREGISTER)(
  92. IN EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL *This,
  93. IN EFI_HANDLE DispatchHandle
  94. );
  95. /**
  96. @par Protocol Description:
  97. Provides the parent dispatch service for the SMM power button SMI source generator.
  98. **/
  99. struct _EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL {
  100. ///
  101. /// Installs a child service to be dispatched by this protocol.
  102. ///
  103. EFI_SMM_POWER_BUTTON_REGISTER Register;
  104. ///
  105. /// Removes a child service dispatched by this protocol.
  106. ///
  107. EFI_SMM_POWER_BUTTON_UNREGISTER UnRegister;
  108. };
  109. extern EFI_GUID gEfiSmmPowerButtonDispatchProtocolGuid;
  110. #endif