HardwareInterrupt.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /** @file
  2. Abstraction for hardware based interrupt routine
  3. On non IA-32 systems it is common to have a single hardware interrupt vector
  4. and a 2nd layer of software that routes the interrupt handlers based on the
  5. interrupt source. This protocol enables this routing. The driver implementing
  6. this protocol is responsible for clearing the pending interrupt in the
  7. interrupt routing hardware. The HARDWARE_INTERRUPT_HANDLER is responsible
  8. for clearing interrupt sources from individual devices.
  9. Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
  10. SPDX-License-Identifier: BSD-2-Clause-Patent
  11. **/
  12. #ifndef __HARDWARE_INTERRUPT_H__
  13. #define __HARDWARE_INTERRUPT_H__
  14. #include <Protocol/DebugSupport.h>
  15. //
  16. // Protocol GUID
  17. //
  18. // EAB39028-3D05-4316-AD0C-D64808DA3FF1
  19. #define EFI_HARDWARE_INTERRUPT_PROTOCOL_GGUID \
  20. { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } }
  21. typedef struct _EFI_HARDWARE_INTERRUPT_PROTOCOL EFI_HARDWARE_INTERRUPT_PROTOCOL;
  22. typedef UINTN HARDWARE_INTERRUPT_SOURCE;
  23. /**
  24. C Interrupt Handler calledin the interrupt context when Source interrupt is active.
  25. @param Source Source of the interrupt. Hardware routing off a specific platform defines
  26. what source means.
  27. @param SystemContext Pointer to system register context. Mostly used by debuggers and will
  28. update the system context after the return from the interrupt if
  29. modified. Don't change these values unless you know what you are doing
  30. **/
  31. typedef
  32. VOID
  33. (EFIAPI *HARDWARE_INTERRUPT_HANDLER)(
  34. IN HARDWARE_INTERRUPT_SOURCE Source,
  35. IN EFI_SYSTEM_CONTEXT SystemContext
  36. );
  37. /**
  38. Register Handler for the specified interrupt source.
  39. @param This Instance pointer for this protocol
  40. @param Source Hardware source of the interrupt
  41. @param Handler Callback for interrupt. NULL to unregister
  42. @retval EFI_SUCCESS Source was updated to support Handler.
  43. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  44. **/
  45. typedef
  46. EFI_STATUS
  47. (EFIAPI *HARDWARE_INTERRUPT_REGISTER)(
  48. IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
  49. IN HARDWARE_INTERRUPT_SOURCE Source,
  50. IN HARDWARE_INTERRUPT_HANDLER Handler
  51. );
  52. /**
  53. Enable interrupt source Source.
  54. @param This Instance pointer for this protocol
  55. @param Source Hardware source of the interrupt
  56. @retval EFI_SUCCESS Source interrupt enabled.
  57. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  58. **/
  59. typedef
  60. EFI_STATUS
  61. (EFIAPI *HARDWARE_INTERRUPT_ENABLE)(
  62. IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
  63. IN HARDWARE_INTERRUPT_SOURCE Source
  64. );
  65. /**
  66. Disable interrupt source Source.
  67. @param This Instance pointer for this protocol
  68. @param Source Hardware source of the interrupt
  69. @retval EFI_SUCCESS Source interrupt disabled.
  70. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  71. **/
  72. typedef
  73. EFI_STATUS
  74. (EFIAPI *HARDWARE_INTERRUPT_DISABLE)(
  75. IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
  76. IN HARDWARE_INTERRUPT_SOURCE Source
  77. );
  78. /**
  79. Return current state of interrupt source Source.
  80. @param This Instance pointer for this protocol
  81. @param Source Hardware source of the interrupt
  82. @param InterruptState TRUE: source enabled, FALSE: source disabled.
  83. @retval EFI_SUCCESS InterruptState is valid
  84. @retval EFI_DEVICE_ERROR InterruptState is not valid
  85. **/
  86. typedef
  87. EFI_STATUS
  88. (EFIAPI *HARDWARE_INTERRUPT_INTERRUPT_STATE)(
  89. IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
  90. IN HARDWARE_INTERRUPT_SOURCE Source,
  91. IN BOOLEAN *InterruptState
  92. );
  93. /**
  94. Signal to the hardware that the End Of Interrupt state
  95. has been reached.
  96. @param This Instance pointer for this protocol
  97. @param Source Hardware source of the interrupt
  98. @retval EFI_SUCCESS Source interrupt EOI'ed.
  99. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  100. **/
  101. typedef
  102. EFI_STATUS
  103. (EFIAPI *HARDWARE_INTERRUPT_END_OF_INTERRUPT)(
  104. IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
  105. IN HARDWARE_INTERRUPT_SOURCE Source
  106. );
  107. struct _EFI_HARDWARE_INTERRUPT_PROTOCOL {
  108. HARDWARE_INTERRUPT_REGISTER RegisterInterruptSource;
  109. HARDWARE_INTERRUPT_ENABLE EnableInterruptSource;
  110. HARDWARE_INTERRUPT_DISABLE DisableInterruptSource;
  111. HARDWARE_INTERRUPT_INTERRUPT_STATE GetInterruptSourceState;
  112. HARDWARE_INTERRUPT_END_OF_INTERRUPT EndOfInterrupt;
  113. };
  114. extern EFI_GUID gHardwareInterruptProtocolGuid;
  115. #endif