Subject: Re: troubles mapping isa registers
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-alpha
Date: 08/31/1999 10:11:41
On Tue, 31 Aug 1999 18:13:32 +0200 
 Manuel Bouyer <bouyer@antioche.lip6.fr> wrote:

 > Hi,
 > in order to fully support the cypress IDE controller, I need to read/write
 > things to I/O 0x22/0x23. A first attempt to map these registers fails.

Hi...

I know precisely what is wrong here...

0x22/0x23 == IO_ICU1 + 2 and IO_ICU1 + 3...

Those are the Cypress `magick control registers'.

They're already mapped/used by arch/alpha/pci/sio_pic.c:

u_int8_t
cy82c693_read_elcr(elcr)
	int elcr;
{

	bus_space_write_1(sio_iot, sio_ioh_elcr, 0x02, 0x03 + elcr);
	return (bus_space_read_1(sio_iot, sio_ioh_elcr, 0x03));
}

...etc.  `sio_ioh_elcr' is mapped at IO_ICU1 (0x20) size IO_ICUSIZE (16).

How, specifically, do you need to use these registers?  We probably need
to have a dev/ic/cy82c693.c which inits it, maps it, and exports functions
to read/write the control registers.

Can you point me at the manual for this chip, please?

 > Here is how I did it:
 > first I need  a bus_space_tag_t, and of course none is passed from the
 > upper level for this. As the bus-master DMA registers are supposed to be
 > in I/O space too I've 'duplicated' it:
 > sc->cy693_dmamode_iot = sc->sc_dma_iot;
 > Then I attempt to map these regs:
 >        if (sc->sc_dma_ok &&
 >            bus_space_map(sc->cy693_dmamode_iot, CY_DMA_ADDR, CY_DMA_SIZE, 0,
 >            &sc->cy693_dmamode_ioh)) {
 >                printf("%s: can't map DMA control registers\n",
 >                    sc->sc_wdcdev.sc_dev.dv_xname);
 >                sc->sc_dma_ok = 0;
 >        }
 > 
 > But bus_space_map() return != 0. 
 > CY_DMA_ADDR is defined to 0x22 and CY_DMA_SIZE to 0x2.
 > Any idea of what can be wrong ?
 > 
 > --
 > Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 > --

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>