Subject: Re: TC bba audio problem on DEC3000/300
To: Gregory McGarry <g.mcgarry@ieee.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-alpha
Date: 07/16/2000 18:11:50
On Mon, Jul 17, 2000 at 08:21:33AM +1000, Gregory McGarry wrote:

 > 1) The registers on the pmax are definitely inter-spaced at 64 bytes,
 > since bits 6,7 and 8 of the address bus go to the am7930 chip.
 > On the alpha, this is not true (ek-d3sys-pm, p128).  Hence, we
 > see Jason's changes.  So now things are getting messy.  How should
 > this be handled?  #include <machine/bba.h>, #ifdef __alpha__, others?

#ifdef __alpha__ is fine ... I've made the changes.

 > 2) Another issue is that IOASIC DMA is in 4KB blocks.  On the pmax, this
 > is a cpu page.  Do all alphas have an 8KB page?  Would it be more
 > technically correct not to refer to PAGE_SIZE, when really we mean 4KB?

Alphas always have 8K pages right now.  If IOASIC DMA is in 4K blocks,
then we should refer to 4K, not PAGE_SIZE.  I'll look at this, too.

 > 3) IOASIC DMA addresses are incorrectly set.
 > 
 > To setup DMA, dev/tc/bba.c does the following:
 > 
 >         phys = (tc_addr_t)d->dmam->dm_segs[0].ds_addr;
 >         bus_space_write_4(sc->sc_bst, sc->sc_bsh, IOASIC_ISDN_X_DMAPTR,
 >             IOASIC_DMA_ADDR(phys));
 > 
 > To setup DMA, dev/tc/asc_ioasic.c does the following:
 > (shared by pmax and alpha)

Actually, asc_ioasic.c isn't used by Alpha; the Alpha uses the TCDS
ASIC for SCSI on all TurboChannel systems.  So, that's why we didn't
notice this here.

 >         bus_space_write_4(asc->sc_bst, asc->sc_bsh,
 >                                 IOASIC_SCSI_DMAPTR, IOASIC_DMA_ADDR(phys));
 > 
 > To setup DMA, dev/tc/if_le_ioasic.c does the following:
 > (shared by pmax and alpha)
 > 
 >         tca = (tc_addr_t)sc->sc_lance_dmam->dm_segs[0].ds_addr;
 >         tca = ((tca << 3) & ~0x1f) | ((tca >> 29) & 0x1f);
 >         bus_space_write_4(sc->sc_bst, sc->sc_bsh, IOASIC_LANCE_DMAPTR, tca);
 > 
 > dev/tc/ioasicreg.h has the following:
 > 
 > #define IOASIC_DMA_ADDR(p) (((unsigned)p) << (5-2))
 > 
 > I suspect that the code in bba.c only works (on pmax) because the
 > physical memory is always less than 128MB (48MB actually) and is always
 > aligned on a page such that the low-order bits stuffed into
 > IOASIC_ISDN_X_DMAPTR are always zero.  This is probably what bba on
 > alpha doesn't work too.  So is this better?
 > 
 > #define IOASIC_DMA_ADDR(p) ((((unsigned)p) << 3) & ~0x1f) | \
 > 				((((unsigned)p) >> 29) & 0x1f);

Yes, it is.  I'll make this change, too.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>