SmmGpiDispatch.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /** @file
  2. This file declares the Smm Gpi Smi Child Protocol.
  3. The EFI_SMM_GPI_DISPATCH_PROTOCOL is defined in Framework of EFI SMM Core Interface Spec
  4. Version 0.9. It provides the ability to install child handlers for the given event types.
  5. Several inputs can be enabled. This purpose of this interface is to generate an
  6. SMI in response to any of these inputs having a true value provided.
  7. Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
  8. SPDX-License-Identifier: BSD-2-Clause-Patent
  9. **/
  10. #ifndef _SMM_GPI_DISPATCH_H_
  11. #define _SMM_GPI_DISPATCH_H_
  12. //
  13. // Global ID for the GPI SMI Protocol
  14. //
  15. #define EFI_SMM_GPI_DISPATCH_PROTOCOL_GUID \
  16. { \
  17. 0xe0744b81, 0x9513, 0x49cd, {0x8c, 0xea, 0xe9, 0x24, 0x5e, 0x70, 0x39, 0xda } \
  18. }
  19. typedef struct _EFI_SMM_GPI_DISPATCH_PROTOCOL EFI_SMM_GPI_DISPATCH_PROTOCOL;
  20. //
  21. // Related Definitions
  22. //
  23. //
  24. // GpiMask is a bit mask of 32 possible general purpose inputs that can generate
  25. // an SMI. Bit 0 corresponds to logical GPI[0], 1 corresponds to logical GPI[1], and so on.
  26. //
  27. // The logical GPI index to physical pin on device is described by the GPI device name
  28. // found on the same handle as the GpiSmi child dispatch protocol. The GPI device name
  29. // is defined as protocol with a GUID name and NULL protocol pointer.
  30. //
  31. typedef struct {
  32. UINTN GpiNum;
  33. } EFI_SMM_GPI_DISPATCH_CONTEXT;
  34. //
  35. // Member functions
  36. //
  37. /**
  38. Dispatch function for a GPI SMI handler.
  39. @param DispatchHandle The handle of this dispatch function.
  40. @param DispatchContext The pointer to the dispatch function's context.
  41. The DispatchContext fields are filled in by the
  42. dispatching driver prior to invoking this dispatch
  43. function.
  44. **/
  45. typedef
  46. VOID
  47. (EFIAPI *EFI_SMM_GPI_DISPATCH)(
  48. IN EFI_HANDLE DispatchHandle,
  49. IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext
  50. );
  51. /**
  52. Register a child SMI source dispatch function with a parent SMM driver
  53. @param This The pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
  54. @param DispatchFunction Function to install.
  55. @param DispatchContext The pointer to the dispatch function's context.
  56. Indicates to the register
  57. function the GPI(s) for which the dispatch function
  58. should be invoked.
  59. @param DispatchHandle The handle generated by the dispatcher to track the
  60. function instance.
  61. @retval EFI_SUCCESS The dispatch function has been successfully
  62. registered, and the SMI source has been enabled.
  63. @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
  64. @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
  65. child.
  66. @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The GPI input value
  67. is not within valid range.
  68. **/
  69. typedef
  70. EFI_STATUS
  71. (EFIAPI *EFI_SMM_GPI_REGISTER)(
  72. IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,
  73. IN EFI_SMM_GPI_DISPATCH DispatchFunction,
  74. IN EFI_SMM_GPI_DISPATCH_CONTEXT *DispatchContext,
  75. OUT EFI_HANDLE *DispatchHandle
  76. );
  77. /**
  78. Unregisters a General Purpose Input (GPI) service.
  79. @param This The pointer to the EFI_SMM_GPI_DISPATCH_PROTOCOL instance.
  80. @param DispatchHandle The handle of the service to remove.
  81. @retval EFI_SUCCESS The dispatch function has been successfully
  82. unregistered, and the SMI source has been disabled,
  83. if there are no other registered child dispatch
  84. functions for this SMI source.
  85. @retval EFI_INVALID_PARAMETER DispatchHandle is invalid.
  86. **/
  87. typedef
  88. EFI_STATUS
  89. (EFIAPI *EFI_SMM_GPI_UNREGISTER)(
  90. IN EFI_SMM_GPI_DISPATCH_PROTOCOL *This,
  91. IN EFI_HANDLE DispatchHandle
  92. );
  93. //
  94. // Interface structure for the SMM GPI SMI Dispatch Protocol
  95. //
  96. struct _EFI_SMM_GPI_DISPATCH_PROTOCOL {
  97. EFI_SMM_GPI_REGISTER Register;
  98. EFI_SMM_GPI_UNREGISTER UnRegister;
  99. ///
  100. /// Denotes the maximum value of inputs that can have handlers attached.
  101. ///
  102. UINTN NumSupportedGpis;
  103. };
  104. extern EFI_GUID gEfiSmmGpiDispatchProtocolGuid;
  105. #endif