summaryrefslogtreecommitdiffstats
path: root/sys/isa/fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/isa/fd.c')
-rw-r--r--sys/isa/fd.c246
1 files changed, 1 insertions, 245 deletions
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index bf39b9b..b0b2442 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.119 1998/07/18 03:15:33 bde Exp $
+ * $Id: fd.c,v 1.120 1998/07/29 13:00:40 bde Exp $
*
*/
@@ -84,10 +84,6 @@
#endif
#ifdef DEVFS
#include <sys/devfsext.h>
-#ifdef SLICE
-#include <sys/device.h>
-#include <dev/slice/slice.h>
-#endif /* SLICE */
#endif /* DEVFS */
/* misuse a flag to identify format operation */
@@ -184,21 +180,8 @@ static struct fd_data {
struct callout_handle toffhandle;
struct callout_handle tohandle;
#ifdef DEVFS
-#ifdef SLICE
- int unit; /* as in fd0 */
- void *bdevs[MAXPARTITIONS];
- void *cdevs[MAXPARTITIONS];
- struct subdev{
- struct slice *slice;
- int minor;
- struct fd_data *drive;
- struct slicelimits limit;
- }subdevs[16];
- struct intr_config_hook ich;
-#else /* SLICE */
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
-#endif /* SLICE */
#endif
} fd_data[NFD];
@@ -244,9 +227,7 @@ static timeout_t fd_iotimeout;
static timeout_t fd_pseudointr;
static int fdstate(fdcu_t, fdc_p);
static int retrier(fdcu_t);
-#ifndef SLICE
static int fdformat(dev_t, struct fd_formb *, struct proc *);
-#endif
static int enable_fifo(fdc_p fdc);
@@ -322,30 +303,6 @@ static struct cdevsw fd_cdevsw = {
static struct isa_device *fdcdevs[NFDC];
-#ifdef SLICE
-static sl_h_IO_req_t fdsIOreq; /* IO req downward (to device) */
-static sl_h_ioctl_t fdsioctl; /* ioctl req downward (to device) */
-static sl_h_open_t fdsopen; /* downwards travelling open */
-/*static sl_h_close_t fdsclose; */ /* downwards travelling close */
-static void fdsinit(void *);
-
-static struct slice_handler slicetype = {
- "floppy",
- 0,
- NULL,
- 0,
- NULL, /* constructor */
- &fdsIOreq,
- &fdsioctl,
- &fdsopen,
- /*&fdsclose*/NULL,
- NULL, /* revoke */
- NULL, /* claim */
- NULL, /* verify */
- NULL, /* upconfig */
- NULL /* dump */
-};
-#endif /* SLICE */
static int
fdc_err(fdcu_t fdcu, const char *s)
@@ -582,12 +539,8 @@ fdattach(struct isa_device *dev)
struct isa_device *fdup;
int ic_type = 0;
#ifdef DEVFS
-#ifdef SLICE
- char namebuf[64];
-#else
int mynor;
int typemynor;
-#endif /* SLICE */
int typesize;
#endif
@@ -739,9 +692,6 @@ fdattach(struct isa_device *dev)
continue;
fd->track = FD_NO_TRACK;
-#ifdef SLICE
- fd->unit = fdu;
-#endif
fd->fdc = fdc;
fd->fdsu = fdsu;
fd->options = 0;
@@ -781,29 +731,6 @@ fdattach(struct isa_device *dev)
continue;
}
#ifdef DEVFS
-#ifdef SLICE
- sprintf(namebuf,"fd%d",fdu);
- fd->subdevs[0].minor = 0;
- fd->subdevs[0].drive = fd;
- fd->subdevs[0].limit.blksize =
- 128 << (fd_types[fd->type - 1].secsize);
- fd->subdevs[0].limit.slicesize =
- fd_types[fd->type - 1].size
- * fd->subdevs[0].limit.blksize;
- fd->ft = fd_types + (fd->type - 1); /* default value */
- sl_make_slice(&slicetype,
- &fd->subdevs[0],
- &fd->subdevs[0].limit,
- &fd->subdevs[0].slice,
- namebuf);
- /* Allow full probing */
- fd->subdevs[0].slice->probeinfo.typespecific = NULL;
- fd->subdevs[0].slice->probeinfo.type = NULL;
-
- fd->ich.ich_func = fdsinit;
- fd->ich.ich_arg = &fd->subdevs[0];
- config_intrhook_establish(&fd->ich);
-#else /* SLICE */
mynor = fdu << 6;
fd->bdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
@@ -811,7 +738,6 @@ fdattach(struct isa_device *dev)
fd->cdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_CHR,
UID_ROOT, GID_OPERATOR, 0640,
"rfd%d", fdu);
-#endif /* SLICE */
for (i = 1; i < 1 + NUMDENS; i++) {
/*
* XXX this and the lookup in Fdopen() should be
@@ -848,25 +774,6 @@ fdattach(struct isa_device *dev)
typesize = 1480;
if (typesize == 1722)
typesize = 1720;
-#ifdef SLICE
- sprintf(namebuf,"fd%d.%d",fdu,typesize);
- fd->subdevs[i].minor = i;
- fd->subdevs[i].drive = fd;
- fd->subdevs[i].limit.blksize =
- 128 << (fd_types[i - 1].secsize);
- fd->subdevs[i].limit.slicesize =
- fd_types[i - 1].size
- * fd->subdevs[i].limit.blksize;
- sl_make_slice(&slicetype,
- &fd->subdevs[i],
- &fd->subdevs[i].limit,
- &fd->subdevs[i].slice,
- namebuf);
- /* Allow full probing */
- fd->subdevs[i].slice->probeinfo.typespecific = NULL;
- fd->subdevs[i].slice->probeinfo.type = NO_SUBPART;
- }
-#else /* SLICE */
typemynor = mynor | i;
fd->bdevs[i] =
devfs_add_devswf(&fd_cdevsw, typemynor, DV_BLK,
@@ -885,7 +792,6 @@ fdattach(struct isa_device *dev)
devfs_link(fd->cdevs[0],
"rfd%d%c", fdu, 'a' + i);
}
-#endif /* SLICE */
#endif /* DEVFS */
#ifdef notyet
if (dk_ndrive < DK_NDRIVE) {
@@ -905,19 +811,6 @@ fdattach(struct isa_device *dev)
}
-#ifdef SLICE
-
-static void
-fdsinit(void *arg)
-{
- struct subdev *sd = arg;
- sh_p tp;
-
- slice_start_probe(sd->slice);
- config_intrhook_disestablish(&sd->drive->ich);
- DELAY(2000000); /* XXX */
-}
-#endif /* SLICE */
/****************************************************************************/
/* motor control stuff */
@@ -1317,48 +1210,6 @@ bad:
biodone(bp);
}
-#ifdef SLICE
-/****************************************************************************/
-/* fdsIOreq */
-/****************************************************************************/
-static void
-fdsIOreq(void *private ,struct buf *bp)
-{
- unsigned nblocks, blknum, cando;
- int s;
- fdcu_t fdcu;
- fdu_t fdu;
- fdc_p fdc;
- fd_p fd;
- size_t fdblk;
- struct subdev *sd;
-
- sd = private;
- fd = sd->drive;
- fdu = fd->unit;
- fdc = fd->fdc;
- fdcu = fdc->fdcu;
-
- /* check for controller already busy with tape */
- if (fdc->flags & FDC_TAPE_BUSY) {
- bp->b_error = EBUSY;
- bp->b_flags |= B_ERROR;
- goto bad;
- }
- bp->b_driver1 = sd; /* squirrel away which device.. */
- bp->b_resid = 0;
- s = splbio();
- bufqdisksort(&fdc->head, bp);
- untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle); /* a good idea */
- fdstart(fdcu);
- splx(s);
- return;
-
-bad:
- biodone(bp);
- return;
-}
-#endif /* SLICE */
/***************************************************************\
* fdstart *
@@ -1477,14 +1328,8 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
TRACE1("[fdc%d IDLE]", fdcu);
return(0);
}
-#ifdef SLICE
- sd = bp->b_driver1;
- fd = sd->drive;
- fdu = fd->unit;
-#else
fdu = FDUNIT(minor(bp->b_dev));
fd = fd_data + fdu;
-#endif
fdblk = 128 << fd->ft->secsize;
if (fdc->fd && (fd != fdc->fd))
{
@@ -1898,23 +1743,11 @@ retrier(fdcu)
struct subdev *sd;
fdc_p fdc = fdc_data + fdcu;
register struct buf *bp;
-#ifdef SLICE
- struct fd_data *fd;
- int fdu;
-#endif
bp = bufq_first(&fdc->head);
-#ifdef SLICE
- sd = bp->b_driver1;
- fd = sd->drive;
- fdu = fd->unit;
- if(fd->options & FDOPT_NORETRY)
- goto fail;
-#else
if(fd_data[FDUNIT(minor(bp->b_dev))].options & FDOPT_NORETRY)
goto fail;
-#endif
switch(fdc->retry)
{
case 0: case 1: case 2:
@@ -1931,10 +1764,6 @@ retrier(fdcu)
default:
fail:
{
-#ifdef SLICE
- printf("fd%d: hard error, block %d ", fdu,
- fd->skip / DEV_BSIZE);
-#else
dev_t sav_b_dev = bp->b_dev;
/* Trick diskerr */
bp->b_dev = makedev(major(bp->b_dev),
@@ -1943,7 +1772,6 @@ retrier(fdcu)
fdc->fd->skip / DEV_BSIZE,
(struct disklabel *)NULL);
bp->b_dev = sav_b_dev;
-#endif /* !SLICE */
if (fdc->flags & FDC_STAT_VALID)
{
printf(
@@ -1973,16 +1801,11 @@ retrier(fdcu)
return(1);
}
-#ifdef SLICE
-static int
-fdformat( struct subdev *sd, struct fd_formb *finfo, struct proc *p)
-#else /* !SLICE */
static int
fdformat(dev, finfo, p)
dev_t dev;
struct fd_formb *finfo;
struct proc *p;
-#endif /* !SLICE */
{
fdu_t fdu;
fd_p fd;
@@ -1991,13 +1814,8 @@ fdformat(dev, finfo, p)
int rv = 0, s;
size_t fdblk;
-#ifdef SLICE
- fd = sd->drive;
- fdu = fd->unit;
-#else
fdu = FDUNIT(minor(dev));
fd = &fd_data[fdu];
-#endif
fdblk = 128 << fd->ft->secsize;
/* set up a buffer header for fdstrategy() */
@@ -2023,13 +1841,8 @@ fdformat(dev, finfo, p)
bp->b_data = (caddr_t)finfo;
/* now do the format */
-#ifdef SLICE
- bp->b_driver1 = sd;
- fdsIOreq(sd, bp);
-#else /* !SLICE */
bp->b_dev = dev;
fdstrategy(bp);
-#endif /* !SLICE */
/* ...and wait for it to complete */
s = splbio();
@@ -2085,33 +1898,10 @@ fdioctl(dev, cmd, addr, flag, p)
return ftioctl(dev, cmd, addr, flag, p);
#endif
-#ifdef SLICE
- /*
- * if SLICE is defined then only ft accesses come here
- * so break the rest off to another function for SLICE access.
- */
- return (ENOTTY);
-}
-
-/*
- * Slice ioctls come here
- */
-static int
-fdsioctl( void *private, u_long cmd, caddr_t addr, int flag, struct proc *p)
-{
- struct subdev *sd = private;
- fd_p fd = sd->drive;
- fdu_t fdu = fd->unit;
- fdc_p fdc = fd->fdc;
- fdcu_t fdcu = fdc->fdcu;
- size_t fdblk;
- int error = 0;
-#endif /* SLICE */
fdblk = 128 << fd->ft->secsize;
switch (cmd)
{
-#ifndef SLICE
case DIOCGDINFO:
bzero(buffer, sizeof (buffer));
dl = (struct disklabel *)buffer;
@@ -2155,7 +1945,6 @@ fdsioctl( void *private, u_long cmd, caddr_t addr, int flag, struct proc *p)
error = writedisklabel(dev, fdstrategy,
(struct disklabel *)buffer);
break;
-#endif /* !SLICE */
case FD_FORM:
if((flag & FWRITE) == 0)
error = EBADF; /* must be opened for writing */
@@ -2163,11 +1952,7 @@ fdsioctl( void *private, u_long cmd, caddr_t addr, int flag, struct proc *p)
FD_FORMAT_VERSION)
error = EINVAL; /* wrong version of formatting prog */
else
-#ifdef SLICE
- error = fdformat(sd, (struct fd_formb *)addr, p);
-#else
error = fdformat(dev, (struct fd_formb *)addr, p);
-#endif
break;
case FD_GTYPE: /* get drive type */
@@ -2211,35 +1996,6 @@ static void fd_drvinit(void *notused )
SYSINIT(fddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,fd_drvinit,NULL)
-#ifdef SLICE
-static int
-fdsopen(void *private, int flags, int mode, struct proc *p)
-{
- struct subdev *sd;
-
- sd = private;
-
- if((flags & (FREAD|FWRITE)) != 0) {
- return(Fdopen(makedev(0,sd->minor), flags , mode, p));
- } else {
- return(fdclose(makedev(0,sd->minor), 0 , mode, p));
- }
-}
-
-#if 0
-static void
-fdsclose(void *private, int flags, int mode, struct proc *p)
-{
- struct subdev *sd;
-
- sd = private;
-
- fdclose(makedev(0,sd->minor), 0 , 0, p);
- return ;
-}
-#endif /* 0 */
-
-#endif /* SLICE */
#endif
/*
OpenPOWER on IntegriCloud