Use MI wdc-driver.
This commit is contained in:
parent
bc2d7f642e
commit
85966e661a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.25 1998/01/12 18:03:58 thorpej Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.26 1998/04/10 10:37:04 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman
|
||||
@ -158,10 +158,10 @@ config_console()
|
||||
#include "fd.h"
|
||||
#include "sd.h"
|
||||
#include "cd.h"
|
||||
#include "idec.h"
|
||||
#include "wd.h"
|
||||
|
||||
#if NIDEC
|
||||
extern struct cfdriver ide_cd;
|
||||
#if NWD > 0
|
||||
extern struct cfdriver wd_cd;
|
||||
#endif
|
||||
#if NSD > 0
|
||||
extern struct cfdriver sd_cd;
|
||||
@ -174,8 +174,8 @@ extern struct cfdriver fd_cd;
|
||||
#endif
|
||||
|
||||
struct cfdriver *genericconf[] = {
|
||||
#if NIDEC > 0
|
||||
&ide_cd,
|
||||
#if NWD > 0
|
||||
&wd_cd,
|
||||
#endif
|
||||
#if NSD > 0
|
||||
&sd_cd,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.c,v 1.31 1997/10/13 00:46:22 explorer Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.32 1998/04/10 10:37:04 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
@ -68,7 +68,7 @@ bdev_decl(st);
|
||||
bdev_decl(cd);
|
||||
#include "ccd.h"
|
||||
bdev_decl(ccd);
|
||||
#include "idec.h"
|
||||
#include "wdc.h"
|
||||
bdev_decl(wd);
|
||||
|
||||
struct bdevsw bdevsw[] =
|
||||
@ -87,7 +87,7 @@ struct bdevsw bdevsw[] =
|
||||
bdev_lkm_dummy(), /* 11 */
|
||||
bdev_lkm_dummy(), /* 12 */
|
||||
bdev_disk_init(NCCD,ccd), /* 13: concatenated disk driver */
|
||||
bdev_disk_init(NIDEC,wd), /* 14: IDE disk driver */
|
||||
bdev_disk_init(NWDC,wd), /* 14: IDE disk driver */
|
||||
};
|
||||
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
|
||||
|
||||
@ -217,7 +217,7 @@ struct cdevsw cdevsw[] =
|
||||
cdev_uk_init(NUK,uk), /* 31: SCSI unknown */
|
||||
cdev_ss_init(NSS,ss), /* 32: SCSI scanner */
|
||||
cdev_rtc_init(1,rtc), /* 33: RealTimeClock */
|
||||
cdev_disk_init(NIDEC,wd), /* 34: IDE disk driver */
|
||||
cdev_disk_init(NWDC,wd), /* 34: IDE disk driver */
|
||||
cdev_tty_init(NSER,ser), /* 35: 68901 UART */
|
||||
cdev_ipf_init(NIPFILTER,ipl), /* 36: ip-filter device */
|
||||
cdev_disk_init(NMD,md), /* 37: memory disk - for install disk */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $NetBSD: BOOT,v 1.25 1997/12/01 15:19:33 kleink Exp $
|
||||
# $NetBSD: BOOT,v 1.26 1998/04/10 10:37:10 leo Exp $
|
||||
#
|
||||
# BOOT
|
||||
#
|
||||
@ -102,5 +102,5 @@ fd0 at fdc0 unit 0 # builtin floppy drive
|
||||
fd1 at fdc0 unit 1 # external floppy drive
|
||||
zs0 at mainbus0 # Serial support through 8530
|
||||
nvr0 at mainbus0 # nvram driver
|
||||
idec0 at mainbus0 # IDE bus
|
||||
ide* at idec? drive ? # ... and drives
|
||||
wdc0 at mainbus0 # IDE-bus
|
||||
wd* at wdc? drive ? # ... and drives
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $NetBSD: BOOTX,v 1.19 1997/12/01 15:19:35 kleink Exp $
|
||||
# $NetBSD: BOOTX,v 1.20 1998/04/10 10:37:10 leo Exp $
|
||||
#
|
||||
# BOOTX
|
||||
#
|
||||
@ -111,5 +111,5 @@ grfcc2 at grfbus0 # third graphics driver
|
||||
ite* at grfcc2 # third tty
|
||||
nvr0 at mainbus0 # nvram driver
|
||||
lp0 at mainbus0 # centronics printer
|
||||
idec0 at mainbus0 # IDE bus
|
||||
ide* at idec? drive ? # ... and drives
|
||||
wdc0 at mainbus0 # IDE-bus
|
||||
wd* at wdc? drive ? # ... and drives
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $NetBSD: FALCON,v 1.25 1997/12/01 15:19:37 kleink Exp $
|
||||
# $NetBSD: FALCON,v 1.26 1998/04/10 10:37:10 leo Exp $
|
||||
#
|
||||
# ATARI-FALCON
|
||||
#
|
||||
@ -105,5 +105,5 @@ grfcc1 at grfbus0 # second graphics driver
|
||||
ite* at grfcc1 # second tty
|
||||
nvr0 at mainbus0 # nvram driver
|
||||
lp0 at mainbus0 # centronics printer
|
||||
idec0 at mainbus0 # IDE bus
|
||||
ide* at idec? drive ? # ... and drives
|
||||
wdc0 at mainbus0 # IDE-bus
|
||||
wd* at wdc? drive ? # ... and drives
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $NetBSD: HADES,v 1.15 1997/12/01 15:19:41 kleink Exp $
|
||||
# $NetBSD: HADES,v 1.16 1998/04/10 10:37:11 leo Exp $
|
||||
#
|
||||
# Medusa-Hades
|
||||
#
|
||||
@ -121,5 +121,5 @@ vmebus0 at mainbus0 # VME bus
|
||||
vme0 at vmebus0
|
||||
isabus0 at mainbus0 # ISA-bus
|
||||
isa0 at isabus0
|
||||
idec0 at mainbus0 # IDE bus
|
||||
ide* at idec? drive ? # ... and drives
|
||||
wdc0 at mainbus0 # IDE-bus
|
||||
wd* at wdc? drive ? # ... and drives
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $NetBSD: files.atari,v 1.50 1998/04/10 10:28:47 leo Exp $
|
||||
# $NetBSD: files.atari,v 1.51 1998/04/10 10:37:11 leo Exp $
|
||||
|
||||
maxpartitions 16
|
||||
|
||||
@ -64,15 +64,6 @@ file arch/atari/dev/hdfd.c hdfd needs-flag
|
||||
file arch/atari/dev/hdfd_intr.s hdfd
|
||||
major {hdfd = 2}
|
||||
|
||||
# IDE driver also called wd driver
|
||||
# The problem with calling it wd here is a name clash with the driver in ISA.
|
||||
device idec {[drive = -1], [option = 0]}
|
||||
attach idec at mainbus
|
||||
device ide: disk
|
||||
attach ide at idec
|
||||
file arch/atari/dev/wd.c idec needs-flag
|
||||
major {ide = 14}
|
||||
|
||||
# The generic VME-bus driver
|
||||
device vmebus {}
|
||||
attach vmebus at mainbus
|
||||
@ -143,6 +134,12 @@ device isabus
|
||||
attach isabus at mainbus
|
||||
|
||||
include "dev/isa/files.isa"
|
||||
include "dev/ata/files.ata"
|
||||
|
||||
attach wdc at mainbus with wdc_mb
|
||||
file arch/atari/dev/wdc_mb.c wdc_mb
|
||||
major {wd = 14}
|
||||
|
||||
|
||||
#
|
||||
# XXX: Some scsi-devices must be at fixed major#
|
||||
|
File diff suppressed because it is too large
Load Diff
220
sys/arch/atari/dev/wdc_mb.c
Normal file
220
sys/arch/atari/dev/wdc_mb.c
Normal file
@ -0,0 +1,220 @@
|
||||
/* $NetBSD: wdc_mb.c,v 1.1 1998/04/10 10:37:12 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
|
||||
*
|
||||
* DMA and multi-sector PIO handling are derived from code contributed by
|
||||
* Onno van der Linden.
|
||||
*
|
||||
* ISA attachment created by Christopher G. Demetriou.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Charles M. Hannum.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/iomap.h>
|
||||
#include <machine/mfp.h>
|
||||
#include <machine/dma.h>
|
||||
|
||||
#include <dev/ic/wdcvar.h>
|
||||
|
||||
#include <m68k/asm_single.h>
|
||||
|
||||
#include <atari/dev/ym2149reg.h>
|
||||
#include <atari/atari/device.h>
|
||||
|
||||
/*
|
||||
* XXX This code currently doesn't even try to allow 32-bit data port use.
|
||||
*/
|
||||
static int claim_hw __P((void *, int));
|
||||
static void free_hw __P((void *));
|
||||
|
||||
struct wdc_mb_softc {
|
||||
struct wdc_softc sc_wdcdev;
|
||||
struct wdc_attachment_data sc_ad;
|
||||
void *sc_ih;
|
||||
};
|
||||
|
||||
int wdc_mb_probe __P((struct device *, struct cfdata *, void *));
|
||||
void wdc_mb_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach wdc_mb_ca = {
|
||||
sizeof(struct wdc_mb_softc), wdc_mb_probe, wdc_mb_attach
|
||||
};
|
||||
|
||||
int
|
||||
wdc_mb_probe(parent, cfp, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cfp;
|
||||
void *aux;
|
||||
{
|
||||
#if 0 /* XXX memset */
|
||||
struct wdc_attachment_data ad = { 0 };
|
||||
#else /* XXX memset */
|
||||
struct wdc_attachment_data ad;
|
||||
#endif /* XXX memset */
|
||||
int result = 0;
|
||||
u_char sv_ierb;
|
||||
|
||||
#if 0 /* XXX memset */
|
||||
#else /* XXX memset */
|
||||
bzero(&ad, sizeof ad);
|
||||
#endif /* XXX memset */
|
||||
|
||||
if ((machineid & ATARI_TT) || strcmp("wdc", aux) || cfp->cf_unit != 0)
|
||||
return 0;
|
||||
if (!atari_realconfig)
|
||||
return 0;
|
||||
|
||||
ad.iot = ad.auxiot = mb_alloc_bus_space_tag();
|
||||
if (ad.iot == NULL)
|
||||
return 0;
|
||||
ad.iot->stride = 2;
|
||||
ad.iot->wo_1 = 1;
|
||||
|
||||
if (bus_space_map(ad.iot, 0xfff00000, 0x40, 0, &ad.ioh))
|
||||
return 0;
|
||||
if (bus_space_subregion(ad.iot, ad.ioh, 0x38, 1, &ad.auxioh))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Make sure IDE interrupts are disabled during probing.
|
||||
*/
|
||||
sv_ierb = MFP->mf_ierb;
|
||||
MFP->mf_ierb &= ~IB_DINT;
|
||||
|
||||
/*
|
||||
* Make sure that IDE is turned on on the Falcon.
|
||||
*/
|
||||
if (machineid & ATARI_FALCON)
|
||||
ym2149_ser2(0);
|
||||
|
||||
result = wdcprobe(&ad);
|
||||
|
||||
MFP->mf_ierb = sv_ierb;
|
||||
|
||||
bus_space_unmap(ad.iot, ad.ioh, 0x40);
|
||||
mb_free_bus_space_tag(ad.iot);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
wdc_mb_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct wdc_mb_softc *sc = (void *)self;
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->sc_ad.iot = sc->sc_ad.auxiot = mb_alloc_bus_space_tag();
|
||||
sc->sc_ad.iot->stride = 2;
|
||||
sc->sc_ad.iot->wo_1 = 1;
|
||||
if (bus_space_map(sc->sc_ad.iot, 0xfff00000, 0x40, 0,
|
||||
&sc->sc_ad.ioh)) {
|
||||
printf("%s: couldn't map registers\n",
|
||||
sc->sc_wdcdev.sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
if (bus_space_subregion(sc->sc_ad.iot, sc->sc_ad.ioh, 0x38, 1,
|
||||
&sc->sc_ad.auxioh))
|
||||
return;
|
||||
|
||||
/*
|
||||
* Play a nasty trick here. Normally we only manipulate the
|
||||
* interrupt *mask*. However to defeat wd_get_parms(), we
|
||||
* disable the interrupts here using the *enable* register.
|
||||
*/
|
||||
MFP->mf_ierb &= ~IB_DINT;
|
||||
|
||||
/*
|
||||
* XXX: Is this true on all atari's??
|
||||
*/
|
||||
sc->sc_wdcdev.sc_flags |= WDCF_SINGLE;
|
||||
|
||||
sc->sc_ad.cap |= WDC_CAPABILITY_HWLOCK;
|
||||
sc->sc_ad.claim_hw = &claim_hw;
|
||||
sc->sc_ad.free_hw = &free_hw;
|
||||
|
||||
wdcattach(&sc->sc_wdcdev, &sc->sc_ad);
|
||||
|
||||
/*
|
||||
* Setup & enable disk related interrupts.
|
||||
*/
|
||||
MFP->mf_ierb |= IB_DINT;
|
||||
MFP->mf_iprb &= ~IB_DINT;
|
||||
MFP->mf_imrb |= IB_DINT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Hardware locking
|
||||
*/
|
||||
static int wd_lock;
|
||||
|
||||
static int
|
||||
claim_hw(softc, maysleep)
|
||||
void *softc;
|
||||
int maysleep;
|
||||
{
|
||||
void wdcrestart __P((void *));
|
||||
|
||||
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), softc,
|
||||
&wd_lock, 1))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
free_hw(softc)
|
||||
void *softc;
|
||||
{
|
||||
/*
|
||||
* Flush pending interrupts before giving-up lock
|
||||
*/
|
||||
single_inst_bclr_b(MFP->mf_iprb, IB_DINT);
|
||||
|
||||
/*
|
||||
* Only free the lock on a Falcon. On the Hades, keep it.
|
||||
*/
|
||||
/* if (machineid & ATARI_FALCON) */
|
||||
st_dmafree(softc, &wd_lock);
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
/* $NetBSD: wdreg.h,v 1.1 1997/04/01 08:18:04 leo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)wdreg.h 7.1 (Berkeley) 5/9/91
|
||||
*/
|
||||
|
||||
/*
|
||||
* Disk Controller register definitions.
|
||||
*/
|
||||
#define wd_data 0x000 /* data register (R/W - 16 bits) */
|
||||
#define wd_error 0x005 /* error register (R) */
|
||||
#define wd_precomp 0x005 /* write precompensation (W) */
|
||||
#define wd_features 0x005 /* features (W) */
|
||||
#define wd_seccnt 0x009 /* sector count (R/W) */
|
||||
#define wd_sector 0x00D /* first sector number (R/W) */
|
||||
#define wd_cyl_lo 0x011 /* cylinder address, low byte (R/W) */
|
||||
#define wd_cyl_hi 0x015 /* cylinder address, high byte (R/W) */
|
||||
#define wd_sdh 0x019 /* sector size/drive/head (R/W) */
|
||||
#define wd_command 0x01D /* command register (W) */
|
||||
#define wd_status 0x01D /* immediate status (R) */
|
||||
|
||||
#define wd_altsts 0x039 /* alternate fixed disk status (via 1015) (R) */
|
||||
#define wd_ctlr 0x039 /* fixed disk controller control (via 1015) (W) */
|
||||
#define WDCTL_4BIT 0x08 /* use four head bits (wd1003) */
|
||||
#define WDCTL_RST 0x04 /* reset the controller */
|
||||
#define WDCTL_IDS 0x02 /* disable controller interrupts */
|
||||
#define wd_digin 0x03D /* disk controller input (via 1015) (R) */
|
||||
|
||||
/*
|
||||
* Status bits.
|
||||
*/
|
||||
#define WDCS_BSY 0x80 /* busy */
|
||||
#define WDCS_DRDY 0x40 /* drive ready */
|
||||
#define WDCS_DWF 0x20 /* drive write fault */
|
||||
#define WDCS_DSC 0x10 /* drive seek complete */
|
||||
#define WDCS_DRQ 0x08 /* data request */
|
||||
#define WDCS_CORR 0x04 /* corrected data */
|
||||
#define WDCS_IDX 0x02 /* index */
|
||||
#define WDCS_ERR 0x01 /* error */
|
||||
#define WDCS_BITS "\020\010bsy\007drdy\006dwf\005dsc\004drq\003corr\002idx\001err"
|
||||
|
||||
/*
|
||||
* Error bits.
|
||||
*/
|
||||
#define WDCE_BBK 0x80 /* bad block detected */
|
||||
#define WDCE_UNC 0x40 /* uncorrectable data error */
|
||||
#define WDCE_MC 0x20 /* media changed */
|
||||
#define WDCE_IDNF 0x10 /* id not found */
|
||||
#define WDCE_ABRT 0x08 /* aborted command */
|
||||
#define WDCE_MCR 0x04 /* media change requested */
|
||||
#define WDCE_TK0NF 0x02 /* track 0 not found */
|
||||
#define WDCE_AMNF 0x01 /* address mark not found */
|
||||
#define WDERR_BITS "\020\010bbk\007unc\006mc\005idnf\004mcr\003abrt\002tk0nf\001amnf"
|
||||
|
||||
/*
|
||||
* Commands for Disk Controller.
|
||||
*/
|
||||
#define WDCC_RECAL 0x10 /* disk restore code -- resets cntlr */
|
||||
|
||||
#define WDCC_READ 0x20 /* disk read code */
|
||||
#define WDCC_WRITE 0x30 /* disk write code */
|
||||
#define WDCC__LONG 0x02 /* modifier -- access ecc bytes */
|
||||
#define WDCC__NORETRY 0x01 /* modifier -- no retrys */
|
||||
|
||||
#define WDCC_FORMAT 0x50 /* disk format code */
|
||||
#define WDCC_DIAGNOSE 0x90 /* controller diagnostic */
|
||||
#define WDCC_IDP 0x91 /* initialize drive parameters */
|
||||
|
||||
#define WDCC_READMULTI 0xc4 /* read multiple */
|
||||
#define WDCC_WRITEMULTI 0xc5 /* write multiple */
|
||||
#define WDCC_SETMULTI 0xc6 /* set multiple mode */
|
||||
|
||||
#define WDCC_READDMA 0xc8 /* read with DMA */
|
||||
#define WDCC_WRITEDMA 0xca /* write with DMA */
|
||||
|
||||
#define WDCC_ACKMC 0xdb /* acknowledge media change */
|
||||
#define WDCC_LOCK 0xde /* lock drawer */
|
||||
#define WDCC_UNLOCK 0xdf /* unlock drawer */
|
||||
|
||||
#define WDCC_IDENTIFY 0xec /* read parameters from controller */
|
||||
#define WDCC_CACHEC 0xef /* cache control */
|
||||
|
||||
#define WDSD_IBM 0xa0 /* forced to 512 byte sector, ecc */
|
||||
#define WDSD_CHS 0x00 /* cylinder/head/sector addressing */
|
||||
#define WDSD_LBA 0x40 /* logical block addressing */
|
||||
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* read parameters command returns this:
|
||||
*/
|
||||
struct wdparams {
|
||||
/* drive info */
|
||||
short wdp_config; /* general configuration */
|
||||
#define WD_CFG_REMOVABLE 0x0080
|
||||
#define WD_CFG_FIXED 0x0040
|
||||
short wdp_cylinders; /* number of non-removable cylinders */
|
||||
char __reserved1[2];
|
||||
short wdp_heads; /* number of heads */
|
||||
short wdp_unfbytespertrk; /* number of unformatted bytes/track */
|
||||
short wdp_unfbytespersec; /* number of unformatted bytes/sector */
|
||||
short wdp_sectors; /* number of sectors */
|
||||
char wdp_vendor1[6];
|
||||
/* controller info */
|
||||
char wdp_serial[20]; /* serial number */
|
||||
short wdp_buftype; /* buffer type */
|
||||
#define WD_BUF_SINGLEPORTSECTOR 1 /* single port, single sector buffer */
|
||||
#define WD_BUF_DUALPORTMULTI 2 /* dual port, multiple sector buffer */
|
||||
#define WD_BUF_DUALPORTMULTICACHE 3 /* above plus track cache */
|
||||
short wdp_bufsize; /* buffer size, in 512-byte units */
|
||||
short wdp_eccbytes; /* ecc bytes appended */
|
||||
char wdp_revision[8]; /* firmware revision */
|
||||
char wdp_model[40]; /* model name */
|
||||
u_char wdp_maxmulti; /* maximum sectors per interrupt */
|
||||
char wdp_vendor2[1];
|
||||
short wdp_usedmovsd; /* can use double word read/write? */
|
||||
char wdp_vendor3[1];
|
||||
char wdp_capabilities; /* capability flags */
|
||||
#define WD_CAP_LBA 0x02
|
||||
#define WD_CAP_DMA 0x01
|
||||
char __reserved2[2];
|
||||
char wdp_vendor4[1];
|
||||
char wdp_piotiming; /* PIO timing mode */
|
||||
char wdp_vendor5[1];
|
||||
char wdp_dmatiming; /* DMA timing mode */
|
||||
};
|
||||
|
||||
#endif /* _KERNEL */
|
@ -1,73 +0,0 @@
|
||||
/* $NetBSD: wdvar.h,v 1.1 1997/04/01 08:18:04 leo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)wdreg.h 7.1 (Berkeley) 5/9/91
|
||||
*/
|
||||
|
||||
struct wdc_softc {
|
||||
struct device sc_dev;
|
||||
void *sc_ih;
|
||||
|
||||
bus_space_tag_t sc_iot; /* Bus space tag */
|
||||
bus_space_handle_t sc_ioh; /* handle for drive registers */
|
||||
bus_space_handle_t sc_auxioh; /* handle for aux register */
|
||||
bus_space_handle_t sc_dataioh; /* handle for 16 bit data */
|
||||
bus_space_handle_t sc_data32ioh;/* handle for 32 bit data */
|
||||
|
||||
void (*sc_inten)(struct wdc_softc *, int);
|
||||
|
||||
int sc_drq; /* DMA channel */
|
||||
|
||||
TAILQ_HEAD(drivehead, wd_softc) sc_drives;
|
||||
int sc_flags;
|
||||
#define WDCF_ACTIVE 0x01 /* controller is active */
|
||||
#define WDCF_SINGLE 0x02 /* sector at a time mode */
|
||||
#define WDCF_ERROR 0x04 /* processing a disk error */
|
||||
#define WDCF_WANTED 0x08 /* XXX locking for wd_get_parms() */
|
||||
#define WDCF_QUIET 0x10 /* Be quiet about errors */
|
||||
#define WDCF_32BIT 0x20 /* Use 32bit xfers */
|
||||
int sc_errors; /* errors during current transfer */
|
||||
u_char sc_status; /* copy of status register */
|
||||
u_char sc_error; /* copy of error register */
|
||||
};
|
||||
|
||||
int wdcprobe_internal __P((bus_space_tag_t iot, bus_space_handle_t ioh,
|
||||
bus_space_handle_t aux_ioh, bus_space_handle_t data_ioh,
|
||||
bus_space_handle_t data32_ioh, char *name));
|
||||
void wdcattach_internal __P((struct wdc_softc *wdc, bus_space_tag_t iot, bus_space_handle_t ioh,
|
||||
bus_space_handle_t aux_ioh, bus_space_handle_t data_ioh,
|
||||
bus_space_handle_t data32_ioh, int drq));
|
Loading…
Reference in New Issue
Block a user