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

#include <PicIrqState.h>

+ Collaboration diagram for PicControllerStateGate:

Classes

struct  PendingActions
 

Public Member Functions

bool tryAcquireClean ()
 
bool tryClaim ()
 
size_t currentLifetime (size_t irq) const
 
void beginLineTransition (size_t irq)
 
size_t finishLineTransition (size_t irq)
 
bool queueEntry (size_t irq, size_t lifetime)
 
bool queueTail (size_t irq, size_t lifetime, bool owesEoi)
 
bool queueTailRecord (size_t irq)
 
bool takePending (PendingActions &actions)
 
bool releaseIfIdle ()
 
bool hasPending () const
 
bool urgentPending () const
 
void requestContinuation ()
 
bool relinquishOwnerForContinuation ()
 

Static Public Attributes

static constexpr size_t LineCount = PicIrqState::LineCount
 
static constexpr size_t CountBits = 12
 
static constexpr size_t CountMask = (static_cast<size_t>(1) << CountBits) - 1
 
static constexpr size_t LifetimeMask = static_cast<size_t>(~static_cast<size_t>(0)) >> CountBits
 
static constexpr size_t TransitionLifetime = LifetimeMask
 

Private Member Functions

void replaceLifetime (size_t irq, size_t lifetime)
 
void publishPending (bool urgent)
 
 PicControllerStateGate (const PicControllerStateGate &)=delete
 
PicControllerStateGateoperator= (const PicControllerStateGate &)=delete
 

Static Private Member Functions

static size_t tagged (size_t lifetime, size_t count)
 
static size_t taggedLifetime (size_t value)
 
static size_t taggedCount (size_t value)
 
static void addStale (size_t &counter, size_t count)
 
static void queueTagged (size_t &currentCounter, size_t &staleCounter, size_t lifetime)
 
static void takeTagged (size_t &currentCounter, size_t &staleCounter, size_t lifetime, size_t &current, size_t &stale)
 

Private Attributes

size_t m_State
 
size_t m_LifetimeGenerations [LineCount]
 
size_t m_LineLifetimes [LineCount]
 
size_t m_EntryCounts [LineCount]
 
size_t m_TailNoEoiCounts [LineCount]
 
size_t m_TailEoiCounts [LineCount]
 
size_t m_StaleEntryCounts [LineCount]
 
size_t m_StaleTailNoEoiCounts [LineCount]
 
size_t m_StaleTailEoiCounts [LineCount]
 

Static Private Attributes

static constexpr size_t Clean = 0
 
static constexpr size_t Owner = 1U << 0
 
static constexpr size_t Pending = 1U << 1
 
static constexpr size_t Urgent = 1U << 2
 

Detailed Description

Lock-free ownership handoff for access to the shared 8259 controllers.

Producers first account their deferred action, then publish Pending before attempting to become Owner. The current owner can therefore clear Pending and retain ownership in one compare-and-swap, while release can only succeed from an exactly idle Owner state.

Definition at line 489 of file PicIrqState.h.

Constructor & Destructor Documentation

◆ PicControllerStateGate()

PicControllerStateGate::PicControllerStateGate ( )
inline

Definition at line 535 of file PicIrqState.h.

Member Function Documentation

◆ addStale()

static void PicControllerStateGate::addStale ( size_t &  counter,
size_t  count 
)
inlinestaticprivate

Definition at line 691 of file PicIrqState.h.

◆ beginLineTransition()

void PicControllerStateGate::beginLineTransition ( size_t  irq)
inline

Prevents in-flight old work from qualifying against a changing line.

Definition at line 573 of file PicIrqState.h.

◆ currentLifetime()

size_t PicControllerStateGate::currentLifetime ( size_t  irq) const
inline

Definition at line 567 of file PicIrqState.h.

◆ finishLineTransition()

size_t PicControllerStateGate::finishLineTransition ( size_t  irq)
inline

Publishes a fresh handler-set lifetime after a line transition.

Definition at line 579 of file PicIrqState.h.

◆ hasPending()

bool PicControllerStateGate::hasPending ( ) const
inline

Definition at line 653 of file PicIrqState.h.

◆ publishPending()

void PicControllerStateGate::publishPending ( bool  urgent)
inlineprivate

Definition at line 750 of file PicIrqState.h.

◆ queueEntry()

bool PicControllerStateGate::queueEntry ( size_t  irq,
size_t  lifetime 
)
inline

Queues controller-entry work and elects an owner if one is needed.

Definition at line 592 of file PicIrqState.h.

References tryClaim().

◆ queueTagged()

static void PicControllerStateGate::queueTagged ( size_t &  currentCounter,
size_t &  staleCounter,
size_t  lifetime 
)
inlinestaticprivate

Definition at line 697 of file PicIrqState.h.

◆ queueTail()

bool PicControllerStateGate::queueTail ( size_t  irq,
size_t  lifetime,
bool  owesEoi 
)
inline

Queues controller-tail work, preserving its EOI obligation.

Definition at line 600 of file PicIrqState.h.

References tryClaim().

◆ queueTailRecord()

bool PicControllerStateGate::queueTailRecord ( size_t  irq)
inline

Announces a complete tail record published in separate fixed storage.

Definition at line 612 of file PicIrqState.h.

References tryClaim().

◆ releaseIfIdle()

bool PicControllerStateGate::releaseIfIdle ( )
inline

Releases ownership only if no producer has published pending work.

Definition at line 647 of file PicIrqState.h.

◆ relinquishOwnerForContinuation()

bool PicControllerStateGate::relinquishOwnerForContinuation ( )
inline

Hands only non-urgent pending work to a guaranteed continuation.

Definition at line 667 of file PicIrqState.h.

◆ replaceLifetime()

void PicControllerStateGate::replaceLifetime ( size_t  irq,
size_t  lifetime 
)
inlineprivate

Definition at line 730 of file PicIrqState.h.

◆ requestContinuation()

void PicControllerStateGate::requestContinuation ( )
inline

Keeps ownership discoverable while a thread-context continuation wakes.

Definition at line 662 of file PicIrqState.h.

◆ tagged()

static size_t PicControllerStateGate::tagged ( size_t  lifetime,
size_t  count 
)
inlinestaticprivate

Definition at line 679 of file PicIrqState.h.

◆ taggedCount()

static size_t PicControllerStateGate::taggedCount ( size_t  value)
inlinestaticprivate

Definition at line 687 of file PicIrqState.h.

◆ taggedLifetime()

static size_t PicControllerStateGate::taggedLifetime ( size_t  value)
inlinestaticprivate

Definition at line 683 of file PicIrqState.h.

◆ takePending()

bool PicControllerStateGate::takePending ( PendingActions actions)
inline

Atomically claims the published batch while retaining ownership.

Definition at line 619 of file PicIrqState.h.

◆ takeTagged()

static void PicControllerStateGate::takeTagged ( size_t &  currentCounter,
size_t &  staleCounter,
size_t  lifetime,
size_t &  current,
size_t &  stale 
)
inlinestaticprivate

Definition at line 717 of file PicIrqState.h.

◆ tryAcquireClean()

bool PicControllerStateGate::tryAcquireClean ( )
inline

Acquires ownership only when no work is already pending.

Definition at line 549 of file PicIrqState.h.

◆ tryClaim()

bool PicControllerStateGate::tryClaim ( )
inline

Claims an unowned clean or pending gate in one attempt.

Definition at line 556 of file PicIrqState.h.

Referenced by queueEntry(), queueTail(), and queueTailRecord().

+ Here is the caller graph for this function:

◆ urgentPending()

bool PicControllerStateGate::urgentPending ( ) const
inline

Definition at line 657 of file PicIrqState.h.

Member Data Documentation

◆ Clean

constexpr size_t PicControllerStateGate::Clean = 0
staticconstexprprivate

Definition at line 674 of file PicIrqState.h.

◆ CountBits

constexpr size_t PicControllerStateGate::CountBits = 12
staticconstexpr

Definition at line 492 of file PicIrqState.h.

◆ CountMask

constexpr size_t PicControllerStateGate::CountMask = (static_cast<size_t>(1) << CountBits) - 1
staticconstexpr

Definition at line 493 of file PicIrqState.h.

◆ LifetimeMask

constexpr size_t PicControllerStateGate::LifetimeMask = static_cast<size_t>(~static_cast<size_t>(0)) >> CountBits
staticconstexpr

Definition at line 494 of file PicIrqState.h.

◆ LineCount

constexpr size_t PicControllerStateGate::LineCount = PicIrqState::LineCount
staticconstexpr

Definition at line 491 of file PicIrqState.h.

◆ m_EntryCounts

size_t PicControllerStateGate::m_EntryCounts[LineCount]
private

Definition at line 757 of file PicIrqState.h.

◆ m_LifetimeGenerations

size_t PicControllerStateGate::m_LifetimeGenerations[LineCount]
private

Definition at line 755 of file PicIrqState.h.

◆ m_LineLifetimes

size_t PicControllerStateGate::m_LineLifetimes[LineCount]
private

Definition at line 756 of file PicIrqState.h.

◆ m_StaleEntryCounts

size_t PicControllerStateGate::m_StaleEntryCounts[LineCount]
private

Definition at line 760 of file PicIrqState.h.

◆ m_StaleTailEoiCounts

size_t PicControllerStateGate::m_StaleTailEoiCounts[LineCount]
private

Definition at line 762 of file PicIrqState.h.

◆ m_StaleTailNoEoiCounts

size_t PicControllerStateGate::m_StaleTailNoEoiCounts[LineCount]
private

Definition at line 761 of file PicIrqState.h.

◆ m_State

size_t PicControllerStateGate::m_State
private

Definition at line 754 of file PicIrqState.h.

◆ m_TailEoiCounts

size_t PicControllerStateGate::m_TailEoiCounts[LineCount]
private

Definition at line 759 of file PicIrqState.h.

◆ m_TailNoEoiCounts

size_t PicControllerStateGate::m_TailNoEoiCounts[LineCount]
private

Definition at line 758 of file PicIrqState.h.

◆ Owner

constexpr size_t PicControllerStateGate::Owner = 1U << 0
staticconstexprprivate

Definition at line 675 of file PicIrqState.h.

◆ Pending

constexpr size_t PicControllerStateGate::Pending = 1U << 1
staticconstexprprivate

Definition at line 676 of file PicIrqState.h.

◆ TransitionLifetime

constexpr size_t PicControllerStateGate::TransitionLifetime = LifetimeMask
staticconstexpr

Definition at line 495 of file PicIrqState.h.

◆ Urgent

constexpr size_t PicControllerStateGate::Urgent = 1U << 2
staticconstexprprivate

Definition at line 677 of file PicIrqState.h.


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