Re: Current kernel with http://gnats.netbsd.org/39965 and pmap patches
Izumi Tsutsui <[email protected]>
| Newsgroups | gmane.os.netbsd.ports.atari |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: > > By the way, which interrupt (level and vector) is used > > for the IDE interface on Falcon? > > I don't know :/ Maybe we can find more information from some Atari documents. According to Linux sources, it uses the same interrupt with FDC/ASCI DMA (71), so I guess that's the reason why current wdc_mb.c uses dma hooks to handle it. On the other hand, it seems atari/intr.c:intr_establish() can handle multiple interrupt handlers in the same vector. How about this patch? (though I'm not sure if we should also handle the MFP->mf_iprb register) --- Index: dev/wdc_mb.c =================================================================== RCS file: /cvsroot/src/sys/arch/atari/dev/wdc_mb.c,v retrieving revision 1.32 diff -u -r1.32 wdc_mb.c --- dev/wdc_mb.c 28 Apr 2008 20:23:15 -0000 1.32 +++ dev/wdc_mb.c 21 Dec 2008 19:19:16 -0000 @@ -52,6 +52,7 @@ #include <atari/dev/ym2149reg.h> #include <atari/atari/device.h> +#include <atari/atari/intr.h> /* Falcon IDE register locations (base and offsets). */ #define FALCON_WD_BASE 0xfff00000 @@ -61,8 +62,7 @@ /* * XXX This code currently doesn't even try to allow 32-bit data port use. */ -static int claim_hw (struct ata_channel *, int); -static void free_hw (struct ata_channel *); +static int wdc_mb_intr(void *, int); static void read_multi_2_swap (bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t); static void write_multi_2_swap (bus_space_tag_t, bus_space_handle_t, @@ -199,8 +199,6 @@ sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16 | ATAC_CAP_ATA_NOSTREAM; sc->sc_wdcdev.sc_atac.atac_pio_cap = 0; - sc->sc_wdcdev.sc_atac.atac_claim_hw = &claim_hw; - sc->sc_wdcdev.sc_atac.atac_free_hw = &free_hw; sc->sc_chanlist[0] = &sc->sc_channel; sc->sc_wdcdev.sc_atac.atac_channels = sc->sc_chanlist; sc->sc_wdcdev.sc_atac.atac_nchannels = 1; @@ -210,6 +208,13 @@ sc->sc_channel.ch_ndrive = 2; wdc_init_shadow_regs(&sc->sc_channel); + sc->sc_ih = + intr_establish(7, USER_VEC, 0, wdc_mb_intr, &sc->sc_channel); + if (sc->sc_ih == NULL) { + aprint_error_dev(self, "can't establish interrupt\n"); + return; + } + /* * Setup & enable disk related interrupts. */ @@ -220,45 +225,11 @@ wdcattach(&sc->sc_channel); } -/* - * Hardware locking - */ -static int wd_lock; - static int -claim_hw(chp, maysleep) -struct ata_channel *chp; -int maysleep; -{ - if (wd_lock != DMA_LOCK_GRANT) { - if (wd_lock == DMA_LOCK_REQ) { - /* - * ST_DMA access is being claimed. - */ - return 0; - } - if (!st_dmagrab((dma_farg)wdcintr, - (dma_farg)(maysleep ? NULL : wdcrestart), chp, - &wd_lock, 1)) - return 0; - } - return 1; -} - -static void -free_hw(chp) -struct ata_channel *chp; +wdc_mb_intr(void *arg, int sr) { - /* - * Flush pending interrupts before giving-up lock - */ - MFP->mf_iprb = (u_int8_t)~IB_DINT; - /* - * Only free the lock on a Falcon. On the Hades, keep it. - */ -/* if (machineid & ATARI_FALCON) */ - st_dmafree(chp, &wd_lock); + return wdcintr(arg); } /* --- Izumi Tsutsui