Subject: Re: ahc lossage on SOYO motherboard
To: Justin T. Gibbs <riz@boogers.sf.ca.us>
From: Jeff Rizzo <riz@boogers.sf.ca.us>
List: port-i386
Date: 03/09/1999 16:22:14
On Tue, Mar 09, 1999 at 03:19:14PM -0700, Justin T. Gibbs wrote:
> >I also loaded FreeBSD 3.1 on the system as a test; it seems to work OK.
> >Not to disparage FreeBSD, NetBSD's what I've got on all my other systems,
> >and by gum, I'd like it here! So, the hardware itself seems OK. Just
> >in case it triggers anything for anyone, here's what a FreeBSD kernel
> >with AHC_DEBUG says (though I had to edit some stuff out, as it didn't
> >compile cleanly with AHC_DEBUG):
>
> Booting with -v would be more useful. I haven't used the AHC_DEBUG
> stuff in a long time.
Noted for future reference. :) (It didn't reveal anything particularly
interesting-looking, at least as relates to this)
>
> >ahc0: <Adaptec aic7880 Ultra SCSI adapter> rev 0x00 int a irq 11 on pci0.11.0
> >ahc0: aic7880 Wide Channel A, SCSI Id=7, 16/255 SCBs
> ^^<= That's the important number.
Yep. I did try the obvious "Hardcode 16 SCBs and see if it just works".
(A few different ways, as I realized various things I was missing) Pretty
much the same problems occur, which indicates to me a more fundamental
problem.
> >So, anyway, I'm at the point now where I'm slowly sifting through the
> >attachment of the ahc device using GDB, but I'm afraid my skills might
> >not be up to the task. Anyone got any further pointers of what I might
> >look at?
>
> Look at the loop in ahc_init that determines the number of hardware
> SCBs. You should also see if NetBSD is preferring memory mapped I/O
> over PIO as FreeBSD defaults to PIO access of the chip.
>
Yeah; I've stepped through that loop in gdb under NetBSD. To my eyes, the
code seems _very_ similar to that in FreeBSD-3.1 (not surprising, given
its provenance ;)
Here's the relevant code snippet, from dev/ic/aic7xxx.c :
*************
/* Determine the number of SCBs */
{
AHC_OUTB(ahc, SCBPTR, 0);
AHC_OUTB(ahc, SCB_CONTROL, 0);
for(i = 1; i < AHC_SCB_MAX; i++) {
AHC_OUTB(ahc, SCBPTR, i);
AHC_OUTB(ahc, SCB_CONTROL, i);
if(AHC_INB(ahc, SCB_CONTROL) != i)
/* XXX */ break;
AHC_OUTB(ahc, SCBPTR, 0);
if(AHC_INB(ahc, SCB_CONTROL) != 0)
break;
/* Clear the control byte. */
AHC_OUTB(ahc, SCBPTR, i);
AHC_OUTB(ahc, SCB_CONTROL, 0);
ahc->qcntmask |= i; /* Update the count mask. */
}
/* Ensure we clear the 0 SCB's control byte. */
AHC_OUTB(ahc, SCBPTR, 0);
AHC_OUTB(ahc, SCB_CONTROL, 0);
ahc->qcntmask |= i;
ahc->maxhscbs = i;
}
******************
when i=1, it hits the "break" at /* XXX */, leaving the loop, and resulting
in the "1 SCBs" message. I'm not really certain how to tell if NetBSD is
preferring memory mapped i/o or not; if it matters, ahc->sc_st is
I386_BUS_SPACE_IO during the snippet above.
Can you tell that devices aren't my forte? ;)
--
Jeff Rizzo http://boogers.sf.ca.us/~riz