diff options
author | peter <peter@FreeBSD.org> | 1999-04-13 19:38:12 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-04-13 19:38:12 +0000 |
commit | 7d0299e0a54d7a75324ab8c53af872c54a8cb175 (patch) | |
tree | 721a4a6c49e2837082092fa69e5e8d565b19106a /sys/i386 | |
parent | dfdcc6233207986cb1e4fdc12bd940925c5f19c6 (diff) | |
download | FreeBSD-src-7d0299e0a54d7a75324ab8c53af872c54a8cb175.zip FreeBSD-src-7d0299e0a54d7a75324ab8c53af872c54a8cb175.tar.gz |
Shoot the LKM support in the old wd/wdc/atapi driver set in the head and
perform a cleanup/unifdef sweep over it to tidy things up. The atapi
code is permanently attached to the wd driver and is always probed.
I will add an extra option bit in the flags to disable an atapi probe on
either the master or slave if needed, if people want this.
Remember, this driver is destined to die some time. It's possible that
it will loose all atapi support down the track and only be used for
dumb non-ATA disks and all ata/atapi devices will be handled by the new
ata system.
ATAPI, ATAPI_STATIC and CMD640 are no longer options, all are implicit.
Previously discussed with: sos
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/conf/GENERIC | 5 | ||||
-rw-r--r-- | sys/i386/conf/LINT | 16 | ||||
-rw-r--r-- | sys/i386/conf/NOTES | 16 | ||||
-rw-r--r-- | sys/i386/conf/files.i386 | 4 | ||||
-rw-r--r-- | sys/i386/conf/options.i386 | 7 | ||||
-rw-r--r-- | sys/i386/isa/atapi-cd.c | 87 | ||||
-rw-r--r-- | sys/i386/isa/atapi.c | 189 | ||||
-rw-r--r-- | sys/i386/isa/atapi.h | 28 | ||||
-rw-r--r-- | sys/i386/isa/wd.c | 101 | ||||
-rw-r--r-- | sys/i386/isa/wd_cd.c | 87 | ||||
-rw-r--r-- | sys/i386/isa/wfd.c | 111 | ||||
-rw-r--r-- | sys/i386/isa/wst.c | 88 |
12 files changed, 39 insertions, 700 deletions
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 7ea722f..1d3e4f5 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -11,7 +11,7 @@ # device lines is present in the ./LINT configuration file. If you are # in doubt as to the purpose or necessity of a line, check first in LINT. # -# $Id: GENERIC,v 1.156 1999/03/29 17:56:27 ken Exp $ +# $Id: GENERIC,v 1.157 1999/04/11 20:53:50 n_hibma Exp $ machine "i386" cpu "I386_CPU" @@ -60,7 +60,6 @@ controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 disk fd0 at fdc0 drive 0 disk fd1 at fdc0 drive 1 -options "CMD640" # work around CMD640 chip deficiency controller wdc0 at isa? port "IO_WD1" bio irq 14 disk wd0 at wdc0 drive 0 disk wd1 at wdc0 drive 1 @@ -69,8 +68,6 @@ controller wdc1 at isa? port "IO_WD2" bio irq 15 disk wd2 at wdc1 drive 0 disk wd3 at wdc1 drive 1 -options ATAPI #Enable ATAPI support for IDE bus -options ATAPI_STATIC #Don't do it as an LKM device wcd0 #IDE CD-ROM device wfd0 #IDE Floppy (e.g. LS-120) diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index d3161fd..17bf557 100644 --- a/sys/i386/conf/LINT +++ b/sys/i386/conf/LINT @@ -2,7 +2,7 @@ # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.578 1999/04/11 20:53:50 n_hibma Exp $ +# $Id: LINT,v 1.579 1999/04/12 09:45:29 brian Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -1091,20 +1091,6 @@ disk wd2 at wdc1 drive 0 disk wd3 at wdc1 drive 1 # -# Options for `wdc': -# -# CMD640 enables serializing access to primary and secondary channel -# of the CMD640B IDE Chip. The serializing will only take place -# if this option is set *and* the chip is probed by the pci-system. -# -options "CMD640" #Enable work around for CMD640 h/w bug -# -# ATAPI enables the support for ATAPI-compatible IDE devices -# -options ATAPI #Enable ATAPI support for IDE bus -options ATAPI_STATIC #Don't do it as an LKM - -# # This option allow you to override the default probe time for IDE # devices, to get a faster probe. Setting this below 10000 violate # the IDE specs, but may still work for you (it will work for most diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index d3161fd..17bf557 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -2,7 +2,7 @@ # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.578 1999/04/11 20:53:50 n_hibma Exp $ +# $Id: LINT,v 1.579 1999/04/12 09:45:29 brian Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -1091,20 +1091,6 @@ disk wd2 at wdc1 drive 0 disk wd3 at wdc1 drive 1 # -# Options for `wdc': -# -# CMD640 enables serializing access to primary and secondary channel -# of the CMD640B IDE Chip. The serializing will only take place -# if this option is set *and* the chip is probed by the pci-system. -# -options "CMD640" #Enable work around for CMD640 h/w bug -# -# ATAPI enables the support for ATAPI-compatible IDE devices -# -options ATAPI #Enable ATAPI support for IDE bus -options ATAPI_STATIC #Don't do it as an LKM - -# # This option allow you to override the default probe time for IDE # devices, to get a faster probe. Setting this below 10000 violate # the IDE specs, but may still work for you (it will work for most diff --git a/sys/i386/conf/files.i386 b/sys/i386/conf/files.i386 index 6d359f3..76a745f 100644 --- a/sys/i386/conf/files.i386 +++ b/sys/i386/conf/files.i386 @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.i386,v 1.232 1999/03/30 21:32:43 eivind Exp $ +# $Id: files.i386,v 1.233 1999/04/07 03:55:36 msmith Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -273,7 +273,7 @@ i386/isa/vga_isa.c optional vga device-driver i386/isa/tw.c optional tw device-driver i386/isa/wd.c optional wdc device-driver i386/isa/wd.c optional wd device-driver -i386/isa/atapi.c optional atapi device-driver +i386/isa/atapi.c optional wdc device-driver i386/isa/atapi-cd.c optional wcd device-driver i386/isa/wfd.c optional wfd device-driver i386/isa/wst.c optional wst device-driver diff --git a/sys/i386/conf/options.i386 b/sys/i386/conf/options.i386 index 840fa55..4f63652 100644 --- a/sys/i386/conf/options.i386 +++ b/sys/i386/conf/options.i386 @@ -1,4 +1,4 @@ -# $Id: options.i386,v 1.109 1999/03/10 10:36:30 yokota Exp $ +# $Id: options.i386,v 1.110 1999/03/13 13:20:59 joerg Exp $ DISABLE_PSE IDE_DELAY @@ -99,11 +99,6 @@ KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUG opt_kbd.h -ATAPI opt_atapi.h -ATAPI_STATIC opt_atapi.h - -CMD640 opt_wd.h - USERCONFIG opt_userconfig.h VISUAL_USERCONFIG opt_userconfig.h INTRO_USERCONFIG opt_userconfig.h diff --git a/sys/i386/isa/atapi-cd.c b/sys/i386/isa/atapi-cd.c index 34cfeb0..138323e 100644 --- a/sys/i386/isa/atapi-cd.c +++ b/sys/i386/isa/atapi-cd.c @@ -25,15 +25,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-cd.c,v 1.12 1999/03/16 13:34:03 sos Exp $ + * $Id: atapi-cd.c,v 1.13 1999/03/31 12:30:58 sos Exp $ */ #include "wdc.h" #include "wcd.h" -#include "opt_atapi.h" #include "opt_devfs.h" -#if NWCD > 0 && NWDC > 0 && defined(ATAPI) +#if NWCD > 0 && NWDC > 0 #include <sys/param.h> #include <sys/systm.h> @@ -85,9 +84,6 @@ static struct cdevsw acd_cdevsw = { static struct acd *acdtab[NUNIT]; static int acdnlun = 0; /* Number of configured drives */ -#ifndef ATAPI_STATIC -static -#endif int acdattach(struct atapi *, int, struct atapi_params *, int); static struct acd *acd_init_lun(struct atapi *, int, struct atapi_params *, int, struct devstat *); @@ -158,9 +154,6 @@ acd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun, return ptr; } -#ifndef ATAPI_STATIC -static -#endif int acdattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug) { @@ -1524,80 +1517,6 @@ atapi_dump(int ctrlr, int lun, char *label, void *data, int len) printf ("\n"); } -#ifdef WCD_MODULE -#include <sys/exec.h> -#include <sys/sysent.h> -#include <sys/lkm.h> - -MOD_DEV(acd, LM_DT_BLOCK, BDEV_MAJOR, &acd_bdevsw); -MOD_DEV(racd, LM_DT_CHAR, CDEV_MAJOR, &acd_cdevsw); - -int -acd_load(struct lkm_table *lkmtp, int cmd) -{ - struct atapi *ata; - int n, u; - - if (!atapi_start) - return EPROTONOSUPPORT; - n = 0; - for (ata = atapi_tab; ata < atapi_tab + 2; ++ata) - if (ata->port) - for (u = 0; u < 2; ++u) - if (ata->params[u] && !ata->attached[u] && - acdattach(ata, u, ata->params[u], - ata->debug) >= 0) { - ata->attached[u] = 1; - ++n; - } - if (!n) - return ENXIO; - return 0; -} - -int -acd_unload(struct lkm_table *lkmtp, int cmd) -{ - struct acd **cdpp; - - for (cdpp = acdtab; cdpp < acdtab + acdnlun; ++cdpp) - if (((*cdpp)->flags & F_BOPEN) || (*cdpp)->refcnt) - return EBUSY; - for (cdpp = acdtab; cdpp < acdtab + acdnlun; ++t) { - (*cdpp)->ata->attached[(*cdpp)->unit] = 0; - free(*cdpp, M_TEMP); - } - acdnlun = 0; - bzero(acdtab, sizeof(acdtab)); - return 0; -} - -int -acd_mod(struct lkm_table *lkmtp, int cmd, int ver) -{ - int err = 0; - - if (ver != LKM_VERSION) - return EINVAL; - - if (cmd == LKM_E_LOAD) - err = acd_load(lkmtp, cmd); - else if (cmd == LKM_E_UNLOAD) - err = acd_unload(lkmtp, cmd); - if (err) - return err; - - lkmtp->private.lkm_dev = &MOD_PRIVATE(racd); - err = lkmdispatch(lkmtp, cmd); - if (err) - return err; - - lkmtp->private.lkm_dev = &MOD_PRIVATE(acd); - return lkmdispatch(lkmtp, cmd); -} - -#endif /* WCD_MODULE */ - static acd_devsw_installed = 0; static void @@ -1610,4 +1529,4 @@ acd_drvinit(void *unused) } SYSINIT(acddev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, acd_drvinit, NULL) -#endif /* NWCD && NWDC && ATAPI */ +#endif /* NWCD && NWDC */ diff --git a/sys/i386/isa/atapi.c b/sys/i386/isa/atapi.c index 9432695..2d76b8c 100644 --- a/sys/i386/isa/atapi.c +++ b/sys/i386/isa/atapi.c @@ -100,16 +100,13 @@ #undef DEBUG #include "wdc.h" -#include "opt_atapi.h" -#ifndef ATAPI_MODULE -# include "wcd.h" -# include "wfd.h" -# include "wst.h" -/* # include "wmd.h" -- add your driver here */ -#endif +#include "wcd.h" +#include "wfd.h" +#include "wst.h" +/* #include "wmd.h" -- add your driver here */ -#if NWDC > 0 && defined (ATAPI) +#if NWDC > 0 #include <sys/param.h> #include <sys/systm.h> @@ -117,32 +114,8 @@ #include <machine/clock.h> -#ifdef ATAPI_MODULE -# define ATAPI_STATIC -#endif - #include <i386/isa/atapi.h> -#ifndef ATAPI_STATIC -/* this code is compiled as part of the kernel if options ATAPI */ -/* - * In the case of loadable ATAPI driver we need to store - * the probe info for delayed attaching. - */ -struct atapidrv atapi_drvtab[4]; -int atapi_ndrv; -struct atapi *atapi_tab; - -int atapi_attach (int ctlr, int unit, int port) -{ - atapi_drvtab[atapi_ndrv].ctlr = ctlr; - atapi_drvtab[atapi_ndrv].unit = unit; - atapi_drvtab[atapi_ndrv].port = port; - atapi_drvtab[atapi_ndrv].attached = 0; - ++atapi_ndrv; - return (1); -} -#else /* ATAPI_STATIC */ /* this code is compiled part of the module */ #ifdef DEBUG @@ -178,9 +151,6 @@ extern int wstattach(struct atapi*, int, struct atapi_params*, int); * Probe the ATAPI device at IDE controller `ctlr', drive `unit'. * Called at splbio(). */ -#ifdef ATAPI_MODULE -static -#endif int atapi_attach (int ctlr, int unit, int port) { struct atapi *ata = atapitab + ctlr; @@ -272,10 +242,6 @@ int atapi_attach (int ctlr, int unit, int port) free (ap, M_TEMP); return (0); } -#ifdef ATAPI_MODULE - ata->params[unit] = ap; - return (1); -#else switch (ap->devtype) { default: /* unknown ATAPI device */ @@ -286,11 +252,14 @@ int atapi_attach (int ctlr, int unit, int port) case AT_TYPE_DIRECT: /* direct-access */ #if NWFD > 0 /* ATAPI Floppy(LS-120) */ - if (wfdattach (ata, unit, ap, ata->debug) >= 0) { + if (wfdattach (ata, unit, ap, ata->debug) < 0) + break; /* Device attached successfully. */ - ata->attached[unit] = 1; - return (1); - } + ata->attached[unit] = 1; + return (1); +#else + printf ("wdc%d: ATAPI Floppies not configured\n", ctlr); + break; #endif case AT_TYPE_CDROM: /* CD-ROM device */ #if NWCD > 0 @@ -328,7 +297,6 @@ int atapi_attach (int ctlr, int unit, int port) /* Attach failed. */ free (ap, M_TEMP); return (0); -#endif /* ATAPI_MODULE */ } static char *cmdname (u_char cmd) @@ -986,136 +954,5 @@ struct atapires atapi_request_immediate (struct atapi *ata, int unit, } return (ac->result); } -#endif /* ATAPI_STATIC */ - -#if defined (ATAPI_MODULE) || !defined(ATAPI_STATIC) -int (*atapi_start_ptr) (int ctrlr); -int (*atapi_intr_ptr) (int ctrlr); -void (*atapi_debug_ptr) (struct atapi *ata, int on); -struct atapires (*atapi_request_wait_ptr) (struct atapi *ata, int unit, - u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, - u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, - u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, - char *addr, int count); -void (*atapi_request_callback_ptr) (struct atapi *ata, int unit, - u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, - u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, - u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, - char *addr, int count, atapi_callback_t *done, void *x, void *y); -struct atapires (*atapi_request_immediate_ptr) (struct atapi *ata, int unit, - u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, - u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, - u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, - char *addr, int count); -#endif - -#ifdef ATAPI_MODULE -/* - * ATAPI loadable driver stubs. - */ -#include <sys/exec.h> -#include <sys/sysent.h> -#include <sys/lkm.h> - -extern int atapi_lock (int ctlr); -extern void wdintr (int); - -/* - * Construct lkm_misc structure (see lkm.h). - */ -MOD_MISC(atapi); - -int atapi_locked; - -int atapi_lock (int ctlr) -{ - atapi_locked = 1; - wakeup (&atapi_locked); - return (1); -} - -/* - * Function called when loading the driver. - */ -static int atapi_load (struct lkm_table *lkmtp, int cmd) -{ - struct atapidrv *d; - int n, x; - - /* - * Probe all free IDE units, searching for ATAPI drives. - */ - n = 0; - for (d=atapi_drvtab; d<atapi_drvtab+atapi_ndrv && d->port; ++d) { - /* Lock the controller. */ - x = splbio (); - atapi_locked = 0; - atapi_start_ptr = atapi_lock; - wdstart (d->ctlr); - while (! atapi_locked) - tsleep (&atapi_locked, PRIBIO, "atach", 0); - - /* Probe the drive. */ - if (atapi_attach (d->ctlr, d->unit, d->port)) { - d->attached = 1; - ++n; - } - - /* Unlock the controller. */ - atapi_start_ptr = 0; - wdintr (d->ctlr); - splx (x); - } - if (! n) - return ENXIO; - atapi_start_ptr = atapi_start; - atapi_intr_ptr = atapi_intr; - atapi_debug_ptr = atapi_debug; - atapi_request_wait_ptr = atapi_request_wait; - atapi_request_callback_ptr = atapi_request_callback; - atapi_request_immediate_ptr = atapi_request_immediate; - atapi_tab = atapitab; - return 0; -} - -/* - * Function called when unloading the driver. - */ -static int atapi_unload (struct lkm_table *lkmtp, int cmd) -{ - struct atapi *ata; - int u; - - for (ata=atapi_tab; ata<atapi_tab+2; ++ata) - if (ata->port) - for (u=0; u<2; ++u) - if (ata->attached[u]) - return EBUSY; - for (ata=atapi_tab; ata<atapi_tab+2; ++ata) - if (ata->port) - for (u=0; u<2; ++u) - if (ata->params[u]) { - free (ata->params[u], M_TEMP); - ata->params[u] = 0; - } - atapi_start_ptr = 0; - atapi_intr_ptr = 0; - atapi_debug_ptr = 0; - atapi_request_wait_ptr = 0; - atapi_request_callback_ptr = 0; - atapi_request_immediate_ptr = 0; - atapi_tab = 0; - return 0; -} - -/* - * Dispatcher function for the module (load/unload/stat). - */ -int atapi_mod (struct lkm_table *lkmtp, int cmd, int ver) -{ - MOD_DISPATCH (atapi, lkmtp, cmd, ver, - atapi_load, atapi_unload, lkm_nullcmd); -} -#endif /* ATAPI_MODULE */ -#endif /* NWDC && ATAPI */ +#endif /* NWDC */ diff --git a/sys/i386/isa/atapi.h b/sys/i386/isa/atapi.h index 1973325..afa76ea 100644 --- a/sys/i386/isa/atapi.h +++ b/sys/i386/isa/atapi.h @@ -268,37 +268,21 @@ extern struct atapidrv atapi_drvtab[4]; /* delayed attach info */ extern int atapi_ndrv; /* the number of potential drives */ extern struct atapi *atapi_tab; /* the table of atapi controllers */ -#ifndef ATAPI_STATIC -# define atapi_start (*atapi_start_ptr) -# define atapi_intr (*atapi_intr_ptr) -# define atapi_debug (*atapi_debug_ptr) -# define atapi_request_wait (*atapi_request_wait_ptr) -# define atapi_request_callback (*atapi_request_callback_ptr) -# define atapi_request_immediate (*atapi_request_immediate_ptr) -#endif - -#ifndef ATAPI_MODULE int atapi_attach (int ctlr, int unit, int port); -#endif - -/* - * These "functions" are declared with archaic `extern's because they are - * actually pointers in the !ATAPI_STATIC case. - */ -extern int atapi_start (int ctrlr); -extern int atapi_intr (int ctrlr); -extern void atapi_debug (struct atapi *ata, int on); -extern struct atapires atapi_request_wait (struct atapi *ata, int unit, +int atapi_start (int ctrlr); +int atapi_intr (int ctrlr); +void atapi_debug (struct atapi *ata, int on); +struct atapires atapi_request_wait (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, char *addr, int count); -extern void atapi_request_callback (struct atapi *ata, int unit, +void atapi_request_callback (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, char *addr, int count, atapi_callback_t *done, void *x, void *y); -extern struct atapires atapi_request_immediate (struct atapi *ata, int unit, +struct atapires atapi_request_immediate (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index fadac34..d1aa3ee 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.190 1999/03/23 10:22:19 bde Exp $ + * $Id: wd.c,v 1.191 1999/04/02 13:58:24 phk Exp $ */ /* TODO: @@ -64,11 +64,9 @@ #if NWDC > 0 -#include "opt_atapi.h" #include "opt_devfs.h" #include "opt_hw_wdog.h" #include "opt_ide_delay.h" -#include "opt_wd.h" #include <sys/param.h> #include <sys/dkbad.h> @@ -95,14 +93,8 @@ #include <vm/vm_prot.h> #include <vm/pmap.h> - -#ifdef ATAPI #include <i386/isa/atapi.h> -#endif - -#ifdef CMD640 #include <i386/isa/wdc_p.h> -#endif /*CMD640*/ extern void wdstart(int ctrlr); @@ -161,9 +153,7 @@ struct disk { u_int dk_bc; /* byte count left */ short dk_skip; /* blocks already transferred */ int dk_ctrlr; /* physical controller number */ -#ifdef CMD640 int dk_ctrlr_cmd640;/* controller number for CMD640 quirk */ -#endif u_int32_t dk_unit; /* physical unit number */ u_int32_t dk_lunit; /* logical unit number */ u_int32_t dk_interface; /* interface (two ctrlrs per interface) */ @@ -271,10 +261,8 @@ static struct cdevsw wd_cdevsw = { D_DISK, 0, -1 }; -#ifdef CMD640 static int atapictrlr; static int eide_quirks; -#endif /* @@ -283,13 +271,11 @@ static int eide_quirks; * will be called by wdc_p.c . */ -#ifdef CMD640 void wdc_pci(int quirks) { eide_quirks = quirks; } -#endif /* * Probe for controller. @@ -326,19 +312,16 @@ wdprobe(struct isa_device *dvp) outb(du->dk_port + wd_sdh, WDSD_IBM); /* set unit 0 */ outb(du->dk_port + wd_cyl_lo, 0xa5); /* wd_cyl_lo is read/write */ if (inb(du->dk_port + wd_cyl_lo) == 0xff) { /* XXX too weak */ -#ifdef ATAPI /* There is no master, try the ATAPI slave. */ du->dk_unit = 1; outb(du->dk_port + wd_sdh, WDSD_IBM | 0x10); outb(du->dk_port + wd_cyl_lo, 0xa5); if (inb(du->dk_port + wd_cyl_lo) == 0xff) -#endif goto nodevice; } if (wdreset(du) == 0) goto reset_ok; -#ifdef ATAPI /* test for ATAPI signature */ outb(du->dk_port + wd_sdh, WDSD_IBM); /* master */ if (inb(du->dk_port + wd_cyl_lo) == 0x14 && @@ -349,7 +332,6 @@ wdprobe(struct isa_device *dvp) if (inb(du->dk_port + wd_cyl_lo) == 0x14 && inb(du->dk_port + wd_cyl_hi) == 0xeb) goto reset_ok; -#endif DELAY(RECOVERYTIME); if (wdreset(du) != 0) { goto nodevice; @@ -429,7 +411,6 @@ wdattach(struct isa_device *dvp) if (dvp->id_unit >= NWDC) return (0); -#ifdef CMD640 if (eide_quirks & Q_CMD640B) { if (dvp->id_unit == PRIMARY) { printf("wdc0: CMD640B workaround enabled\n"); @@ -438,10 +419,6 @@ wdattach(struct isa_device *dvp) } else bufq_init(&wdtab[dvp->id_unit].controller_queue); -#else - bufq_init(&wdtab[dvp->id_unit].controller_queue); -#endif - for (wdup = isa_biotab_wdc; wdup->id_driver != 0; wdup++) { if (wdup->id_iobase != dvp->id_iobase) continue; @@ -460,13 +437,11 @@ wdattach(struct isa_device *dvp) bufq_init(&drive_queue[lunit]); bzero(du, sizeof *du); du->dk_ctrlr = dvp->id_unit; -#ifdef CMD640 if (eide_quirks & Q_CMD640B) { du->dk_ctrlr_cmd640 = PRIMARY; } else { du->dk_ctrlr_cmd640 = du->dk_ctrlr; } -#endif du->dk_unit = unit; du->dk_lunit = lunit; du->dk_port = dvp->id_iobase; @@ -559,7 +534,6 @@ wdattach(struct isa_device *dvp) wddrives[lunit] = NULL; } } -#ifdef ATAPI /* * Probe all free IDE units, searching for ATAPI drives. */ @@ -569,28 +543,19 @@ wdattach(struct isa_device *dvp) wddrives[lunit]->dk_ctrlr == dvp->id_unit && wddrives[lunit]->dk_unit == unit) goto next; -#ifdef CMD640 if (atapi_attach (dvp->id_unit, unit, dvp->id_iobase)) atapictrlr = dvp->id_unit; -#else - atapi_attach (dvp->id_unit, unit, dvp->id_iobase); -#endif next: ; } -#endif /* * Discard any interrupts generated by wdgetctlr(). wdflushirq() * doesn't work now because the ambient ipl is too high. */ -#ifdef CMD640 if (eide_quirks & Q_CMD640B) { wdtab[PRIMARY].b_active = 2; } else { wdtab[dvp->id_unit].b_active = 2; } -#else - wdtab[dvp->id_unit].b_active = 2; -#endif return (1); } @@ -679,11 +644,7 @@ wdstrategy(register struct buf *bp) if (wdutab[lunit].b_active == 0) wdustart(du); /* start drive */ -#ifdef CMD640 if (wdtab[du->dk_ctrlr_cmd640].b_active == 0) -#else - if (wdtab[du->dk_ctrlr].b_active == 0) -#endif wdstart(du->dk_ctrlr); /* start controller */ /* Tell devstat that we have started a transaction on this drive */ @@ -716,11 +677,7 @@ static void wdustart(register struct disk *du) { register struct buf *bp; -#ifdef CMD640 int ctrlr = du->dk_ctrlr_cmd640; -#else - int ctrlr = du->dk_ctrlr; -#endif /* unit already active? */ if (wdutab[du->dk_lunit].b_active) @@ -764,7 +721,6 @@ wdstart(int ctrlr) long secpertrk, secpercyl; u_int lunit; u_int count; -#ifdef CMD640 int ctrlr_atapi; if (eide_quirks & Q_CMD640B) { @@ -773,27 +729,17 @@ wdstart(int ctrlr) } else { ctrlr_atapi = ctrlr; } -#endif -#ifdef ATAPI if (wdtab[ctrlr].b_active == 2) wdtab[ctrlr].b_active = 0; if (wdtab[ctrlr].b_active) return; -#endif /* is there a drive for the controller to do a transfer with? */ bp = bufq_first(&wdtab[ctrlr].controller_queue); if (bp == NULL) { -#ifdef ATAPI -#ifdef CMD640 if (atapi_start && atapi_start (ctrlr_atapi)) - wdtab[ctrlr].b_active = 3; -#else - if (atapi_start && atapi_start (ctrlr)) /* mark controller active in ATAPI mode */ wdtab[ctrlr].b_active = 3; -#endif -#endif return; } @@ -1041,7 +987,6 @@ wdintr(void *unitnum) int dmastat = 0; /* Shut up GCC */ int unit = (int)unitnum; -#ifdef CMD640 int ctrlr_atapi; if (eide_quirks & Q_CMD640B) { @@ -1050,7 +995,6 @@ wdintr(void *unitnum) } else { ctrlr_atapi = unit; } -#endif if (wdtab[unit].b_active == 2) return; /* intr in wdflushirq() */ @@ -1065,14 +1009,9 @@ wdintr(void *unitnum) #endif return; } -#ifdef ATAPI if (wdtab[unit].b_active == 3) { /* process an ATAPI interrupt */ -#ifdef CMD640 if (atapi_intr && atapi_intr (ctrlr_atapi)) -#else - if (atapi_intr && atapi_intr (unit)) -#endif /* ATAPI op continues */ return; /* controller is free, start new op */ @@ -1080,7 +1019,6 @@ wdintr(void *unitnum) wdstart (unit); return; } -#endif bp = bufq_first(&wdtab[unit].controller_queue); du = wddrives[dkunit(bp->b_dev)]; @@ -1281,11 +1219,7 @@ done: ; /* anything more on drive queue? */ wdustart(du); /* anything more for controller to do? */ -#ifndef ATAPI - /* This is not valid in ATAPI mode. */ - if (bufq_first(&wdtab[unit].controller_queue) != NULL) -#endif - wdstart(unit); + wdstart(unit); } /* @@ -1306,13 +1240,8 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) return (ENXIO); /* Finish flushing IRQs left over from wdattach(). */ -#ifdef CMD640 if (wdtab[du->dk_ctrlr_cmd640].b_active == 2) wdtab[du->dk_ctrlr_cmd640].b_active = 0; -#else - if (wdtab[du->dk_ctrlr].b_active == 2) - wdtab[du->dk_ctrlr].b_active = 0; -#endif du->dk_flags &= ~DKFL_BADSCAN; @@ -1478,11 +1407,7 @@ wdcontrol(register struct buf *bp) int ctrlr; du = wddrives[dkunit(bp->b_dev)]; -#ifdef CMD640 ctrlr = du->dk_ctrlr_cmd640; -#else - ctrlr = du->dk_ctrlr; -#endif switch (du->dk_state) { case WANTOPEN: @@ -1654,11 +1579,7 @@ wdsetctlr(struct disk *du) error = 1; } if (error) { -#ifdef CMD640 wdtab[du->dk_ctrlr_cmd640].b_errcnt += RETRIES; -#else - wdtab[du->dk_ctrlr].b_errcnt += RETRIES; -#endif return (1); } if (wdcommand(du, du->dk_dd.d_ncylinders, du->dk_dd.d_ntracks - 1, 0, @@ -2271,17 +2192,10 @@ wderror(struct buf *bp, struct disk *du, char *mesg) static void wdflushirq(struct disk *du, int old_ipl) { -#ifdef CMD640 wdtab[du->dk_ctrlr_cmd640].b_active = 2; splx(old_ipl); (void)splbio(); wdtab[du->dk_ctrlr_cmd640].b_active = 0; -#else - wdtab[du->dk_ctrlr].b_active = 2; - splx(old_ipl); - (void)splbio(); - wdtab[du->dk_ctrlr].b_active = 0; -#endif } /* @@ -2299,18 +2213,11 @@ wdreset(struct disk *du) DELAY(10 * 1000); outb(du->dk_altport, WDCTL_IDS); outb(du->dk_port + wd_sdh, WDSD_IBM | (du->dk_unit << 4)); -#ifdef ATAPI if (wdwait(du, 0, TIMEOUT) != 0) err = 1; /* no IDE drive found */ du->dk_error = inb(du->dk_port + wd_error); if (du->dk_error != 0x01) err = 1; /* the drive is incompatible */ -#else - if (wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) != 0) { - printf("wdreset: error1: 0x%x\n", du->dk_error); - return (1); - } -#endif outb(du->dk_altport, WDCTL_4BIT); return (err); } @@ -2324,10 +2231,8 @@ static void wdsleep(int ctrlr, char *wmesg) { int s = splbio(); -#ifdef CMD640 if (eide_quirks & Q_CMD640B) ctrlr = PRIMARY; -#endif while (wdtab[ctrlr].b_active) tsleep((caddr_t)&wdtab[ctrlr].b_active, PZERO - 1, wmesg, 1); splx(s); @@ -2439,7 +2344,6 @@ wdwait(struct disk *du, u_char bits_wanted, int timeout) min_retries[du->dk_ctrlr] = timeout; #endif du->dk_status = status = inb(wdc + wd_status); -#ifdef ATAPI /* * Atapi drives have a very interesting feature, when attached * as a slave on the IDE bus, and there is no master. @@ -2450,7 +2354,6 @@ wdwait(struct disk *du, u_char bits_wanted, int timeout) outb(wdc + wd_sdh, WDSD_IBM | du->dk_unit << 4); du->dk_status = status = inb(wdc + wd_status); } -#endif if (!(status & WDCS_BUSY)) { if (status & WDCS_ERR) { du->dk_error = inb(wdc + wd_error); diff --git a/sys/i386/isa/wd_cd.c b/sys/i386/isa/wd_cd.c index 34cfeb0..138323e 100644 --- a/sys/i386/isa/wd_cd.c +++ b/sys/i386/isa/wd_cd.c @@ -25,15 +25,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-cd.c,v 1.12 1999/03/16 13:34:03 sos Exp $ + * $Id: atapi-cd.c,v 1.13 1999/03/31 12:30:58 sos Exp $ */ #include "wdc.h" #include "wcd.h" -#include "opt_atapi.h" #include "opt_devfs.h" -#if NWCD > 0 && NWDC > 0 && defined(ATAPI) +#if NWCD > 0 && NWDC > 0 #include <sys/param.h> #include <sys/systm.h> @@ -85,9 +84,6 @@ static struct cdevsw acd_cdevsw = { static struct acd *acdtab[NUNIT]; static int acdnlun = 0; /* Number of configured drives */ -#ifndef ATAPI_STATIC -static -#endif int acdattach(struct atapi *, int, struct atapi_params *, int); static struct acd *acd_init_lun(struct atapi *, int, struct atapi_params *, int, struct devstat *); @@ -158,9 +154,6 @@ acd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun, return ptr; } -#ifndef ATAPI_STATIC -static -#endif int acdattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug) { @@ -1524,80 +1517,6 @@ atapi_dump(int ctrlr, int lun, char *label, void *data, int len) printf ("\n"); } -#ifdef WCD_MODULE -#include <sys/exec.h> -#include <sys/sysent.h> -#include <sys/lkm.h> - -MOD_DEV(acd, LM_DT_BLOCK, BDEV_MAJOR, &acd_bdevsw); -MOD_DEV(racd, LM_DT_CHAR, CDEV_MAJOR, &acd_cdevsw); - -int -acd_load(struct lkm_table *lkmtp, int cmd) -{ - struct atapi *ata; - int n, u; - - if (!atapi_start) - return EPROTONOSUPPORT; - n = 0; - for (ata = atapi_tab; ata < atapi_tab + 2; ++ata) - if (ata->port) - for (u = 0; u < 2; ++u) - if (ata->params[u] && !ata->attached[u] && - acdattach(ata, u, ata->params[u], - ata->debug) >= 0) { - ata->attached[u] = 1; - ++n; - } - if (!n) - return ENXIO; - return 0; -} - -int -acd_unload(struct lkm_table *lkmtp, int cmd) -{ - struct acd **cdpp; - - for (cdpp = acdtab; cdpp < acdtab + acdnlun; ++cdpp) - if (((*cdpp)->flags & F_BOPEN) || (*cdpp)->refcnt) - return EBUSY; - for (cdpp = acdtab; cdpp < acdtab + acdnlun; ++t) { - (*cdpp)->ata->attached[(*cdpp)->unit] = 0; - free(*cdpp, M_TEMP); - } - acdnlun = 0; - bzero(acdtab, sizeof(acdtab)); - return 0; -} - -int -acd_mod(struct lkm_table *lkmtp, int cmd, int ver) -{ - int err = 0; - - if (ver != LKM_VERSION) - return EINVAL; - - if (cmd == LKM_E_LOAD) - err = acd_load(lkmtp, cmd); - else if (cmd == LKM_E_UNLOAD) - err = acd_unload(lkmtp, cmd); - if (err) - return err; - - lkmtp->private.lkm_dev = &MOD_PRIVATE(racd); - err = lkmdispatch(lkmtp, cmd); - if (err) - return err; - - lkmtp->private.lkm_dev = &MOD_PRIVATE(acd); - return lkmdispatch(lkmtp, cmd); -} - -#endif /* WCD_MODULE */ - static acd_devsw_installed = 0; static void @@ -1610,4 +1529,4 @@ acd_drvinit(void *unused) } SYSINIT(acddev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, acd_drvinit, NULL) -#endif /* NWCD && NWDC && ATAPI */ +#endif /* NWCD && NWDC */ diff --git a/sys/i386/isa/wfd.c b/sys/i386/isa/wfd.c index 17b434c..f2fb145 100644 --- a/sys/i386/isa/wfd.c +++ b/sys/i386/isa/wfd.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: wfd.c,v 1.18 1999/01/30 12:21:44 phk Exp $ + * $Id: wfd.c,v 1.19 1999/02/10 00:03:37 ken Exp $ */ /* @@ -32,9 +32,8 @@ #include "wdc.h" #include "wfd.h" -#include "opt_atapi.h" -#if NWFD > 0 && NWDC > 0 && defined (ATAPI) +#if NWFD > 0 && NWDC > 0 #include <sys/param.h> #include <sys/systm.h> @@ -70,9 +69,6 @@ static struct cdevsw wfd_cdevsw = { NULL, -1, nodump, nopsize, D_DISK, 0, -1 }; -#ifndef ATAPI_STATIC -static -#endif int wfdattach(struct atapi*, int, struct atapi_params*, int); #define NUNIT (NWDC*2) /* Max. number of devices */ @@ -173,9 +169,6 @@ static void wfd_dump (int lun, char *label, void *data, int len) printf ("\n"); } -#ifndef ATAPI_STATIC -static -#endif int wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug) { @@ -771,104 +764,6 @@ static int wfd_eject (struct wfd *t, int closeit) 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0); } -#ifdef WFD_MODULE -/* - * Loadable ATAPI Floppy driver stubs. - */ -#include <sys/exec.h> -#include <sys/sysent.h> -#include <sys/lkm.h> - -/* - * Construct lkm_dev structures (see lkm.h). - * Our bdevsw/cdevsw slot numbers are 19/69. - */ - - -MOD_DEV(wfd, LM_DT_BLOCK, BDEV_MAJOR, &wfd_cdevsw); -MOD_DEV(rwfd, LM_DT_CHAR, CDEV_MAJOR, &wfd_cdevsw); - -/* - * Function called when loading the driver. - */ -int wfd_load (struct lkm_table *lkmtp, int cmd) -{ - struct atapi *ata; - int n, u; - - if (! atapi_start) - /* No ATAPI driver available. */ - return EPROTONOSUPPORT; - n = 0; - for (ata=atapi_tab; ata<atapi_tab+2; ++ata) - if (ata->port) - for (u=0; u<2; ++u) - /* Probing controller ata->ctrlr, unit u. */ - if (ata->params[u] && ! ata->attached[u] && - wfdattach (ata, u, ata->params[u], - ata->debug) >= 0) - { - /* Drive found. */ - ata->attached[u] = 1; - ++n; - } - if (! n) - /* No IDE Floppies found. */ - return ENXIO; - return 0; -} - -/* - * Function called when unloading the driver. - */ -int wfd_unload (struct lkm_table *lkmtp, int cmd) -{ - struct wfd **t; - - for (t=wfdtab; t<wfdtab+wfdnlun; ++t) - if (((*t)->flags & F_BOPEN) || (*t)->refcnt) - /* The device is opened, cannot unload the driver. */ - return EBUSY; - for (t=wfdtab; t<wfdtab+wfdnlun; ++t) { - (*t)->ata->attached[(*t)->unit] = 0; - free (*t, M_TEMP); - } - wfdnlun = 0; - bzero (wfdtab, sizeof(wfdtab)); - return 0; -} - -/* - * Dispatcher function for the module (load/unload/stat). - */ -int wfd_mod (struct lkm_table *lkmtp, int cmd, int ver) -{ - int err = 0; - - if (ver != LKM_VERSION) - return EINVAL; - - if (cmd == LKM_E_LOAD) - err = wfd_load (lkmtp, cmd); - else if (cmd == LKM_E_UNLOAD) - err = wfd_unload (lkmtp, cmd); - if (err) - return err; - - /* XXX Poking around in the LKM internals like this is bad. - */ - /* Register the cdevsw entry. */ - lkmtp->private.lkm_dev = & MOD_PRIVATE(rwfd); - err = lkmdispatch (lkmtp, cmd); - if (err) - return err; - - /* Register the bdevsw entry. */ - lkmtp->private.lkm_dev = & MOD_PRIVATE(wfd); - return lkmdispatch (lkmtp, cmd); -} -#endif /* WFD_MODULE */ - static wfd_devsw_installed = 0; static void wfd_drvinit(void *unused) @@ -882,4 +777,4 @@ static void wfd_drvinit(void *unused) SYSINIT(wfddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wfd_drvinit,NULL) -#endif /* NWFD && NWDC && ATAPI */ +#endif /* NWFD && NWDC */ diff --git a/sys/i386/isa/wst.c b/sys/i386/isa/wst.c index 3d2f4e8..714e667 100644 --- a/sys/i386/isa/wst.c +++ b/sys/i386/isa/wst.c @@ -25,16 +25,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: wst.c,v 1.14 1999/01/12 00:36:36 eivind Exp $ + * $Id: wst.c,v 1.15 1999/01/12 01:28:00 eivind Exp $ */ #include "wdc.h" #include "wst.h" -#include "opt_atapi.h" #include "opt_ddb.h" #include "opt_devfs.h" -#if NWST > 0 && NWDC > 0 && defined(ATAPI) +#if NWST > 0 && NWDC > 0 #include <sys/param.h> #include <sys/systm.h> @@ -194,9 +193,6 @@ struct wst { static struct wst *wsttab[NUNIT]; /* Drive info by unit number */ static int wstnlun = 0; /* Number of config'd drives */ -#ifndef ATAPI_STATIC -static -#endif int wstattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug); static int wst_sense(struct wst *t); static void wst_describe(struct wst *t); @@ -227,9 +223,6 @@ wst_dump(int lun, char *label, void *data, int len) } #endif -#ifndef ATAPI_STATIC -static -#endif int wstattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug) { @@ -791,81 +784,6 @@ wst_reset(struct wst *t) DELAY(30); } -#ifdef WST_MODULE - -#include <sys/exec.h> -#include <sys/sysent.h> -#include <sys/lkm.h> - -MOD_DEV(rwst, LM_DT_CHAR, CDEV_MAJOR, &wst_cdevsw); - -int -wst_load(struct lkm_table *lkmtp, int cmd) -{ - struct atapi *ata; - int n, u; - - if (!atapi_start) - /* No ATAPI driver available. */ - return EPROTONOSUPPORT; - n = 0; - for (ata=atapi_tab; ata<atapi_tab+2; ++ata) - if (ata->port) - for (u=0; u<2; ++u) - /* Probing controller ata->ctrlr, unit u. */ - if (ata->params[u] && !ata->attached[u] && - wstattach(ata, u, ata->params[u], - ata->debug) >= 0) { - ata->attached[u] = 1; - ++n; - } - if (!n) - return ENXIO; - return 0; -} - -int -wst_unload(struct lkm_table *lkmtp, int cmd) -{ - struct wst **t; - - for (t=wsttab; t<wsttab+wstnlun; ++t) - if (((*t)->flags & WST_OPEN)) - return EBUSY; - for (t=wsttab; t<wsttab+wstnlun; ++t) { - (*t)->ata->attached[(*t)->unit] = 0; - free(*t, M_TEMP); - } - wstnlun = 0; - bzero(wsttab, sizeof(wsttab)); - return 0; -} - -int -wst_mod(struct lkm_table *lkmtp, int cmd, int ver) -{ - int err = 0; - - if (ver != LKM_VERSION) - return EINVAL; - - if (cmd == LKM_E_LOAD) - err = wst_load(lkmtp, cmd); - else if (cmd == LKM_E_UNLOAD) - err = wst_unload(lkmtp, cmd); - if (err) - return err; - - lkmtp->private.lkm_dev = & MOD_PRIVATE(rwst); - err = lkmdispatch(lkmtp, cmd); - if (err) - return err; - - lkmtp->private.lkm_dev = & MOD_PRIVATE(wst); - return lkmdispatch(lkmtp, cmd); -} -#endif /* WST_MODULE */ - static wst_devsw_installed = 0; static void @@ -882,4 +800,4 @@ wst_drvinit(void *unused) SYSINIT(wstdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wst_drvinit,NULL) -#endif /* NWST && NWDC && ATAPI */ +#endif /* NWST && NWDC */ |