SmmSwDispatch.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /** @file
  2. Provides the parent dispatch service for a given 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 for EFI SMM Core Interface Spec
  7. Version 0.9.
  8. **/
  9. #ifndef _EFI_SMM_SW_DISPATCH_H_
  10. #define _EFI_SMM_SW_DISPATCH_H_
  11. //
  12. // Global ID for the SW SMI Protocol
  13. //
  14. #define EFI_SMM_SW_DISPATCH_PROTOCOL_GUID \
  15. { \
  16. 0xe541b773, 0xdd11, 0x420c, {0xb0, 0x26, 0xdf, 0x99, 0x36, 0x53, 0xf8, 0xbf } \
  17. }
  18. typedef struct _EFI_SMM_SW_DISPATCH_PROTOCOL EFI_SMM_SW_DISPATCH_PROTOCOL;
  19. //
  20. // Related Definitions
  21. //
  22. //
  23. // A particular chipset may not support all possible software SMI input values.
  24. // For example, the ICH supports only values 00h to 0FFh. The parent only allows a single
  25. // child registration for each SwSmiInputValue.
  26. //
  27. typedef struct {
  28. UINTN SwSmiInputValue;
  29. } EFI_SMM_SW_DISPATCH_CONTEXT;
  30. //
  31. // Member functions
  32. //
  33. /**
  34. Dispatch function for a Software SMI handler.
  35. @param DispatchHandle The handle of this dispatch function.
  36. @param DispatchContext The pointer to the dispatch function's context.
  37. The SwSmiInputValue field is filled in
  38. by the software dispatch driver prior to
  39. invoking this dispatch function.
  40. The dispatch function will only be called
  41. for input values for which it is registered.
  42. @return None
  43. **/
  44. typedef
  45. VOID
  46. (EFIAPI *EFI_SMM_SW_DISPATCH)(
  47. IN EFI_HANDLE DispatchHandle,
  48. IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
  49. );
  50. /**
  51. Register a child SMI source dispatch function with a parent SMM driver.
  52. @param This The pointer to the EFI_SMM_SW_DISPATCH_PROTOCOL instance.
  53. @param DispatchFunction The function to install.
  54. @param DispatchContext The pointer to the dispatch function's context.
  55. Indicates to the register
  56. function the Software SMI input value for which
  57. to invoke the dispatch function.
  58. @param DispatchHandle The handle generated by the dispatcher to track
  59. the function instance.
  60. @retval EFI_SUCCESS The dispatch function has been successfully
  61. registered and the SMI source has been enabled.
  62. @retval EFI_DEVICE_ERROR The SW driver could not enable the SMI source.
  63. @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
  64. child.
  65. @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The SW SMI input value
  66. is not within valid range.
  67. **/
  68. typedef
  69. EFI_STATUS
  70. (EFIAPI *EFI_SMM_SW_REGISTER)(
  71. IN EFI_SMM_SW_DISPATCH_PROTOCOL *This,
  72. IN EFI_SMM_SW_DISPATCH DispatchFunction,
  73. IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext,
  74. OUT EFI_HANDLE *DispatchHandle
  75. );
  76. /**
  77. Unregister a child SMI source dispatch function with a parent SMM driver
  78. @param This The pointer to the EFI_SMM_SW_DISPATCH_PROTOCOL instance.
  79. @param DispatchHandle The handle of the service to remove.
  80. @retval EFI_SUCCESS The dispatch function has been successfully
  81. unregistered and the SMI source has been disabled
  82. if there are no other registered child dispatch
  83. functions for this SMI source.
  84. @retval EFI_INVALID_PARAMETER The handle is invalid.
  85. **/
  86. typedef
  87. EFI_STATUS
  88. (EFIAPI *EFI_SMM_SW_UNREGISTER)(
  89. IN EFI_SMM_SW_DISPATCH_PROTOCOL *This,
  90. IN EFI_HANDLE DispatchHandle
  91. );
  92. //
  93. // Interface structure for the SMM Software SMI Dispatch Protocol
  94. //
  95. /**
  96. Provides the parent dispatch service for a given SMI source generator.
  97. **/
  98. ///
  99. /// Inconsistent with the specification here:
  100. /// In The Framework specification SmmCis, this definition is named as
  101. /// _EFI_SMM_ICHN_DISPATCH_PROTOCOL by mistake.
  102. ///
  103. struct _EFI_SMM_SW_DISPATCH_PROTOCOL {
  104. ///
  105. /// Installs a child service to be dispatched by this protocol.
  106. ///
  107. EFI_SMM_SW_REGISTER Register;
  108. ///
  109. /// Removes a child service dispatched by this protocol.
  110. ///
  111. EFI_SMM_SW_UNREGISTER UnRegister;
  112. ///
  113. /// A read-only field that describes the maximum value that can be used
  114. /// in the EFI_SMM_SW_DISPATCH_PROTOCOL.Register() service.
  115. ///
  116. UINTN MaximumSwiValue;
  117. };
  118. extern EFI_GUID gEfiSmmSwDispatchProtocolGuid;
  119. #endif