* [9fans] ahci irq bug
@ 2009-04-04 22:04 erik quanstrom
0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2009-04-04 22:04 UTC (permalink / raw)
To: 9fans
in belated regression testing, i found that i introduced a
bug in ahci when fixing hbas with a sparse pi register.
(it's possible to have a non-contiguous set of available ports.
this is often the case on last-generation laptops.)
the symptom is that drives on the highest-numbered port
never see interrupts. the simplist change is to replace
/n/sources/plan9/sys/src/9/pc/sdiahci.c:1925
c->mport = c->hba->cap & ((1<<5)-1);
with
c->mport = (c->hba->cap & 0x1f) + 1;
however it's not entirely clear from the ahci 0.99—1.3 standards
that with sparse ports, that the highest bit set in the pi
register is < (c->hba->cap & 0x1f) + 1, though that's implied.
dodging this problem results in a more robust and efficient interrupt
routine (the only place where mport is used), so i think a
better but slightly bigger change is to get rid of c->mport
entirely and change (>)/add (+) these two lines:
static void
iainterrupt(Ureg*, void *a)
{
int i;
ulong cause, m;
Ctlr *c;
Drive *d;
c = a;
ilock(c);
cause = c->hba->isr;
> for(i = 0; cause; i++){
m = 1 << i;
if((cause & m) == 0)
continue;
+ cause &= ~m;
this was the change i made in the contrib packages
quanstro/sd and quanstro/9load-e820.
- erik
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-04 22:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-04 22:04 [9fans] ahci irq bug erik quanstrom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).