From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: erik quanstrom Date: Sat, 4 Apr 2009 18:04:54 -0400 To: 9fans@9fans.net MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: [9fans] ahci irq bug Topicbox-Message-UUID: d1ae92ec-ead4-11e9-9d60-3106f5b1d025 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