EFI LEGACY 8259 PROTOCOL
From PhoenixWiki
Contents |
GUID
#define EFI_LEGACY_8259_PROTOCOL_GUID \
{0x38321dba, 0x4fe0, 0x4e17, \
0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1}
Prototcol Interface Structure
typedef struct _EFI_LEGACY_8259_PROTOCOL {
EFI_LEGACY_8259_SET_VECTOR_BASE SetVectorBase;
EFI_LEGACY_8259_GET_MASK GetMask;
EFI_LEGACY_8259_SET_MASK SetMask;
EFI_LEGACY_8259_SET_MODE SetMode;
EFI_LEGACY_8259_GET_VECTOR GetVector;
EFI_LEGACY_8259_ENABLE_IRQ EnableIrq;
EFI_LEGACY_8259_DISABLE_IRQ DisableIrq;
EFI_LEGACY_8259_GET_INTERRUPT_LINE GetInterruptLine;
EFI_LEGACY_8259_END_OF_INTERRUPT EndOfInterrupt;
} EFI_LEGACY_8259_PROTOCOL;
SetVectorBase
Set the base address for the 8259 master and slave PICs.
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_SET_VECTOR_BASE) ( IN EFI_LEGACY_8259_PROTOCOL * This, IN UINT8 MasterBase, IN UINT8 SlaveBase );
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| MasterBase | The base vector for the Master PIC in the 8259 controller (IRQ0-IRQ7) |
| Slavebase | The base vector for the Master PIC in the 8259 controller (IRQ8-IRQ15) |
Description
Get the 8259 interrupt base for the master and slave interrupt controller.
Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | The 8259 PIC was programmed successfully. |
| EFI_DEVICE_ERROR | There was an error while writing to the 8259 PIC. |
GetMask()
Get the 16-bit real mode and 32/64-bit protected mode IRQ masks.
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_GET_MASK) ( IN EFI_LEGACY_8259_PROTOCOL * This, OUT UINT16 *LegacyMask, OPTIONAL OUT UINT16 *LegacyEdgeLevel, OPTIONAL OUT UINT16 *ProtectedMask, OPTIONAL OUT UINT16 *ProtectedEdgeLevel OPTIONAL );
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| LegacyMask | 16-bit real-mode interrupt mask. Bit 0 is Irq0 - Bit 15 is Irq15 |
| LegacyEdgeLevel | 16-bit real-mode edge/level mask. Bit 0 is Irq0 - Bit 15 is Irq15 |
| ProtectedMask | 32/64-bit protected-mode interrput mask. Bit 0 is Irq0 - Bit 15 is Irq15 |
| ProtectedEdgeLevel | 32/64-bit protected-mode edge/level mask. Bit 0 is Irq0 - Bit 15 is Irq15 |
Description
Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
the legacy mode mask and the protected mode mask. The base address for the 8259
is different for legacy and protected mode, so two masks are required.
Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | The 8259 PIC information was returned successfully. |
| EFI_DEVICE_ERROR | There was an error while reading the 8259 PIC. |
SetMask()
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_SET_MASK) ( IN EFI_LEGACY_8259_PROTOCOL * This, IN UINT16 *LegacyMask, OPTIONAL IN UINT16 *LegacyEdgeLevel, OPTIONAL IN UINT16 *ProtectedMask, OPTIONAL IN UINT16 *ProtectedEdgeLevel OPTIONAL );
Description
Set the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
the legacy mode mask and the protected mode mask. The base address for the 8259
is different for legacy and protected mode, so two masks are required.
Also set the edge/level masks.
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| LegacyMask | Bit 0 is Irq0 - Bit 15 is Irq15 |
| LegacyEdgeLevel | Bit 0 is Irq0 - Bit 15 is Irq15 |
| ProtectedMask | Bit 0 is Irq0 - Bit 15 is Irq15 |
| ProtectedEdgeLevel | Bit 0 is Irq0 - Bit 15 is Irq15 |
Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | 8259 status returned |
| EFI_DEVICE_ERROR | Error reading 8259 |
SetMode()
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_SET_MODE) ( IN EFI_LEGACY_8259_PROTOCOL * This, IN EFI_8259_MODE Mode, IN UINT16 *Mask, OPTIONAL IN UINT16 *EdgeLevel OPTIONAL );
Description
Set the 8259 mode of operation. The base address for the 8259 is different for
legacy and protected mode. The legacy mode requires the master 8259 to have a
master base of 0x08 and the slave base of 0x70. The protected mode base locations
are not defined. Interrupts must be masked by the caller before this function
is called. The interrupt mask from the current mode is saved. The interrupt
mask for the new mode is Mask, or if Mask does not exist the previously saved
mask is used.
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| Mode | Mode of operation. i.e. real mode or protected mode |
| Mask | Optional interupt mask for the new mode. |
| EdgeLevel | Optional trigger mask for the new mode. |
Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | 8259 programmed |
| EFI_DEVICE_ERROR | Error writing to 8259 |
GetVector()
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_GET_VECTOR) ( IN EFI_LEGACY_8259_PROTOCOL * This, IN EFI_8259_IRQ Irq, OUT UINT8 *Vector );
Description
Convert from IRQ to processor interrupt vector number.
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| Irq | 8259 IRQ0 - IRQ15 |
| Vector | Processor vector number that matches Irq |
Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | The Vector matching Irq is returned |
| EFI_INVALID_PARAMETER | Irq not valid |
EnableIrq()
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_ENABLE_IRQ) ( IN EFI_LEGACY_8259_PROTOCOL * This, IN EFI_8259_IRQ Irq, IN BOOLEAN LevelTriggered );
Description
Enable Irq by unmasking interrupt in 8259
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| Irq | 8259 IRQ0 - IRQ15 |
| LevelTriggered | TRUE if level triggered. FALSE if edge triggered. |
Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | Irq enabled on 8259 |
| EFI_INVALID_PARAMETER | Irq not valid |
DisableIrq()
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_DISABLE_IRQ) ( IN EFI_LEGACY_8259_PROTOCOL * This, IN EFI_8259_IRQ Irq );
Description
Disable Irq by masking interrupt in 8259
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| Irq | 8259 IRQ0 - IRQ15 |
Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | Irq disabled on 8259 |
| EFI_INVALID_PARAMETER | Irq not valid |
GetInterruptLine()
Reads the PCI configuration space to get the interrupt line assigned to a PCI device.
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_GET_INTERRUPT_LINE) ( IN EFI_LEGACY_8259_PROTOCOL * This, IN EFI_HANDLE PciHandle, OUT UINT8 *Vector );
Description
This function reads the PCI configuration space to get the interrupt number that is assigned to the PCI device.
PciHandle represents a PCI config space of a PCI function. Vector
represents Interrupt Pin (from PCI config space) and it is the data
that is programmed into the Interrupt Line (from the PCI config space)
register.
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| PciHandle | PCI function to return vector for |
| Vector | Vector for fucntion that matches |
'Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | A valid Vector is returned |
| EFI_INVALID_PARAMETER | PciHandle not valid |
EndOfInterrupt()
Issue End-Of-Interrupt to the PICs.
Prototype
typedef EFI_STATUS (EFIAPI *EFI_LEGACY_8259_END_OF_INTERRUPT) ( IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq );
Description
Send an EOI to 8259
Parameters
| Parameter | Description |
|---|---|
| This | Protocol instance pointer. |
| Irq | 8259 IRQ0 - IRQ15 |
Status Codes Returned
| Status Code | Description |
|---|---|
| EFI_SUCCESS | EOI successfully sent to 8259 |
| EFI_INVALID_PARAMETER | Irq not valid |
Copyright (C) 2008 Phoenix Technologies Ltd. All Rights Reserved. Portions (C) 1999-2006 Intel Corporation. Used with permission.
