From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] ahci irq bug
Date: Sat, 4 Apr 2009 18:04:54 -0400 [thread overview]
Message-ID: <daa9da57ea950c8ec2f134d1e2712400@quanstro.net> (raw)
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
reply other threads:[~2009-04-04 22:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=daa9da57ea950c8ec2f134d1e2712400@quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).