Subject: Re: TC bba audio problem on DEC3000/300
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Gregory McGarry <g.mcgarry@ieee.org>
List: port-alpha
Date: 07/17/2000 08:21:33
Izumi Tsutsui wrote:

> > Okay, how about the following?  This more correctly shows what is going on,
> > per Chris's comments.
> 
> This patch fixes the panic, but it seems bba on 3000/300
> still has some problems.
> 
> When I try to play some au files by audioplay,
> the machine plays some sound (maybe correct data) in
> very short time (~100ms?), but after that, the kernel
> hangs up without any messages.

There are a few issues that have arisen:

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?

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?

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)

        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);


	-- Gregory McGarry <g.mcgarry@ieee.org>