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