Porting to linux-pmac: how to check that iobase is correct?

Daniel M. Eischen deischen at iworks.InterWorks.org
Sun Feb 15 04:57:50 PST 1998


> > I'm working on getting the aic7xxx driver to work in linux-pmac on the
> > Macintosh G3.  The driver has already been ported to some other Mac clone
> > systems, starting from the driver in Linux 2.1.24, so hopefully once I get
> > past my current snag, I won't have too far to go.  That snag is: the value
> > I get for iobase (p->base) by reading from PCI_BASE_ADDRESS_0, is 1.  This
> > value is obviously completely bogus (presumably the result of the
> > Mac-specific firmware on the card--yes?).  Looking at various other
> > possible addresses gleaned from Mac-specific machinery associated with the
> > card, I have four possible addresses for iobase and mbase, but so far I
> > have not been able to get anything reasonable to happen using any of the
> > four addresses as iobase.

The current aic7xxx driver in Linux doesn't do memory mapped
IO, although all the hooks are there for it to do so.  All
you should need to do is initialize maddr in the aic7xxx_host  
structure with the memory address.  Use vremap() to map the
PCI address (found in the PCI configuration space on the
card - there should be functions in the PCI bios routines
to retrieve this).  See ncr53c8xx.c in linux/drivers/scsi
to see how it's done.

> 
> You may also run into issues with byte order in the driver unless
> Linux always runs the PowerPC in LE mode.

Yes, and you will have to modify aic_outsb() to be something
like this:

  if (p->maddr != NULL)
  {
#ifndef i386
    int i;

    for (i=0; i<size; i++)
      p->maddr[port + i] = valp[i];
#else
    __asm __volatile("
      cld;
    1:  lodsb;
      movb %%al,(%0);
      loop 1b"      :
              :
      "r" ((p)->maddr + (port)),
      "S" ((valp)), "c" ((size))  :
      "%esi", "%ecx", "%eax");
#endif
  }
  else
  {
    outsb(p->base + port, valp, size);
  }

Dan Eischen
deischen at iworks.InterWorks.org

To Unsubscribe: send mail to majordomo at FreeBSD.org
with "unsubscribe aic7xxx" in the body of the message



More information about the aic7xxx mailing list