Improve probe procedure in efa(4). Update man apge to reflect this.

This commit is contained in:
rkujawa 2011-10-30 11:10:42 +00:00
parent 796bd71eac
commit 9d89628a47
2 changed files with 76 additions and 16 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: efa.4,v 1.2 2011/10/27 22:56:25 wiz Exp $
.\" $NetBSD: efa.4,v 1.3 2011/10/30 11:10:43 rkujawa Exp $
.\"
.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -50,10 +50,8 @@ PIO modes 0, 3, 4 and 5 are supported.
.\".Bl -ohang
.\".It Cd options EFA_32BIT_IO
.\"Use 32-bit data port.
.\".It Cd options EFA_GAYLE_COMPAT
.\"Drive FastATA in Gayle IDE compatibility mode.
.\"Use if the driver does not work correctly in native (default) mode.
.\"Limits operation to PIO0 mode.
.\".It Cd options EFA_NO_INTR
.\"Disable hardware interrupt support.
.\".El
.Sh HARDWARE
The
@ -92,15 +90,21 @@ Code needed to support it is present in driver but does not work correctly.
.Pp
Some of the above devices were also marketed under PowerFlyer and Winner brands.
.Pp
The
On board Gayle IDE controller can not be used when FastATA is installed and
therefore, the
.Nm
driver can not coexist with
driver will not coexist with
.Xr wdc 4
driver attached to
.Xr mainbus 4 ,
because FastATA 1200 hardware uses portions of the on-board Gayle IDE
controller.
These drivers should not be enabled in the same kernel.
.Xr mainbus 4 .
Both
.Nm
and
.Xr wdc 4
can be enabled in the same kernel, but only one will attach (depending on the
return value of probe function in the
.Nm
driver).
.Pp
DMA modes are not supported, this is a hardware limitation.
.Sh BUGS
@ -109,5 +113,3 @@ Performance is worse than with official AmigaOS driver from ELBOX.
Disks partitioned in split mode, which is specific to official AmigaOS FastATA
driver, are not recognized in
.Nx .
.Pp
Improved probe procedure should be written.

View File

@ -1,4 +1,4 @@
/* $NetBSD: efa.c,v 1.3 2011/10/29 19:25:19 rkujawa Exp $ */
/* $NetBSD: efa.c,v 1.4 2011/10/30 11:10:42 rkujawa Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -83,6 +83,7 @@ static void efa_attach_channel(struct efa_softc *sc, int i);
static void efa_select_regset(struct efa_softc *sc, int chnum,
uint8_t piomode);
static void efa_poll_kthread(void *arg);
static bool efa_compare_status(void);
#ifdef EFA_DEBUG
static void efa_debug_print_regmapping(struct wdc_regs *wdr_fata);
#endif /* EFA_DEBUG */
@ -116,9 +117,16 @@ efa_probe(device_t parent, cfdata_t cfp, void *aux)
* can't coexist with wdc_amiga. Match "wdc" on an A1200, because
* FastATA 1200 does not autoconfigure.
*/
if ( !matchname(aux, "wdc") || !is_a1200() )
if (!matchname(aux, "wdc") || !is_a1200())
return(0);
if (!efa_compare_status())
return(0);
#ifdef EFA_DEBUG
aprint_normal("efa_probe succeeded\n");
#endif /* EFA_DEBUG */
return 100;
}
@ -237,7 +245,7 @@ static void
efa_set_opts(struct efa_softc *sc)
{
#ifdef EFA_32BIT_IO
sc->sc_32bit_io = true; /* XXX: bus_space_read_multi_stream_4 */
sc->sc_32bit_io = true;
#else
sc->sc_32bit_io = false;
#endif /* EFA_32BIT_IO */
@ -559,3 +567,53 @@ efa_debug_print_regmapping(struct wdc_regs *wdr_fata)
}
#endif /* EFA_DEBUG */
/* Compare the values of (status) command register in PIO0, PIO3 sets. */
static bool
efa_compare_status(void)
{
uint8_t cmd0, cmd3;
struct bus_space_tag fata_bst;
bus_space_tag_t fata_iot;
bus_space_handle_t cmd0_ioh, cmd3_ioh;
bool rv;
rv = false;
fata_bst.base = (bus_addr_t) ztwomap(FATA1_BASE);
fata_bst.absm = &amiga_bus_stride_4swap;
fata_iot = &fata_bst;
if (bus_space_map(fata_iot, pio_offsets[0], FATA1_CHAN_SIZE, 0,
&cmd0_ioh))
return false;
if (bus_space_map(fata_iot, pio_offsets[3], FATA1_CHAN_SIZE, 0,
&cmd3_ioh))
return false;
#ifdef EFA_DEBUG
aprint_normal("probing for FastATA at %x, %x: ", (bus_addr_t) cmd0_ioh,
(bus_addr_t) cmd3_ioh);
#endif /* EFA_DEBUG */
cmd0 = bus_space_read_1(fata_iot, cmd0_ioh, FATA1_PIO0_OFF_COMMAND);
cmd3 = bus_space_read_1(fata_iot, cmd3_ioh, FATA1_PION_OFF_COMMAND);
if (cmd0 == cmd3)
rv = true;
if ( (cmd0 == 0xFF) || (cmd0 == 0x00) ) {
/* Assume there's nothing there... */
rv = false;
}
#ifdef EFA_DEBUG
aprint_normal("cmd0 %x, cmd3 %x\n", cmd0, cmd3);
#endif /* EFA_DEBUG */
bus_space_unmap(fata_iot, pio_offsets[0], FATA1_CHAN_SIZE);
bus_space_unmap(fata_iot, pio_offsets[3], FATA1_CHAN_SIZE);
return rv;
}