SmmSxDispatch.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /** @file
  2. Provides the parent dispatch service for a given Sx-state 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_SX_DISPATCH_H_
  10. #define _EFI_SMM_SX_DISPATCH_H_
  11. //
  12. // Share some common definitions with PI SMM
  13. //
  14. #include <Protocol/SmmSxDispatch2.h>
  15. //
  16. // Global ID for the Sx SMI Protocol
  17. //
  18. #define EFI_SMM_SX_DISPATCH_PROTOCOL_GUID \
  19. { \
  20. 0x14fc52be, 0x1dc, 0x426c, {0x91, 0xae, 0xa2, 0x3c, 0x3e, 0x22, 0xa, 0xe8 } \
  21. }
  22. typedef struct _EFI_SMM_SX_DISPATCH_PROTOCOL EFI_SMM_SX_DISPATCH_PROTOCOL;
  23. typedef struct {
  24. EFI_SLEEP_TYPE Type;
  25. EFI_SLEEP_PHASE Phase;
  26. } EFI_SMM_SX_DISPATCH_CONTEXT;
  27. //
  28. // Member functions
  29. //
  30. /**
  31. Dispatch function for a Sx state SMI handler.
  32. @param DispatchHandle The handle of this dispatch function.
  33. @param DispatchContext The pointer to the dispatch function's context.
  34. The Type and Phase fields are filled in by the Sx dispatch driver
  35. prior to invoking this dispatch function. For this interface,
  36. the Sx driver will call the dispatch function for all Sx type
  37. and phases, so the Sx state handler(s) must check the Type and
  38. Phase field of EFI_SMM_SX_DISPATCH_CONTEXT, and act accordingly.
  39. @return None
  40. **/
  41. typedef
  42. VOID
  43. (EFIAPI *EFI_SMM_SX_DISPATCH)(
  44. IN EFI_HANDLE DispatchHandle,
  45. IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext
  46. );
  47. /**
  48. Register a child SMI source dispatch function with a parent SMM driver.
  49. @param This The pointer to the EFI_SMM_SX_DISPATCH_PROTOCOL instance.
  50. @param DispatchFunction The function to install.
  51. @param DispatchContext The pointer to the dispatch function's context.
  52. The caller fills in this context before calling
  53. the register function to indicates to the register
  54. function which Sx state type and phase the caller
  55. wishes to be called back on. For this interface,
  56. the Sx driver will call the registered handlers for
  57. all Sx type and phases, so the Sx state handler(s)
  58. must check the Type and Phase field of the Dispatch
  59. context, and act accordingly.
  60. @param DispatchHandle The handle of dispatch function, for interfacing
  61. with the parent Sx state SMM driver.
  62. @retval EFI_SUCCESS The dispatch function has been successfully
  63. registered and the SMI source has been enabled.
  64. @retval EFI_UNSUPPORTED The Sx driver or hardware does not support that
  65. Sx Type/Phase.
  66. @retval EFI_DEVICE_ERROR The Sx driver was unable to enable the SMI source.
  67. @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
  68. child.
  69. @retval EFI_INVALID_PARAMETER DispatchContext is invalid. Type & Phase are not
  70. within a valid range.
  71. **/
  72. typedef
  73. EFI_STATUS
  74. (EFIAPI *EFI_SMM_SX_REGISTER)(
  75. IN EFI_SMM_SX_DISPATCH_PROTOCOL *This,
  76. IN EFI_SMM_SX_DISPATCH DispatchFunction,
  77. IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext,
  78. OUT EFI_HANDLE *DispatchHandle
  79. );
  80. /**
  81. Unregisters an Sx-state service
  82. @param This The pointer to the EFI_SMM_SX_DISPATCH_PROTOCOL instance.
  83. @param DispatchHandle The handle of the service to remove.
  84. @retval EFI_SUCCESS The dispatch function has been successfully unregistered, and the
  85. SMI source has been disabled, if there are no other registered child
  86. dispatch functions for this SMI source.
  87. @retval EFI_INVALID_PARAMETER Handle is invalid.
  88. **/
  89. typedef
  90. EFI_STATUS
  91. (EFIAPI *EFI_SMM_SX_UNREGISTER)(
  92. IN EFI_SMM_SX_DISPATCH_PROTOCOL *This,
  93. IN EFI_HANDLE DispatchHandle
  94. );
  95. //
  96. // Interface structure for the SMM Child Dispatch Protocol
  97. //
  98. /**
  99. Provides the parent dispatch service for a given Sx-state source generator.
  100. **/
  101. struct _EFI_SMM_SX_DISPATCH_PROTOCOL {
  102. EFI_SMM_SX_REGISTER Register; ///< Installs a child service to be dispatched by this protocol.
  103. EFI_SMM_SX_UNREGISTER UnRegister; ///< Removes a child service dispatched by this protocol.
  104. };
  105. extern EFI_GUID gEfiSmmSxDispatchProtocolGuid;
  106. #endif