summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/atapi.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-04-13 19:38:12 +0000
committerpeter <peter@FreeBSD.org>1999-04-13 19:38:12 +0000
commit7d0299e0a54d7a75324ab8c53af872c54a8cb175 (patch)
tree721a4a6c49e2837082092fa69e5e8d565b19106a /sys/i386/isa/atapi.c
parentdfdcc6233207986cb1e4fdc12bd940925c5f19c6 (diff)
downloadFreeBSD-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/isa/atapi.c')
-rw-r--r--sys/i386/isa/atapi.c189
1 files changed, 13 insertions, 176 deletions
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 */
OpenPOWER on IntegriCloud