The Pedigree Project
0.1
|
#include <Pic.h>
Public Member Functions | |
virtual irq_id_t | registerIsaIrqHandler (uint8_t irq, IrqHandler *handler, bool bEdge=false) |
virtual irq_id_t | registerPciIrqHandler (IrqHandler *handler, Device *pDevice) |
virtual void | acknowledgeIrq (irq_id_t Id) |
virtual void | unregisterHandler (irq_id_t Id, IrqHandler *handler) |
bool | initialise () INITIALISATION_ONLY |
virtual void | tick () |
virtual bool | control (uint8_t irq, ControlCode code, size_t argument) |
virtual irq_id_t | registerIsaIrqHandler (uint8_t irq, IrqHandler *handler) |
virtual irq_id_t | registerPciIrqHandler (IrqHandler *handler) |
virtual void | acknowledgeIrq (irq_id_t Id) |
virtual void | unregisterHandler (irq_id_t Id, IrqHandler *handler) |
bool | initialise () INITIALISATION_ONLY |
Static Public Member Functions | |
static Pic & | instance () |
static Pic & | instance () |
Private Member Functions | |
Pic () INITIALISATION_ONLY | |
virtual | ~Pic () |
Pic (const Pic &) | |
Pic & | operator= (const Pic &) |
virtual void | interrupt (size_t interruptNumber, InterruptState &state) |
void | eoi (uint8_t irq) |
void | enable (uint8_t irq, bool enable) |
void | enableAll (bool enable) |
bool | spurious (size_t irq) |
Pic () INITIALISATION_ONLY | |
virtual | ~Pic () |
Pic (const Pic &) | |
Pic & | operator= (const Pic &) |
virtual void | interrupt (size_t interruptNumber, InterruptState &state) |
void | eoi (uint8_t irq) |
void | enable (uint8_t irq, bool enable) |
void | enableAll (bool enable) |
virtual | ~InterruptHandler () |
Private Attributes | |
IoPort | m_SlavePort |
IoPort | m_MasterPort |
List< IrqHandler * > | m_Handler [16] |
bool | m_HandlerEdge [16] |
size_t | m_IrqCount [16] |
bool | m_MitigatedIrqs [16] |
size_t | m_MitigationThreshold [16] |
uint8_t | m_InterruptMask |
Spinlock | m_Lock |
IrqHandler * | m_Handler [16] |
Static Private Attributes | |
static Pic | m_Instance |
Additional Inherited Members | |
Public Types inherited from IrqManager | |
enum | ControlCode { MitigationThreshold } |
Protected Member Functions inherited from IrqManager | |
IrqManager () | |
virtual | ~IrqManager () |
The x86/x64 programmable interrupt controller as IrqManager
Definition at line 41 of file mach_pc/Pic.h.
|
private |
The default constructor
Definition at line 171 of file mach_pc/Pic.cc.
References List< T, nodePoolSize >::clear(), m_Handler, and m_HandlerEdge.
Referenced by instance(), and ~Pic().
|
inlineprivatevirtual |
The destructor
Definition at line 76 of file mach_pc/Pic.h.
References interrupt(), operator=(), Pic(), and spurious().
|
private |
The copy-constructor
|
private |
The default constructor
|
inlineprivatevirtual |
The destructor
Definition at line 58 of file malta/Pic.h.
References interrupt(), operator=(), and Pic().
|
private |
The copy-constructor
|
virtual |
Acknoledge the IRQ reception, in case you returned false in the IrqHandler::irq() function. If this is not called there won't be any following irqs.
[in] | Id | the irq's identifier |
Implements IrqManager.
|
virtual |
Acknoledge the IRQ reception, in case you returned false in the IrqHandler::irq() function. If this is not called there won't be any following irqs.
[in] | Id | the irq's identifier |
Implements IrqManager.
Definition at line 103 of file mach_pc/Pic.cc.
Referenced by instance().
|
virtual |
Controls specific elements of a given IRQ
Reimplemented from IrqManager.
Definition at line 45 of file mach_pc/Pic.cc.
References LIKELY, m_Handler, m_MitigationThreshold, and UNLIKELY.
Referenced by instance().
bool Pic::initialise | ( | ) |
Initialises the PIC hardware and registers the interrupts with the InterruptManager.
bool Pic::initialise | ( | ) |
Initialises the PIC hardware and registers the interrupts with the InterruptManager.
Definition at line 131 of file mach_pc/Pic.cc.
References IoPort::allocate(), InterruptManager::instance(), m_IrqCount, m_MasterPort, m_MitigatedIrqs, m_MitigationThreshold, m_SlavePort, InterruptManager::registerInterruptHandler(), and IoPort::write8().
Referenced by Pc::initialise(), and instance().
|
inlinestatic |
Get the Pic class instance
Definition at line 36 of file malta/Pic.h.
References acknowledgeIrq(), INITIALISATION_ONLY, initialise(), m_Instance, Pic(), registerIsaIrqHandler(), registerPciIrqHandler(), and unregisterHandler().
|
inlinestatic |
Get the Pic class instance
Definition at line 46 of file mach_pc/Pic.h.
References acknowledgeIrq(), control(), INITIALISATION_ONLY, initialise(), m_Instance, Pic(), registerIsaIrqHandler(), registerPciIrqHandler(), tick(), and unregisterHandler().
Referenced by Pc::getNumVga(), and Pc::initialise().
|
privatevirtual |
Called when the handler is registered with the interrupt manager and the interrupt occurred
[in] | nInterruptNumber | the interrupt number |
[in] | state | reference to the state before the interrupt |
Implements InterruptHandler.
|
privatevirtual |
Called when the handler is registered with the interrupt manager and the interrupt occurred
[in] | nInterruptNumber | the interrupt number |
[in] | state | reference to the state before the interrupt |
Implements InterruptHandler.
Definition at line 204 of file mach_pc/Pic.cc.
References Dec, List< T, nodePoolSize >::end(), ERROR, Hex, LIKELY, m_Handler, m_HandlerEdge, m_InterruptMask, m_IrqCount, m_MasterPort, m_SlavePort, NOTICE, IoPort::read8(), spurious(), and IoPort::write8().
Referenced by ~Pic().
The assignment operator
Referenced by ~Pic().
|
virtual |
Register an ISA irq
[in] | irq | the ISA irq number (from 0 to 15) |
[in] | handler | pointer to the IrqHandler class |
[in] | bEdge | whether this IRQ is edge triggered or not |
Implements IrqManager.
Definition at line 72 of file mach_pc/Pic.cc.
References m_Handler, m_HandlerEdge, List< T, nodePoolSize >::pushBack(), and UNLIKELY.
Referenced by instance().
|
virtual |
Register a PCI irq
Implements IrqManager.
Definition at line 86 of file mach_pc/Pic.cc.
References Device::getInterruptNumber(), m_Handler, m_HandlerEdge, List< T, nodePoolSize >::pushBack(), and UNLIKELY.
Referenced by instance().
|
private |
Handle a potentially-spurious IRQ.
Definition at line 182 of file mach_pc/Pic.cc.
References m_MasterPort, m_SlavePort, IoPort::read8(), and IoPort::write8().
Referenced by interrupt(), and ~Pic().
|
virtual |
Called every millisecond, typically handles IRQ mitigation.
Reimplemented from IrqManager.
Definition at line 41 of file mach_pc/Pic.cc.
Referenced by instance().
|
virtual |
Unregister a previously registered IrqHandler
[in] | Id | the irq's identifier |
Implements IrqManager.
|
virtual |
Unregister a previously registered IrqHandler
[in] | Id | the irq's identifier |
Implements IrqManager.
Definition at line 111 of file mach_pc/Pic.cc.
References List< T, nodePoolSize >::end(), List< T, nodePoolSize >::erase(), and m_Handler.
Referenced by instance().
|
private |
The slave PIC I/O Port range The master PIC I/O Port range The IRQ handler
Definition at line 83 of file malta/Pic.h.
|
private |
The IRQ handler
Definition at line 104 of file mach_pc/Pic.h.
Referenced by control(), interrupt(), Pic(), registerIsaIrqHandler(), registerPciIrqHandler(), and unregisterHandler().
|
private |
Whether the IRQs are edge or level triggered
Definition at line 106 of file mach_pc/Pic.h.
Referenced by interrupt(), Pic(), registerIsaIrqHandler(), and registerPciIrqHandler().
|
staticprivate |
|
private |
|
private |
IRQ counts for given handlers
Definition at line 108 of file mach_pc/Pic.h.
Referenced by initialise(), and interrupt().
|
private |
Main lock for all modifications
Definition at line 117 of file mach_pc/Pic.h.
|
private |
The master PIC I/O Port range
Definition at line 101 of file mach_pc/Pic.h.
Referenced by initialise(), interrupt(), and spurious().
|
private |
|
private |
Mitigation thresholds
Definition at line 112 of file mach_pc/Pic.h.
Referenced by control(), and initialise().
|
private |
The slave PIC I/O Port range
Definition at line 99 of file mach_pc/Pic.h.
Referenced by initialise(), interrupt(), and spurious().