3 Copyright (c) 1999 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 This protocol abstracts the 8259 interrupt controller. This includes
20 PCI IRQ routing need to program the PCI Interrupt Line register.
24 The EFI Legacy 8259 Protocol is compliant with CSM spec 0.96.
28 #ifndef _EFI_LEGACY_8259_H
29 #define _EFI_LEGACY_8259_H
31 #define EFI_LEGACY_8259_PROTOCOL_GUID \
33 0x38321dba, 0x4fe0, 0x4e17, 0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1 \
36 EFI_FORWARD_DECLARATION (EFI_LEGACY_8259_PROTOCOL
);
66 (EFIAPI
*EFI_LEGACY_8259_SET_VECTOR_BASE
) (
67 IN EFI_LEGACY_8259_PROTOCOL
* This
,
74 Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
75 the legacy mode mask and the protected mode mask. The base address for the 8259
76 is different for legacy and protected mode, so two masks are required.
79 This - Protocol instance pointer.
80 MasterBase - The base vector for the Master PIC in the 8259 controller
81 Slavebase - The base vector for the Master PIC in the 8259 controller
84 EFI_SUCCESS - The new bases were programmed
85 EFI_DEVICE_ERROR - A device erro occured programming the vector bases
92 (EFIAPI
*EFI_LEGACY_8259_GET_MASK
) (
93 IN EFI_LEGACY_8259_PROTOCOL
* This
,
94 OUT UINT16
*LegacyMask
, OPTIONAL
95 OUT UINT16
*LegacyEdgeLevel
, OPTIONAL
96 OUT UINT16
*ProtectedMask
, OPTIONAL
97 OUT UINT16
*ProtectedEdgeLevel OPTIONAL
102 Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
103 the legacy mode mask and the protected mode mask. The base address for the 8259
104 is different for legacy and protected mode, so two masks are required.
107 This - Protocol instance pointer.
108 LegacyMask - Bit 0 is Irq0 - Bit 15 is Irq15
109 LegacyEdgeLevel - Bit 0 is Irq0 - Bit 15 is Irq15
110 ProtectedMask - Bit 0 is Irq0 - Bit 15 is Irq15
111 ProtectedEdgeLevel - Bit 0 is Irq0 - Bit 15 is Irq15
114 EFI_SUCCESS - 8259 status returned
115 EFI_DEVICE_ERROR - Error reading 8259
122 (EFIAPI
*EFI_LEGACY_8259_SET_MASK
) (
123 IN EFI_LEGACY_8259_PROTOCOL
* This
,
124 IN UINT16
*LegacyMask
, OPTIONAL
125 IN UINT16
*LegacyEdgeLevel
, OPTIONAL
126 IN UINT16
*ProtectedMask
, OPTIONAL
127 IN UINT16
*ProtectedEdgeLevel OPTIONAL
132 Set the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
133 the legacy mode mask and the protected mode mask. The base address for the 8259
134 is different for legacy and protected mode, so two masks are required.
135 Also set the edge/level masks.
138 This - Protocol instance pointer.
139 LegacyMask - Bit 0 is Irq0 - Bit 15 is Irq15
140 LegacyEdgeLevel - Bit 0 is Irq0 - Bit 15 is Irq15
141 ProtectedMask - Bit 0 is Irq0 - Bit 15 is Irq15
142 ProtectedEdgeLevel - Bit 0 is Irq0 - Bit 15 is Irq15
145 EFI_SUCCESS - 8259 status returned
146 EFI_DEVICE_ERROR - Error reading 8259
153 (EFIAPI
*EFI_LEGACY_8259_SET_MODE
) (
154 IN EFI_LEGACY_8259_PROTOCOL
* This
,
155 IN EFI_8259_MODE Mode
,
156 IN UINT16
*Mask
, OPTIONAL
157 IN UINT16
*EdgeLevel OPTIONAL
162 Set the 8259 mode of operation. The base address for the 8259 is different for
163 legacy and protected mode. The legacy mode requires the master 8259 to have a
164 master base of 0x08 and the slave base of 0x70. The protected mode base locations
165 are not defined. Interrupts must be masked by the caller before this function
166 is called. The interrupt mask from the current mode is saved. The interrupt
167 mask for the new mode is Mask, or if Mask does not exist the previously saved
172 This - Protocol instance pointer.
173 Mode - Mode of operation. i.e. real mode or protected mode
174 Mask - Optional interupt mask for the new mode.
175 EdgeLevel - Optional trigger mask for the new mode.
178 EFI_SUCCESS - 8259 programmed
179 EFI_DEVICE_ERROR - Error writting to 8259
186 (EFIAPI
*EFI_LEGACY_8259_GET_VECTOR
) (
187 IN EFI_LEGACY_8259_PROTOCOL
* This
,
194 Convert from IRQ to processor interrupt vector number.
197 This - Protocol instance pointer.
198 Irq - 8259 IRQ0 - IRQ15
199 Vector - Processor vector number that matches Irq
202 EFI_SUCCESS - The Vector matching Irq is returned
203 EFI_INVALID_PARAMETER - Irq not valid
210 (EFIAPI
*EFI_LEGACY_8259_ENABLE_IRQ
) (
211 IN EFI_LEGACY_8259_PROTOCOL
* This
,
213 IN BOOLEAN LevelTriggered
218 Enable Irq by unmasking interrupt in 8259
221 This - Protocol instance pointer.
222 Irq - 8259 IRQ0 - IRQ15
223 LevelTriggered - TRUE if level triggered. FALSE if edge triggered.
226 EFI_SUCCESS - Irq enabled on 8259
227 EFI_INVALID_PARAMETER - Irq not valid
234 (EFIAPI
*EFI_LEGACY_8259_DISABLE_IRQ
) (
235 IN EFI_LEGACY_8259_PROTOCOL
* This
,
241 Disable Irq by masking interrupt in 8259
244 This - Protocol instance pointer.
245 Irq - 8259 IRQ0 - IRQ15
248 EFI_SUCCESS - Irq disabled on 8259
249 EFI_INVALID_PARAMETER - Irq not valid
256 (EFIAPI
*EFI_LEGACY_8259_GET_INTERRUPT_LINE
) (
257 IN EFI_LEGACY_8259_PROTOCOL
* This
,
258 IN EFI_HANDLE PciHandle
,
264 PciHandle represents a PCI config space of a PCI function. Vector
265 represents Interrupt Pin (from PCI config space) and it is the data
266 that is programmed into the Interrupt Line (from the PCI config space)
270 This - Protocol instance pointer.
271 PciHandle - PCI function to return vector for
272 Vector - Vector for fucntion that matches
275 EFI_SUCCESS - A valid Vector is returned
276 EFI_INVALID_PARAMETER - PciHandle not valid
283 (EFIAPI
*EFI_LEGACY_8259_END_OF_INTERRUPT
) (
284 IN EFI_LEGACY_8259_PROTOCOL
* This
,
293 This - Protocol instance pointer.
294 Irq - 8259 IRQ0 - IRQ15
297 EFI_SUCCESS - EOI successfully sent to 8259
298 EFI_INVALID_PARAMETER - Irq not valid
303 typedef struct _EFI_LEGACY_8259_PROTOCOL
{
304 EFI_LEGACY_8259_SET_VECTOR_BASE SetVectorBase
;
305 EFI_LEGACY_8259_GET_MASK GetMask
;
306 EFI_LEGACY_8259_SET_MASK SetMask
;
307 EFI_LEGACY_8259_SET_MODE SetMode
;
308 EFI_LEGACY_8259_GET_VECTOR GetVector
;
309 EFI_LEGACY_8259_ENABLE_IRQ EnableIrq
;
310 EFI_LEGACY_8259_DISABLE_IRQ DisableIrq
;
311 EFI_LEGACY_8259_GET_INTERRUPT_LINE GetInterruptLine
;
312 EFI_LEGACY_8259_END_OF_INTERRUPT EndOfInterrupt
;
313 } EFI_LEGACY_8259_PROTOCOL
;
315 extern EFI_GUID gEfiLegacy8259ProtocolGuid
;