TianoCore EDK2 master
Loading...
Searching...
No Matches
8259.c File Reference
#include "8259.h"

Go to the source code of this file.

Functions

VOID Interrupt8259WriteMask (IN UINT16 Mask, IN UINT16 EdgeLevel)
 
VOID Interrupt8259ReadMask (OUT UINT16 *Mask, OUT UINT16 *EdgeLevel)
 
EFI_STATUS EFIAPI Interrupt8259SetVectorBase (IN EFI_LEGACY_8259_PROTOCOL *This, IN UINT8 MasterBase, IN UINT8 SlaveBase)
 
EFI_STATUS EFIAPI Interrupt8259GetMask (IN EFI_LEGACY_8259_PROTOCOL *This, OUT UINT16 *LegacyMask OPTIONAL, OUT UINT16 *LegacyEdgeLevel OPTIONAL, OUT UINT16 *ProtectedMask OPTIONAL, OUT UINT16 *ProtectedEdgeLevel OPTIONAL)
 
EFI_STATUS EFIAPI Interrupt8259SetMask (IN EFI_LEGACY_8259_PROTOCOL *This, IN UINT16 *LegacyMask OPTIONAL, IN UINT16 *LegacyEdgeLevel OPTIONAL, IN UINT16 *ProtectedMask OPTIONAL, IN UINT16 *ProtectedEdgeLevel OPTIONAL)
 
EFI_STATUS EFIAPI Interrupt8259SetMode (IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_MODE Mode, IN UINT16 *Mask OPTIONAL, IN UINT16 *EdgeLevel OPTIONAL)
 
EFI_STATUS EFIAPI Interrupt8259GetVector (IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq, OUT UINT8 *Vector)
 
EFI_STATUS EFIAPI Interrupt8259EnableIrq (IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq, IN BOOLEAN LevelTriggered)
 
EFI_STATUS EFIAPI Interrupt8259DisableIrq (IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq)
 
EFI_STATUS EFIAPI Interrupt8259GetInterruptLine (IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_HANDLE PciHandle, OUT UINT8 *Vector)
 
EFI_STATUS EFIAPI Interrupt8259EndOfInterrupt (IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq)
 
EFI_STATUS EFIAPI Install8259 (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_LEGACY_8259_PROTOCOL mInterrupt8259
 
EFI_HANDLE m8259Handle = NULL
 
UINT8 mMasterBase = 0xff
 
UINT8 mSlaveBase = 0xff
 
EFI_8259_MODE mMode = Efi8259ProtectedMode
 
UINT16 mProtectedModeMask = 0xffff
 
UINT16 mLegacyModeMask
 
UINT16 mProtectedModeEdgeLevel = 0x0000
 
UINT16 mLegacyModeEdgeLevel
 

Detailed Description

This contains the installation function for the driver.

Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file 8259.c.

Function Documentation

◆ Install8259()

EFI_STATUS EFIAPI Install8259 ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Driver Entry point.

Parameters
[in]ImageHandleImageHandle of the loaded driver.
[in]SystemTablePointer to the EFI System Table.
Return values
EFI_SUCCESSOne or more of the drivers returned a success code.
!EFI_SUCCESSError installing Legacy 8259 Protocol.

Definition at line 581 of file 8259.c.

◆ Interrupt8259DisableIrq()

EFI_STATUS EFIAPI Interrupt8259DisableIrq ( IN EFI_LEGACY_8259_PROTOCOL This,
IN EFI_8259_IRQ  Irq 
)

Disables the specified IRQ.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[in]IrqIRQ0-IRQ15.
Return values
EFI_SUCCESSThe Irq was disabled on the 8259 PIC.
EFI_INVALID_PARAMETERThe Irq is not valid.

Definition at line 474 of file 8259.c.

◆ Interrupt8259EnableIrq()

EFI_STATUS EFIAPI Interrupt8259EnableIrq ( IN EFI_LEGACY_8259_PROTOCOL This,
IN EFI_8259_IRQ  Irq,
IN BOOLEAN  LevelTriggered 
)

Enables the specified IRQ.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[in]IrqIRQ0-IRQ15.
[in]LevelTriggered0 = Edge triggered; 1 = Level triggered.
Return values
EFI_SUCCESSThe Irq was enabled on the 8259 PIC.
EFI_INVALID_PARAMETERThe Irq is not valid.

Definition at line 440 of file 8259.c.

◆ Interrupt8259EndOfInterrupt()

EFI_STATUS EFIAPI Interrupt8259EndOfInterrupt ( IN EFI_LEGACY_8259_PROTOCOL This,
IN EFI_8259_IRQ  Irq 
)

Issues the End of Interrupt (EOI) commands to PICs.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[in]IrqThe interrupt for which to issue the EOI command.
Return values
EFI_SUCCESSThe EOI command was issued.
EFI_INVALID_PARAMETERThe Irq is not valid.

Definition at line 551 of file 8259.c.

◆ Interrupt8259GetInterruptLine()

EFI_STATUS EFIAPI Interrupt8259GetInterruptLine ( IN EFI_LEGACY_8259_PROTOCOL This,
IN EFI_HANDLE  PciHandle,
OUT UINT8 *  Vector 
)

Reads the PCI configuration space to get the interrupt number that is assigned to the card.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[in]PciHandlePCI function for which to return the vector.
[out]VectorIRQ number that corresponds to the interrupt line.
Return values
EFI_SUCCESSThe interrupt line value was read successfully.

Definition at line 504 of file 8259.c.

◆ Interrupt8259GetMask()

EFI_STATUS EFIAPI Interrupt8259GetMask ( IN EFI_LEGACY_8259_PROTOCOL This,
OUT UINT16 *LegacyMask  OPTIONAL,
OUT UINT16 *LegacyEdgeLevel  OPTIONAL,
OUT UINT16 *ProtectedMask  OPTIONAL,
OUT UINT16 *ProtectedEdgeLevel  OPTIONAL 
)

Gets the current 16-bit real mode and 32-bit protected-mode IRQ masks.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[out]LegacyMask16-bit mode interrupt mask for IRQ0-IRQ15.
[out]LegacyEdgeLevel16-bit mode edge/level mask for IRQ-IRQ15.
[out]ProtectedMask32-bit mode interrupt mask for IRQ0-IRQ15.
[out]ProtectedEdgeLevel32-bit mode edge/level mask for IRQ0-IRQ15.
Return values
EFI_SUCCESSThe 8259 PIC was programmed successfully.
EFI_DEVICE_ERRORThere was an error while reading the 8259 PIC.

Definition at line 231 of file 8259.c.

◆ Interrupt8259GetVector()

EFI_STATUS EFIAPI Interrupt8259GetVector ( IN EFI_LEGACY_8259_PROTOCOL This,
IN EFI_8259_IRQ  Irq,
OUT UINT8 *  Vector 
)

Translates the IRQ into a vector.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[in]IrqIRQ0-IRQ15.
[out]VectorThe vector that is assigned to the IRQ.
Return values
EFI_SUCCESSThe Vector that matches Irq was returned.
EFI_INVALID_PARAMETERIrq is not valid.

Definition at line 408 of file 8259.c.

◆ Interrupt8259ReadMask()

VOID Interrupt8259ReadMask ( OUT UINT16 *  Mask,
OUT UINT16 *  EdgeLevel 
)

Read from mask and edge/level triggered registers of master and slave PICs.

Parameters
[out]Masklow byte for master PIC mask register, high byte for slave PIC mask register.
[out]EdgeLevellow byte for master PIC edge/level triggered register, high byte for slave PIC edge/level triggered register.

Definition at line 74 of file 8259.c.

◆ Interrupt8259SetMask()

EFI_STATUS EFIAPI Interrupt8259SetMask ( IN EFI_LEGACY_8259_PROTOCOL This,
IN UINT16 *LegacyMask  OPTIONAL,
IN UINT16 *LegacyEdgeLevel  OPTIONAL,
IN UINT16 *ProtectedMask  OPTIONAL,
IN UINT16 *ProtectedEdgeLevel  OPTIONAL 
)

Sets the current 16-bit real mode and 32-bit protected-mode IRQ masks.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[in]LegacyMask16-bit mode interrupt mask for IRQ0-IRQ15.
[in]LegacyEdgeLevel16-bit mode edge/level mask for IRQ-IRQ15.
[in]ProtectedMask32-bit mode interrupt mask for IRQ0-IRQ15.
[in]ProtectedEdgeLevel32-bit mode edge/level mask for IRQ0-IRQ15.
Return values
EFI_SUCCESSThe 8259 PIC was programmed successfully.
EFI_DEVICE_ERRORThere was an error while writing the 8259 PIC.

Definition at line 273 of file 8259.c.

◆ Interrupt8259SetMode()

EFI_STATUS EFIAPI Interrupt8259SetMode ( IN EFI_LEGACY_8259_PROTOCOL This,
IN EFI_8259_MODE  Mode,
IN UINT16 *Mask  OPTIONAL,
IN UINT16 *EdgeLevel  OPTIONAL 
)

Sets the mode of the PICs.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[in]Mode16-bit real or 32-bit protected mode.
[in]MaskThe value with which to set the interrupt mask.
[in]EdgeLevelThe value with which to set the edge/level mask.
Return values
EFI_SUCCESSThe mode was set successfully.
EFI_INVALID_PARAMETERThe mode was not set.

Definition at line 314 of file 8259.c.

◆ Interrupt8259SetVectorBase()

EFI_STATUS EFIAPI Interrupt8259SetVectorBase ( IN EFI_LEGACY_8259_PROTOCOL This,
IN UINT8  MasterBase,
IN UINT8  SlaveBase 
)

Sets the base address for the 8259 master and slave PICs.

Parameters
[in]ThisIndicates the EFI_LEGACY_8259_PROTOCOL instance.
[in]MasterBaseInterrupt vectors for IRQ0-IRQ7.
[in]SlaveBaseInterrupt vectors for IRQ8-IRQ15.
Return values
EFI_SUCCESSThe 8259 PIC was programmed successfully.
EFI_DEVICE_ERRORThere was an error while writing to the 8259 PIC.

Definition at line 114 of file 8259.c.

◆ Interrupt8259WriteMask()

VOID Interrupt8259WriteMask ( IN UINT16  Mask,
IN UINT16  EdgeLevel 
)

Write to mask and edge/level triggered registers of master and slave PICs.

Parameters
[in]Masklow byte for master PIC mask register, high byte for slave PIC mask register.
[in]EdgeLevellow byte for master PIC edge/level triggered register, high byte for slave PIC edge/level triggered register.

Definition at line 53 of file 8259.c.

Variable Documentation

◆ m8259Handle

EFI_HANDLE m8259Handle = NULL

Definition at line 29 of file 8259.c.

◆ mInterrupt8259

EFI_LEGACY_8259_PROTOCOL mInterrupt8259
Initial value:
= {
}
EFI_STATUS EFIAPI Interrupt8259GetVector(IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq, OUT UINT8 *Vector)
Definition: 8259.c:408
EFI_STATUS EFIAPI Interrupt8259EndOfInterrupt(IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq)
Definition: 8259.c:551
EFI_STATUS EFIAPI Interrupt8259SetMask(IN EFI_LEGACY_8259_PROTOCOL *This, IN UINT16 *LegacyMask OPTIONAL, IN UINT16 *LegacyEdgeLevel OPTIONAL, IN UINT16 *ProtectedMask OPTIONAL, IN UINT16 *ProtectedEdgeLevel OPTIONAL)
Definition: 8259.c:273
EFI_STATUS EFIAPI Interrupt8259GetMask(IN EFI_LEGACY_8259_PROTOCOL *This, OUT UINT16 *LegacyMask OPTIONAL, OUT UINT16 *LegacyEdgeLevel OPTIONAL, OUT UINT16 *ProtectedMask OPTIONAL, OUT UINT16 *ProtectedEdgeLevel OPTIONAL)
Definition: 8259.c:231
EFI_STATUS EFIAPI Interrupt8259GetInterruptLine(IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_HANDLE PciHandle, OUT UINT8 *Vector)
Definition: 8259.c:504
EFI_STATUS EFIAPI Interrupt8259EnableIrq(IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq, IN BOOLEAN LevelTriggered)
Definition: 8259.c:440
EFI_STATUS EFIAPI Interrupt8259DisableIrq(IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_IRQ Irq)
Definition: 8259.c:474
EFI_STATUS EFIAPI Interrupt8259SetVectorBase(IN EFI_LEGACY_8259_PROTOCOL *This, IN UINT8 MasterBase, IN UINT8 SlaveBase)
Definition: 8259.c:114
EFI_STATUS EFIAPI Interrupt8259SetMode(IN EFI_LEGACY_8259_PROTOCOL *This, IN EFI_8259_MODE Mode, IN UINT16 *Mask OPTIONAL, IN UINT16 *EdgeLevel OPTIONAL)
Definition: 8259.c:314

Definition at line 14 of file 8259.c.

◆ mLegacyModeEdgeLevel

UINT16 mLegacyModeEdgeLevel

Definition at line 37 of file 8259.c.

◆ mLegacyModeMask

UINT16 mLegacyModeMask

Definition at line 35 of file 8259.c.

◆ mMasterBase

UINT8 mMasterBase = 0xff

Definition at line 31 of file 8259.c.

◆ mMode

EFI_8259_MODE mMode = Efi8259ProtectedMode

Definition at line 33 of file 8259.c.

◆ mProtectedModeEdgeLevel

UINT16 mProtectedModeEdgeLevel = 0x0000

Definition at line 36 of file 8259.c.

◆ mProtectedModeMask

UINT16 mProtectedModeMask = 0xffff

Definition at line 34 of file 8259.c.

◆ mSlaveBase

UINT8 mSlaveBase = 0xff

Definition at line 32 of file 8259.c.