Allow 32-bit transfers for drives which support it. Add missing bus_space methods needed for such transfers.

This commit is contained in:
rkujawa 2011-10-29 19:25:19 +00:00
parent c2f53256f5
commit 9f8ca4f47e
2 changed files with 62 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: amiga_bus_simple_4.c,v 1.8 2011/09/16 10:23:01 rkujawa Exp $ */
/* $NetBSD: amiga_bus_simple_4.c,v 1.9 2011/10/29 19:25:19 rkujawa Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,10 +30,11 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_4.c,v 1.8 2011/09/16 10:23:01 rkujawa Exp $");
__KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_4.c,v 1.9 2011/10/29 19:25:19 rkujawa Exp $");
#define AMIGA_SIMPLE_BUS_STRIDE 4 /* 1 byte per long */
#define AMIGA_SIMPLE_BUS_WORD_METHODS
#define AMIGA_SIMPLE_BUS_LONGWORD_METHODS
#include "simple_busfuncs.c"
@ -46,6 +47,8 @@ __KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_4.c,v 1.8 2011/09/16 10:23:01 rkuja
bsrm(oabs(bsrm2_swap_), u_int16_t);
bswm(oabs(bswm2_swap_), u_int16_t);
bsrm(oabs(bsrm4_swap_), u_int32_t);
bswm(oabs(bswm4_swap_), u_int32_t);
void
oabs(bsrm2_swap_)(bus_space_handle_t handle, bus_size_t offset,
@ -78,6 +81,37 @@ oabs(bswm2_swap_)(bus_space_handle_t handle, bus_size_t offset,
}
}
void
oabs(bsrm4_swap_)(bus_space_handle_t handle, bus_size_t offset,
u_int32_t *pointer, bus_size_t count)
{
volatile u_int32_t *p;
p = (volatile u_int32_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
while (count > 0) {
*pointer++ = bswap32(*p);
amiga_bus_reorder_protect();
--count;
}
}
void
oabs(bswm4_swap_)(bus_space_handle_t handle, bus_size_t offset,
const u_int32_t *pointer, bus_size_t count)
{
volatile u_int32_t *p;
p = (volatile u_int32_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
while (count > 0) {
*p = bswap32(*pointer);
amiga_bus_reorder_protect();
++pointer;
--count;
}
}
const struct amiga_bus_space_methods amiga_bus_stride_4swap = {
.bsm = oabs(bsm_),
@ -108,5 +142,21 @@ const struct amiga_bus_space_methods amiga_bus_stride_4swap = {
.bsrrs2 = oabs(bsrr2_),
.bswrs2 = oabs(bswr2_),
.bssr2 = oabs(bssr2_), /* XXX swap? */
.bscr2 = oabs(bscr2_) /* XXX swap? */
.bscr2 = oabs(bscr2_), /* XXX swap? */
.bsr4 = oabs(bsr4_), /* XXX swap? */
.bsw4 = oabs(bsw4_), /* XXX swap? */
.bsrs4 = oabs(bsr4_),
.bsws4 = oabs(bsw4_),
.bsrm4 = oabs(bsrm4_swap_),
.bswm4 = oabs(bswm4_swap_),
.bsrms4 = oabs(bsrm4_),
.bswms4 = oabs(bswm4_),
.bsrr4 = oabs(bsrr4_), /* XXX swap? */
.bswr4 = oabs(bswr4_), /* XXX swap? */
.bsrrs4 = oabs(bsrr4_),
.bswrs4 = oabs(bswr4_),
.bssr4 = oabs(bssr4_), /* XXX swap? */
.bscr4 = oabs(bscr4_) /* XXX swap? */
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: efa.c,v 1.2 2011/10/29 11:16:19 rkujawa Exp $ */
/* $NetBSD: efa.c,v 1.3 2011/10/29 19:25:19 rkujawa Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -64,7 +64,7 @@
#include <amiga/dev/efareg.h>
#include <amiga/dev/efavar.h>
/* #define EFA_32BIT_IO 1 */
#define EFA_32BIT_IO 1
/* #define EFA_NO_INTR 1 */
/* #define EFA_DEBUG 1 */
@ -154,11 +154,11 @@ efa_attach(device_t parent, device_t self, void *aux)
sc->sc_wdcdev.sc_atac.atac_set_modes = efa_setup_channel;
sc->sc_wdcdev.sc_atac.atac_dev = self;
sc->sc_wdcdev.sc_atac.atac_channels = sc->sc_chanlist;
sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16;
if (sc->sc_32bit_io)
sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA32;
else
sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16;
sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA32;
/*
* The following should work for polling mode, but it does not.
* if (sc->sc_no_intr)
@ -324,6 +324,7 @@ efa_mapbase(struct efa_softc *sc)
for (i = 0; i < FATA1_CHANNELS; i++) {
for (j = 0; j < PIO_COUNT; j++) {
sc->sc_ports[i].wdr[j].cmd_iot = &fata_cmd_iot;
sc->sc_ports[i].wdr[j].data32iot = &fata_cmd_iot;
sc->sc_ports[i].wdr[j].ctl_iot = &gayle_cmd_iot;
}
}
@ -454,11 +455,10 @@ efa_fata_subregion_pion(struct wdc_regs *wdr_fata, bool data32)
{
if (data32)
bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh,
FATA1_PION_OFF_DATA32, 8, &wdr_fata->cmd_iohs[wd_data]);
else
bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh,
FATA1_PION_OFF_DATA, 4, &wdr_fata->cmd_iohs[wd_data]);
FATA1_PION_OFF_DATA32, 8, &wdr_fata->data32ioh);
bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh,
FATA1_PION_OFF_DATA, 4, &wdr_fata->cmd_iohs[wd_data]);
bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh,
FATA1_PION_OFF_ERROR, 1, &wdr_fata->cmd_iohs[wd_error]);
bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh,