The Pedigree Project 0.1
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
IrqManager Class Referenceabstract

#include <IrqManager.h>

+ Inheritance diagram for IrqManager:
+ Collaboration diagram for IrqManager:

Public Types

enum  ControlCode { MitigationThreshold }
 

Public Member Functions

virtual irq_id_t registerIsaIrqHandler (uint8_t irq, IrqHandler *handler, const IrqPolicy &policy)=0
 
virtual irq_id_t registerPciIrqHandler (IrqHandler *handler, Device *pDevice, const IrqPolicy &policy)=0
 
virtual irq_id_t registerPciMessageIrqHandler (IrqHandler *handler, Device *pDevice, const IrqPolicy &intxFallbackPolicy)
 
virtual bool registerPciMsixIrqHandlers (Device *device, IrqHandler *const *handlers, size_t count, irq_id_t *ids, bool &fallbackSafe, const size_t *processors=nullptr)
 
virtual irq_id_t registerHardIsaIrqHandler (uint8_t irq, HardIrqHandler *handler, const IrqPolicy &policy)=0
 
virtual irq_id_t registerHardPciIrqHandler (HardIrqHandler *handler, Device *pDevice, const IrqPolicy &policy)=0
 
virtual irq_id_t registerHardPciMessageIrqHandler (HardIrqHandler *handler, Device *pDevice, const IrqPolicy &intxFallbackPolicy)
 
virtual irq_id_t registerSchedulerIrqHandler (uint8_t irq, SchedulerIrqHandler *handler, const IrqPolicy &policy)
 
virtual bool unregisterSchedulerIrqHandler (irq_id_t Id, SchedulerIrqHandler *handler)
 
virtual bool unregisterHandler (irq_id_t Id, IrqHandlerBase *handler)=0
 
virtual void enable (uint8_t irq, bool enable)=0
 
virtual size_t snapshotIrqLines (IrqLineDiagnosticSnapshot *out, size_t capacity) const
 
virtual void tick ()
 
virtual bool control (uint8_t irq, ControlCode code, size_t argument)
 

Protected Member Functions

 IrqManager ()
 
virtual ~IrqManager ()
 

Private Member Functions

 IrqManager (const IrqManager &)
 
IrqManager & operator= (const IrqManager &)
 

Detailed Description

This class handles IRQ (un)registration

Definition at line 282 of file include/pedigree/kernel/machine/IrqManager.h.

Member Enumeration Documentation

◆ ControlCode

Control codes for the control function

Definition at line 285 of file include/pedigree/kernel/machine/IrqManager.h.

Constructor & Destructor Documentation

◆ IrqManager() [1/2]

IrqManager::IrqManager ( )
protecteddefault

The default constructor

◆ ~IrqManager()

IrqManager::~IrqManager ( )
protectedvirtualdefault

The destructor

◆ IrqManager() [2/2]

IrqManager::IrqManager ( const IrqManager &  )
private

The copy-constructor

Note
NOT implemented

Member Function Documentation

◆ control()

bool IrqManager::control ( uint8_t  irq,
ControlCode  code,
size_t  argument 
)
virtual

Controls specific elements of a given IRQ

Reimplemented in Pic, and HostedIrqManager.

Definition at line 55 of file IrqManager.cc.

◆ operator=()

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

The assignment operator

Note
NOT implemented

◆ registerHardIsaIrqHandler()

virtual irq_id_t IrqManager::registerHardIsaIrqHandler ( uint8_t  irq,
HardIrqHandler *  handler,
const IrqPolicy &  policy 
)
pure virtual

Register an ISA handler which must run in hard IRQ context.

Implemented in Pic, HostedIrqManager, and VirtIrqManager.

Referenced by SplitIrqHandler::registerIsaSplitIrq().

+ Here is the caller graph for this function:

◆ registerHardPciIrqHandler()

virtual irq_id_t IrqManager::registerHardPciIrqHandler ( HardIrqHandler *  handler,
Device *  pDevice,
const IrqPolicy &  policy 
)
pure virtual

Register a PCI handler which must run in hard IRQ context.

Implemented in HostedIrqManager, VirtIrqManager, and Pic.

Referenced by registerHardPciMessageIrqHandler().

+ Here is the caller graph for this function:

◆ registerHardPciMessageIrqHandler()

irq_id_t IrqManager::registerHardPciMessageIrqHandler ( HardIrqHandler *  handler,
Device *  pDevice,
const IrqPolicy &  intxFallbackPolicy 
)
virtual

Prefer a PCI message interrupt for a hard handler, with an INTx fallback.

Reimplemented in Pic, and VirtIrqManager.

Definition at line 36 of file IrqManager.cc.

References registerHardPciIrqHandler().

◆ registerIsaIrqHandler()

virtual irq_id_t IrqManager::registerIsaIrqHandler ( uint8_t  irq,
IrqHandler *  handler,
const IrqPolicy &  policy 
)
pure virtual

Register an ISA irq

Parameters
[in]irqthe ISA irq number (from 0 to 15)
[in]handlerpointer to the IrqHandler class
[in]policyelectrical, acknowledgement, and completion policy
Returns
the irq's identifier

Implemented in Pic, HostedIrqManager, and VirtIrqManager.

Referenced by Ps2Controller::initialise3(), Rtc::initialise3(), and PciAtaController::PciAtaController().

+ Here is the caller graph for this function:

◆ registerPciIrqHandler()

virtual irq_id_t IrqManager::registerPciIrqHandler ( IrqHandler *  handler,
Device *  pDevice,
const IrqPolicy &  policy 
)
pure virtual

Register a PCI irq

Implemented in HostedIrqManager, VirtIrqManager, and Pic.

Referenced by Ne2k::Ne2k(), Nic3C90x::Nic3C90x(), PciAtaController::PciAtaController(), and registerPciMessageIrqHandler().

+ Here is the caller graph for this function:

◆ registerPciMessageIrqHandler()

irq_id_t IrqManager::registerPciMessageIrqHandler ( IrqHandler *  handler,
Device *  pDevice,
const IrqPolicy &  intxFallbackPolicy 
)
virtual

Prefer a PCI message interrupt, falling back to INTx with the given policy.

Reimplemented in Pic, and VirtIrqManager.

Definition at line 25 of file IrqManager.cc.

References registerPciIrqHandler().

◆ registerPciMsixIrqHandlers()

bool IrqManager::registerPciMsixIrqHandlers ( Device *  device,
IrqHandler *const *  handlers,
size_t  count,
irq_id_t *  ids,
bool &  fallbackSafe,
const size_t *  processors = nullptr 
)
virtual

Register distinct MSI-X entries as one group. Failure permits a fallback only when fallbackSafe is true. Optional dense processor indices are placement hints; platforms without affinity support may retain their default destination.

Reimplemented in Pic, and VirtIrqManager.

Definition at line 30 of file IrqManager.cc.

◆ registerSchedulerIrqHandler()

irq_id_t IrqManager::registerSchedulerIrqHandler ( uint8_t  irq,
SchedulerIrqHandler *  handler,
const IrqPolicy &  policy 
)
virtual

Install the platform's dedicated scheduler-timer interrupt source.

Unlike a generic hard handler, this callback is the terminal action for an occurrence and is allowed to abandon its interrupt frame. Platforms which do not provide a direct scheduler route reject the request.

Reimplemented in Pic, HostedIrqManager, and VirtIrqManager.

Definition at line 41 of file IrqManager.cc.

Referenced by HostedSchedulerTimer::initialise(), and Pit::initialise().

+ Here is the caller graph for this function:

◆ snapshotIrqLines()

size_t IrqManager::snapshotIrqLines ( IrqLineDiagnosticSnapshot *  out,
size_t  capacity 
) const
virtual

Copies up to capacity detached line diagnostics without taking an IRQ manager or handler-registry lock. Unsupported managers return zero.

Reimplemented in Pic.

Definition at line 49 of file IrqManager.cc.

Referenced by IrqsCommand::execute().

+ Here is the caller graph for this function:

◆ tick()

void IrqManager::tick ( )
virtual

Called every millisecond, typically handles IRQ mitigation.

Reimplemented in Pic.

Definition at line 53 of file IrqManager.cc.

Referenced by Rtc::processElapsedTime(), and HostedTimer::processTimerBatch().

+ Here is the caller graph for this function:

◆ unregisterHandler()

virtual bool IrqManager::unregisterHandler ( irq_id_t  Id,
IrqHandlerBase *  handler 
)
pure virtual

Unregister a previously registered IrqHandler.

A successful return is an ownership barrier: no callback can begin or remain active for the handler. A callback cannot synchronously remove itself, and an atomic context cannot wait for an active callback; those requests return false.

Parameters
[in]Idthe irq's identifier
Returns
true if removal completed synchronously

Implemented in Pic, HostedIrqManager, and VirtIrqManager.

Referenced by PciAtaController::shutdown(), SplitIrqHandler::shutdownSplitIrq(), and Ps2Controller::uninitialise().

+ Here is the caller graph for this function:

◆ unregisterSchedulerIrqHandler()

bool IrqManager::unregisterSchedulerIrqHandler ( irq_id_t  Id,
SchedulerIrqHandler *  handler 
)
virtual

Stop admitting future callbacks for the exact scheduler source. The source must be quiesced first unless removal synchronously masks its controller line. Its handler has static machine lifetime because an already-admitted callback may not return.

Reimplemented in Pic, HostedIrqManager, and VirtIrqManager.

Definition at line 45 of file IrqManager.cc.

Referenced by HostedSchedulerTimer::initialise(), HostedSchedulerTimer::uninitialise(), and Pit::uninitialise().

+ Here is the caller graph for this function:

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