Subject: Re: Interrupts
To: netbsd-macppc <port-macppc@NetBSD.ORG>
From: Donald Lee <MacPPC1@caution.icompute.com>
List: port-macppc
Date: 12/06/2004 00:25:31
At 12:28 AM -0500 12/6/04, Michael wrote:
>Hello,
>
>> This 'solution' is far from optimal - an active line without the corresponding interrupt bit set doesn't always mean a lost interrupt,
>> and just ORing the level register on the interrupt register also locks things up - no idea why though.
>> But I think we need something like this - better call IRQ handlers a little more often than lose interupts and get all kinds of
>> nastiness.
>
>Just had a look at the Darwin source ( thanks Allan for kicking me there ) - see http://darwinsource.opendarwin.org/10.0.1/xnu-124.1/iokit/Drivers/platform/drvAppleGrandCentral/ - the interesting part is this:

I also think this snippet is mighty interesting... note comment.

void GrandCentralInterruptController::enableVector(long vectorNumber,
						   IOInterruptVector *vector)
{
  unsigned long     maskTmp;
  
  maskTmp = lwbrx(maskReg);
  maskTmp |= (1 << vectorNumber);
  stwbrx(maskTmp, maskReg);
  eieio();
  if (lwbrx(levelsReg) & (1 << vectorNumber)) {
    // lost the interrupt
    causeVector(vectorNumber, vector);
  }
}


-dgl-