summaryrefslogtreecommitdiffstats
path: root/sys/pc98
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/pc98
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/pc98')
-rw-r--r--sys/pc98/pc98/atapi.h28
-rw-r--r--sys/pc98/pc98/wd_cd.c87
-rw-r--r--sys/pc98/pc98/wfd.c111
-rw-r--r--sys/pc98/pc98/wst.c88
4 files changed, 15 insertions, 299 deletions
diff --git a/sys/pc98/pc98/atapi.h b/sys/pc98/pc98/atapi.h
index 1973325..afa76ea 100644
--- a/sys/pc98/pc98/atapi.h
+++ b/sys/pc98/pc98/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/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c
index 34cfeb0..138323e 100644
--- a/sys/pc98/pc98/wd_cd.c
+++ b/sys/pc98/pc98/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/pc98/pc98/wfd.c b/sys/pc98/pc98/wfd.c
index 17b434c..f2fb145 100644
--- a/sys/pc98/pc98/wfd.c
+++ b/sys/pc98/pc98/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/pc98/pc98/wst.c b/sys/pc98/pc98/wst.c
index 3d2f4e8..714e667 100644
--- a/sys/pc98/pc98/wst.c
+++ b/sys/pc98/pc98/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 */
OpenPOWER on IntegriCloud