The Pedigree Project  0.1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Pic Class Reference

#include <Pic.h>

+ Inheritance diagram for Pic:
+ Collaboration diagram for Pic:

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 Picinstance ()
 
static Picinstance ()
 

Private Member Functions

 Pic () INITIALISATION_ONLY
 
virtual ~Pic ()
 
 Pic (const Pic &)
 
Picoperator= (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 &)
 
Picoperator= (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
 
IrqHandlerm_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 ()
 

Detailed Description

The x86/x64 programmable interrupt controller as IrqManager

Definition at line 41 of file mach_pc/Pic.h.

Constructor & Destructor Documentation

Pic::Pic ( )
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().

+ Here is the caller graph for this function:

virtual Pic::~Pic ( )
inlineprivatevirtual

The destructor

Definition at line 76 of file mach_pc/Pic.h.

References interrupt(), operator=(), Pic(), and spurious().

Pic::Pic ( const Pic )
private

The copy-constructor

Note
NOT implemented
Pic::Pic ( )
private

The default constructor

virtual Pic::~Pic ( )
inlineprivatevirtual

The destructor

Definition at line 58 of file malta/Pic.h.

References interrupt(), operator=(), and Pic().

Pic::Pic ( const Pic )
private

The copy-constructor

Note
NOT implemented

Member Function Documentation

virtual void Pic::acknowledgeIrq ( irq_id_t  Id)
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.

Parameters
[in]Idthe irq's identifier

Implements IrqManager.

void Pic::acknowledgeIrq ( irq_id_t  Id)
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.

Parameters
[in]Idthe irq's identifier

Implements IrqManager.

Definition at line 103 of file mach_pc/Pic.cc.

Referenced by instance().

+ Here is the caller graph for this function:

bool Pic::control ( uint8_t  irq,
ControlCode  code,
size_t  argument 
)
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().

+ Here is the caller graph for this function:

bool Pic::initialise ( )

Initialises the PIC hardware and registers the interrupts with the InterruptManager.

Returns
true, if successfull, false otherwise
bool Pic::initialise ( )

Initialises the PIC hardware and registers the interrupts with the InterruptManager.

Returns
true, if successfull, false otherwise

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().

+ Here is the caller graph for this function:

static Pic& Pic::instance ( )
inlinestatic

Get the Pic class instance

Returns
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().

static Pic& Pic::instance ( )
inlinestatic

Get the Pic class instance

Returns
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().

+ Here is the caller graph for this function:

virtual void Pic::interrupt ( size_t  nInterruptNumber,
InterruptState &  state 
)
privatevirtual

Called when the handler is registered with the interrupt manager and the interrupt occurred

Parameters
[in]nInterruptNumberthe interrupt number
[in]statereference to the state before the interrupt

Implements InterruptHandler.

void Pic::interrupt ( size_t  nInterruptNumber,
InterruptState &  state 
)
privatevirtual

Called when the handler is registered with the interrupt manager and the interrupt occurred

Parameters
[in]nInterruptNumberthe interrupt number
[in]statereference 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().

+ Here is the caller graph for this function:

Pic& Pic::operator= ( const Pic )
private

The assignment operator

Note
NOT implemented
Pic& Pic::operator= ( const Pic )
private

The assignment operator

Note
NOT implemented

Referenced by ~Pic().

+ Here is the caller graph for this function:

irq_id_t Pic::registerIsaIrqHandler ( uint8_t  irq,
IrqHandler handler,
bool  bEdge = false 
)
virtual

Register an ISA irq

Parameters
[in]irqthe ISA irq number (from 0 to 15)
[in]handlerpointer to the IrqHandler class
[in]bEdgewhether this IRQ is edge triggered or not
Returns
the irq's identifier

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().

+ Here is the caller graph for this function:

irq_id_t Pic::registerPciIrqHandler ( IrqHandler handler,
Device pDevice 
)
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().

+ Here is the caller graph for this function:

bool Pic::spurious ( size_t  irq)
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().

+ Here is the caller graph for this function:

void Pic::tick ( )
virtual

Called every millisecond, typically handles IRQ mitigation.

Reimplemented from IrqManager.

Definition at line 41 of file mach_pc/Pic.cc.

Referenced by instance().

+ Here is the caller graph for this function:

virtual void Pic::unregisterHandler ( irq_id_t  Id,
IrqHandler handler 
)
virtual

Unregister a previously registered IrqHandler

Parameters
[in]Idthe irq's identifier

Implements IrqManager.

void Pic::unregisterHandler ( irq_id_t  Id,
IrqHandler handler 
)
virtual

Unregister a previously registered IrqHandler

Parameters
[in]Idthe 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().

+ Here is the caller graph for this function:

Member Data Documentation

IrqHandler* Pic::m_Handler[16]
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.

List<IrqHandler *> Pic::m_Handler[16]
private

The IRQ handler

Definition at line 104 of file mach_pc/Pic.h.

Referenced by control(), interrupt(), Pic(), registerIsaIrqHandler(), registerPciIrqHandler(), and unregisterHandler().

bool Pic::m_HandlerEdge[16]
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().

static Pic Pic::m_Instance
staticprivate

The Pic instance

Definition at line 120 of file mach_pc/Pic.h.

Referenced by instance().

uint8_t Pic::m_InterruptMask
private

Interrupt enable mask.

Definition at line 114 of file mach_pc/Pic.h.

Referenced by interrupt().

size_t Pic::m_IrqCount[16]
private

IRQ counts for given handlers

Definition at line 108 of file mach_pc/Pic.h.

Referenced by initialise(), and interrupt().

Spinlock Pic::m_Lock
private

Main lock for all modifications

Definition at line 117 of file mach_pc/Pic.h.

IoPort Pic::m_MasterPort
private

The master PIC I/O Port range

Definition at line 101 of file mach_pc/Pic.h.

Referenced by initialise(), interrupt(), and spurious().

bool Pic::m_MitigatedIrqs[16]
private

Mitigated IRQs

Definition at line 110 of file mach_pc/Pic.h.

Referenced by initialise().

size_t Pic::m_MitigationThreshold[16]
private

Mitigation thresholds

Definition at line 112 of file mach_pc/Pic.h.

Referenced by control(), and initialise().

IoPort Pic::m_SlavePort
private

The slave PIC I/O Port range

Definition at line 99 of file mach_pc/Pic.h.

Referenced by initialise(), interrupt(), and spurious().


The documentation for this class was generated from the following files: