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, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 @par Revision Reference:
15 This protocol is defined in Framework for EFI Compatibility Support Module spec
20 #ifndef _EFI_LEGACY_8259_H_
21 #define _EFI_LEGACY_8259_H_
24 #define EFI_LEGACY_8259_PROTOCOL_GUID \
26 0x38321dba, 0x4fe0, 0x4e17, {0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1 } \
29 typedef struct _EFI_LEGACY_8259_PROTOCOL EFI_LEGACY_8259_PROTOCOL
;
58 Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
59 the legacy mode mask and the protected mode mask. The base address for the 8259
60 is different for legacy and protected mode, so two masks are required.
62 @param This Protocol instance pointer.
63 @param MasterBase The base vector for the Master PIC in the 8259 controller
64 @param SlaveBase The base vector for the Slave PIC in the 8259 controller
66 @retval EFI_SUCCESS The new bases were programmed
67 @retval EFI_DEVICE_ERROR A device error occured programming the vector bases
72 (EFIAPI
*EFI_LEGACY_8259_SET_VECTOR_BASE
)(
73 IN EFI_LEGACY_8259_PROTOCOL
*This
,
79 Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
80 the legacy mode mask and the protected mode mask. The base address for the 8259
81 is different for legacy and protected mode, so two masks are required.
83 @param This Protocol instance pointer.
84 @param LegacyMask Bit 0 is Irq0 - Bit 15 is Irq15
85 @param LegacyEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15
86 @param ProtectedMask Bit 0 is Irq0 - Bit 15 is Irq15
87 @param ProtectedEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15
89 @retval EFI_SUCCESS 8259 status returned
90 @retval EFI_DEVICE_ERROR Error reading 8259
95 (EFIAPI
*EFI_LEGACY_8259_GET_MASK
)(
96 IN EFI_LEGACY_8259_PROTOCOL
*This
,
97 OUT UINT16
*LegacyMask
, OPTIONAL
98 OUT UINT16
*LegacyEdgeLevel
, OPTIONAL
99 OUT UINT16
*ProtectedMask
, OPTIONAL
100 OUT UINT16
*ProtectedEdgeLevel OPTIONAL
104 Set the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
105 the legacy mode mask and the protected mode mask. The base address for the 8259
106 is different for legacy and protected mode, so two masks are required.
107 Also set the edge/level masks.
109 @param This Protocol instance pointer.
110 @param LegacyMask Bit 0 is Irq0 - Bit 15 is Irq15
111 @param LegacyEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15
112 @param ProtectedMask Bit 0 is Irq0 - Bit 15 is Irq15
113 @param ProtectedEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15
115 @retval EFI_SUCCESS 8259 status returned
116 @retval EFI_DEVICE_ERROR Error writing 8259
121 (EFIAPI
*EFI_LEGACY_8259_SET_MASK
)(
122 IN EFI_LEGACY_8259_PROTOCOL
*This
,
123 IN UINT16
*LegacyMask
, OPTIONAL
124 IN UINT16
*LegacyEdgeLevel
, OPTIONAL
125 IN UINT16
*ProtectedMask
, OPTIONAL
126 IN UINT16
*ProtectedEdgeLevel OPTIONAL
130 Set the 8259 mode of operation. The base address for the 8259 is different for
131 legacy and protected mode. The legacy mode requires the master 8259 to have a
132 master base of 0x08 and the slave base of 0x70. The protected mode base locations
133 are not defined. Interrupts must be masked by the caller before this function
134 is called. The interrupt mask from the current mode is saved. The interrupt
135 mask for the new mode is Mask, or if Mask does not exist the previously saved
138 @param This Protocol instance pointer.
139 @param Mode Mode of operation. i.e. real mode or protected mode
140 @param Mask Optional interupt mask for the new mode.
141 @param EdgeLevel Optional trigger mask for the new mode.
143 @retval EFI_SUCCESS 8259 programmed
144 @retval EFI_DEVICE_ERROR Error writing to 8259
149 (EFIAPI
*EFI_LEGACY_8259_SET_MODE
)(
150 IN EFI_LEGACY_8259_PROTOCOL
*This
,
151 IN EFI_8259_MODE Mode
,
152 IN UINT16
*Mask
, OPTIONAL
153 IN UINT16
*EdgeLevel OPTIONAL
157 Convert from IRQ to processor interrupt vector number.
159 @param This Protocol instance pointer.
160 @param Irq 8259 IRQ0 - IRQ15
161 @param Vector Processor vector number that matches Irq
163 @retval EFI_SUCCESS The Vector matching Irq is returned
164 @retval EFI_INVALID_PARAMETER Irq not valid
169 (EFIAPI
*EFI_LEGACY_8259_GET_VECTOR
)(
170 IN EFI_LEGACY_8259_PROTOCOL
*This
,
176 Enable Irq by unmasking interrupt in 8259
178 @param This Protocol instance pointer.
179 @param Irq 8259 IRQ0 - IRQ15
180 @param LevelTriggered TRUE if level triggered. FALSE if edge triggered.
182 @retval EFI_SUCCESS Irq enabled on 8259
183 @retval EFI_INVALID_PARAMETER Irq not valid
188 (EFIAPI
*EFI_LEGACY_8259_ENABLE_IRQ
)(
189 IN EFI_LEGACY_8259_PROTOCOL
*This
,
191 IN BOOLEAN LevelTriggered
195 Disable Irq by masking interrupt in 8259
197 @param This Protocol instance pointer.
198 @param Irq 8259 IRQ0 - IRQ15
200 @retval EFI_SUCCESS Irq disabled on 8259
201 @retval EFI_INVALID_PARAMETER Irq not valid
206 (EFIAPI
*EFI_LEGACY_8259_DISABLE_IRQ
)(
207 IN EFI_LEGACY_8259_PROTOCOL
*This
,
212 PciHandle represents a PCI config space of a PCI function. Vector
213 represents Interrupt Pin (from PCI config space) and it is the data
214 that is programmed into the Interrupt Line (from the PCI config space)
217 @param This Protocol instance pointer.
218 @param PciHandle PCI function to return vector for
219 @param Vector Vector for fucntion that matches
221 @retval EFI_SUCCESS A valid Vector is returned
222 @retval EFI_INVALID_PARAMETER PciHandle not valid
227 (EFIAPI
*EFI_LEGACY_8259_GET_INTERRUPT_LINE
)(
228 IN EFI_LEGACY_8259_PROTOCOL
*This
,
229 IN EFI_HANDLE PciHandle
,
236 @param This Protocol instance pointer.
237 @param Irq 8259 IRQ0 - IRQ15
239 @retval EFI_SUCCESS EOI successfully sent to 8259
240 @retval EFI_INVALID_PARAMETER Irq not valid
245 (EFIAPI
*EFI_LEGACY_8259_END_OF_INTERRUPT
)(
246 IN EFI_LEGACY_8259_PROTOCOL
*This
,
251 @par Protocol Description:
252 Abstracts the 8259 and APIC hardware control between EFI usage and
253 Compatibility16 usage.
256 Sets the vector bases for master and slave PICs.
259 Gets IRQ and edge/level masks for 16-bit real mode and 32-bit protected mode.
262 Sets the IRQ and edge\level masks for 16-bit real mode and 32-bit protected mode.
265 Sets PIC mode to 16-bit real mode or 32-bit protected mode.
268 Gets the base vector assigned to an IRQ.
276 @param GetInterruptLine
277 Gets an IRQ that is assigned to a PCI device.
279 @param EndOfInterrupt
280 Issues the end of interrupt command.
283 struct _EFI_LEGACY_8259_PROTOCOL
{
284 EFI_LEGACY_8259_SET_VECTOR_BASE SetVectorBase
;
285 EFI_LEGACY_8259_GET_MASK GetMask
;
286 EFI_LEGACY_8259_SET_MASK SetMask
;
287 EFI_LEGACY_8259_SET_MODE SetMode
;
288 EFI_LEGACY_8259_GET_VECTOR GetVector
;
289 EFI_LEGACY_8259_ENABLE_IRQ EnableIrq
;
290 EFI_LEGACY_8259_DISABLE_IRQ DisableIrq
;
291 EFI_LEGACY_8259_GET_INTERRUPT_LINE GetInterruptLine
;
292 EFI_LEGACY_8259_END_OF_INTERRUPT EndOfInterrupt
;
295 extern EFI_GUID gEfiLegacy8259ProtocolGuid
;