summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/fd.c16
-rw-r--r--sys/dev/isa/fdreg.h4
2 files changed, 9 insertions, 11 deletions
diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c
index ea26c1fd57a..b16144f4dac 100644
--- a/sys/dev/isa/fd.c
+++ b/sys/dev/isa/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.53 2006/03/15 20:20:41 miod Exp $ */
+/* $OpenBSD: fd.c,v 1.54 2006/08/13 03:36:24 krw Exp $ */
/* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */
/*-
@@ -346,7 +346,7 @@ fdstrategy(bp)
struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(bp->b_dev)];
int sz;
int s;
- int fd_bsize = 128 << fd->sc_type->secsize;
+ int fd_bsize = FD_BSIZE(fd);
int bf = fd_bsize / DEV_BSIZE;
/* Valid unit, controller, and request? */
@@ -618,7 +618,7 @@ fdintr(fdc)
int read, head, sec, i, nblks;
struct fd_type *type;
struct fd_formb *finfo = NULL;
- int fd_bsize, bf;
+ int fd_bsize;
loop:
/* Is there a transfer to this drive? If not, deactivate drive. */
@@ -627,8 +627,7 @@ loop:
fdc->sc_state = DEVIDLE;
return 1;
}
- fd_bsize = 128 << fd->sc_type->secsize;
- bf = fd_bsize / FDC_BSIZE;
+ fd_bsize = FD_BSIZE(fd);
bp = fd->sc_q.b_actf;
if (bp == NULL) {
@@ -937,8 +936,7 @@ fdretry(fd)
default:
fail:
diskerr(bp, "fd", "hard error", LOG_PRINTF,
- fd->sc_skip / (128 << fd->sc_type->secsize),
- (struct disklabel *)NULL);
+ fd->sc_skip / FD_BSIZE(fd), (struct disklabel *)NULL);
printf(" (st0 %b st1 %b st2 %b cyl %d head %d sec %d)\n",
fdc->sc_status[0], NE7_ST0BITS,
fdc->sc_status[1], NE7_ST1BITS,
@@ -975,7 +973,7 @@ fdioctl(dev, cmd, addr, flag, p)
bzero(lp, sizeof(*lp));
bzero(&cdl, sizeof(struct cpu_disklabel));
- lp->d_secsize = 128 << fd->sc_type->secsize;
+ lp->d_secsize = FD_BSIZE(fd);
lp->d_secpercyl = fd->sc_type->seccyl;
lp->d_ntracks = fd->sc_type->heads;
lp->d_nsectors = fd->sc_type->sectrac;
@@ -1065,7 +1063,7 @@ fdformat(dev, finfo, p)
struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)];
struct fd_type *type = fd->sc_type;
struct buf *bp;
- int fd_bsize = 128 << fd->sc_type->secsize;
+ int fd_bsize = FD_BSIZE(fd);
/* set up a buffer header for fdstrategy() */
bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT);
diff --git a/sys/dev/isa/fdreg.h b/sys/dev/isa/fdreg.h
index 7c4ec33b095..492cd3038b8 100644
--- a/sys/dev/isa/fdreg.h
+++ b/sys/dev/isa/fdreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdreg.h,v 1.11 2003/06/02 23:28:02 millert Exp $ */
+/* $OpenBSD: fdreg.h,v 1.12 2006/08/13 03:36:24 krw Exp $ */
/* $NetBSD: fdreg.h,v 1.8 1995/06/28 04:30:57 cgd Exp $ */
/*-
@@ -59,10 +59,10 @@
#define fdin 0 /* Digital Input Register (R) */
#define FDI_DCHG 0x80 /* diskette has been changed */
-#define FDC_BSIZE 512
#define FDC_NPORT 6
#define FDCTL_NPORT 1
#define FDC_MAXIOSIZE NBPG /* XXX should be MAXBSIZE */
+#define FD_BSIZE(fd) (128 << fd->sc_type->secsize)
#define FDUNIT(dev) ((dev & 0x80) >> 7) /* XXX two drives max, sorry */
#define FDTYPE(dev) ((minor(dev) & 0x70) >> 4)