2 This protocol abstracts the 8259 interrupt controller. This includes
3 PCI IRQ routing needed to program the PCI Interrupt Line register.
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
8 @par Revision Reference:
9 This protocol is defined in Framework for EFI Compatibility Support Module spec
14 #ifndef _EFI_LEGACY_8259_H_
15 #define _EFI_LEGACY_8259_H_
17 #define EFI_LEGACY_8259_PROTOCOL_GUID \
19 0x38321dba, 0x4fe0, 0x4e17, {0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1 } \
22 typedef struct _EFI_LEGACY_8259_PROTOCOL EFI_LEGACY_8259_PROTOCOL
;
51 Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
52 the legacy mode mask and the protected mode mask. The base address for the 8259
53 is different for legacy and protected mode, so two masks are required.
55 @param This The protocol instance pointer.
56 @param MasterBase The base vector for the Master PIC in the 8259 controller.
57 @param SlaveBase The base vector for the Slave PIC in the 8259 controller.
59 @retval EFI_SUCCESS The new bases were programmed.
60 @retval EFI_DEVICE_ERROR A device error occurred programming the vector bases.
65 (EFIAPI
*EFI_LEGACY_8259_SET_VECTOR_BASE
)(
66 IN EFI_LEGACY_8259_PROTOCOL
*This
,
72 Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
73 the legacy mode mask and the protected mode mask. The base address for the 8259
74 is different for legacy and protected mode, so two masks are required.
76 @param This The protocol instance pointer.
77 @param LegacyMask Bit 0 is Irq0 - Bit 15 is Irq15.
78 @param LegacyEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15.
79 @param ProtectedMask Bit 0 is Irq0 - Bit 15 is Irq15.
80 @param ProtectedEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15.
82 @retval EFI_SUCCESS 8259 status returned.
83 @retval EFI_DEVICE_ERROR Error reading 8259.
88 (EFIAPI
*EFI_LEGACY_8259_GET_MASK
)(
89 IN EFI_LEGACY_8259_PROTOCOL
*This
,
90 OUT UINT16
*LegacyMask OPTIONAL
,
91 OUT UINT16
*LegacyEdgeLevel OPTIONAL
,
92 OUT UINT16
*ProtectedMask OPTIONAL
,
93 OUT UINT16
*ProtectedEdgeLevel OPTIONAL
97 Set the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
98 the legacy mode mask and the protected mode mask. The base address for the 8259
99 is different for legacy and protected mode, so two masks are required.
100 Also set the edge/level masks.
102 @param This The protocol instance pointer.
103 @param LegacyMask Bit 0 is Irq0 - Bit 15 is Irq15.
104 @param LegacyEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15.
105 @param ProtectedMask Bit 0 is Irq0 - Bit 15 is Irq15.
106 @param ProtectedEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15.
108 @retval EFI_SUCCESS 8259 status returned.
109 @retval EFI_DEVICE_ERROR Error writing 8259.
114 (EFIAPI
*EFI_LEGACY_8259_SET_MASK
)(
115 IN EFI_LEGACY_8259_PROTOCOL
*This
,
116 IN UINT16
*LegacyMask OPTIONAL
,
117 IN UINT16
*LegacyEdgeLevel OPTIONAL
,
118 IN UINT16
*ProtectedMask OPTIONAL
,
119 IN UINT16
*ProtectedEdgeLevel OPTIONAL
123 Set the 8259 mode of operation. The base address for the 8259 is different for
124 legacy and protected mode. The legacy mode requires the master 8259 to have a
125 master base of 0x08 and the slave base of 0x70. The protected mode base locations
126 are not defined. Interrupts must be masked by the caller before this function
127 is called. The interrupt mask from the current mode is saved. The interrupt
128 mask for the new mode is Mask, or if Mask does not exist the previously saved
131 @param This The protocol instance pointer.
132 @param Mode The mode of operation. i.e. the real mode or protected mode.
133 @param Mask Optional interupt mask for the new mode.
134 @param EdgeLevel Optional trigger mask for the new mode.
136 @retval EFI_SUCCESS 8259 programmed.
137 @retval EFI_DEVICE_ERROR Error writing to 8259.
142 (EFIAPI
*EFI_LEGACY_8259_SET_MODE
)(
143 IN EFI_LEGACY_8259_PROTOCOL
*This
,
144 IN EFI_8259_MODE Mode
,
145 IN UINT16
*Mask OPTIONAL
,
146 IN UINT16
*EdgeLevel OPTIONAL
150 Convert from IRQ to processor interrupt vector number.
152 @param This The protocol instance pointer.
153 @param Irq 8259 IRQ0 - IRQ15.
154 @param Vector The processor vector number that matches an Irq.
156 @retval EFI_SUCCESS The Vector matching Irq is returned.
157 @retval EFI_INVALID_PARAMETER The Irq not valid.
162 (EFIAPI
*EFI_LEGACY_8259_GET_VECTOR
)(
163 IN EFI_LEGACY_8259_PROTOCOL
*This
,
169 Enable Irq by unmasking interrupt in 8259
171 @param This The protocol instance pointer.
172 @param Irq 8259 IRQ0 - IRQ15.
173 @param LevelTriggered TRUE if level triggered. FALSE if edge triggered.
175 @retval EFI_SUCCESS The Irq was enabled on 8259.
176 @retval EFI_INVALID_PARAMETER The Irq is not valid.
181 (EFIAPI
*EFI_LEGACY_8259_ENABLE_IRQ
)(
182 IN EFI_LEGACY_8259_PROTOCOL
*This
,
184 IN BOOLEAN LevelTriggered
188 Disable Irq by masking interrupt in 8259
190 @param This The protocol instance pointer.
191 @param Irq 8259 IRQ0 - IRQ15.
193 @retval EFI_SUCCESS The Irq was disabled on 8259.
194 @retval EFI_INVALID_PARAMETER The Irq is not valid.
199 (EFIAPI
*EFI_LEGACY_8259_DISABLE_IRQ
)(
200 IN EFI_LEGACY_8259_PROTOCOL
*This
,
205 PciHandle represents a PCI config space of a PCI function. Vector
206 represents Interrupt Pin (from PCI config space) and it is the data
207 that is programmed into the Interrupt Line (from the PCI config space)
210 @param This The protocol instance pointer.
211 @param PciHandle The PCI function to return the vector for.
212 @param Vector The vector for the function it matches.
214 @retval EFI_SUCCESS A valid Vector was returned.
215 @retval EFI_INVALID_PARAMETER PciHandle not valid.
220 (EFIAPI
*EFI_LEGACY_8259_GET_INTERRUPT_LINE
)(
221 IN EFI_LEGACY_8259_PROTOCOL
*This
,
222 IN EFI_HANDLE PciHandle
,
229 @param This The protocol instance pointer.
230 @param Irq 8259 IRQ0 - IRQ15.
232 @retval EFI_SUCCESS EOI was successfully sent to 8259.
233 @retval EFI_INVALID_PARAMETER The Irq isnot valid.
238 (EFIAPI
*EFI_LEGACY_8259_END_OF_INTERRUPT
)(
239 IN EFI_LEGACY_8259_PROTOCOL
*This
,
244 @par Protocol Description:
245 Abstracts the 8259 and APIC hardware control between EFI usage and
246 Compatibility16 usage.
249 Sets the vector bases for master and slave PICs.
252 Gets IRQ and edge/level masks for 16-bit real mode and 32-bit protected mode.
255 Sets the IRQ and edge\level masks for 16-bit real mode and 32-bit protected mode.
258 Sets PIC mode to 16-bit real mode or 32-bit protected mode.
261 Gets the base vector assigned to an IRQ.
269 @param GetInterruptLine
270 Gets an IRQ that is assigned to a PCI device.
272 @param EndOfInterrupt
273 Issues the end of interrupt command.
276 struct _EFI_LEGACY_8259_PROTOCOL
{
277 EFI_LEGACY_8259_SET_VECTOR_BASE SetVectorBase
;
278 EFI_LEGACY_8259_GET_MASK GetMask
;
279 EFI_LEGACY_8259_SET_MASK SetMask
;
280 EFI_LEGACY_8259_SET_MODE SetMode
;
281 EFI_LEGACY_8259_GET_VECTOR GetVector
;
282 EFI_LEGACY_8259_ENABLE_IRQ EnableIrq
;
283 EFI_LEGACY_8259_DISABLE_IRQ DisableIrq
;
284 EFI_LEGACY_8259_GET_INTERRUPT_LINE GetInterruptLine
;
285 EFI_LEGACY_8259_END_OF_INTERRUPT EndOfInterrupt
;
288 extern EFI_GUID gEfiLegacy8259ProtocolGuid
;