summaryrefslogtreecommitdiffstats
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2013-11-21 00:13:33 +0000
committerdlg <dlg@openbsd.org>2013-11-21 00:13:33 +0000
commit27f37992c7cdc39b161d12d3ddece4279978470d (patch)
treec7debb46788f6d3bc7ca81110db36be15bf72332 /sys/arch/sparc
parentUpdate comments mentioning `resource maps' to mention `extents' instead. (diff)
downloadwireguard-openbsd-27f37992c7cdc39b161d12d3ddece4279978470d.tar.xz
wireguard-openbsd-27f37992c7cdc39b161d12d3ddece4279978470d.zip
remove the #define b_cylinder b_resid from bufs. i hated the
overloading of that thing. the only hardware that seems to care about cylinders in our tree are floppy drives, and the drivers for those calculate their own cylinders from logical block addresses and ignore whatever the rest of the kernel thought b_cylinders should be. most of this diff is moving the floppy drivers to using b_resid as a resid and using that as part of the calculation for real cylinder values. the rest of the diff is getting rid of the useless assignments to b_cylinder that dont get used by anything (now that disksort is gone). ok miod@
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/dev/fd.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index 7dbb9a57ddc..d1f4352c4c3 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.87 2013/11/18 01:56:35 dlg Exp $ */
+/* $OpenBSD: fd.c,v 1.88 2013/11/21 00:13:33 dlg Exp $ */
/* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */
/*-
@@ -705,6 +705,7 @@ fdstrategy(bp)
if (bp->b_bcount == 0)
goto done;
+ bp->b_resid = bp->b_count;
sz = howmany(bp->b_bcount, DEV_BSIZE);
if (bp->b_blkno + sz > (fd->sc_type->size * DEV_BSIZE) / FD_BSIZE(fd)) {
@@ -712,7 +713,6 @@ fdstrategy(bp)
- bp->b_blkno;
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
- bp->b_resid = bp->b_bcount;
goto done;
}
if (sz < 0) {
@@ -724,14 +724,11 @@ fdstrategy(bp)
bp->b_bcount = sz << DEV_BSHIFT;
}
- bp->b_cylinder = (bp->b_blkno * DEV_BSIZE) /
- (FD_BSIZE(fd) * fd->sc_type->seccyl);
-
#ifdef FD_DEBUG
if (fdc_debug > 1)
- printf("fdstrategy: b_blkno %lld b_bcount %ld blkno %lld "
- "cylin %ld\n", (long long)bp->b_blkno, bp->b_bcount,
- (long long)fd->sc_blkno, bp->b_cylinder);
+ printf("fdstrategy: b_blkno %lld b_bcount %ld blkno %lld\n",
+ (long long)bp->b_blkno, bp->b_bcount,
+ (long long)fd->sc_blkno);
#endif
/* Queue transfer */
@@ -802,7 +799,6 @@ fdfinish(fd, bp)
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
}
- bp->b_resid = fd->sc_bcount;
biodone(bp);
/* turn off motor 5s from now */
timeout_add_sec(&fd->fd_motor_off_to, 5);
@@ -1262,11 +1258,10 @@ fdcstate(fdc)
struct fd_softc *fd;
struct buf *bp;
- int read, head, sec, nblks;
+ int read, head, sec, nblks, cylin;
struct fd_type *type;
struct fd_formb *finfo = NULL;
-
if (fdc->sc_istatus == FDC_ISTATUS_ERROR) {
/* Prevent loop if the reset sequence produces errors */
if (fdc->sc_state != RESETCOMPLETE &&
@@ -1295,6 +1290,9 @@ loop:
goto loop;
}
+ cylin = ((bp->b_blkno * DEV_BSIZE) + (bp->b_bcount - bp->b_resid)) /
+ (FD_BSIZE(fd) * fd->sc_type->seccyl);
+
if (bp->b_flags & B_FORMAT)
finfo = (struct fd_formb *)bp->b_data;
@@ -1336,12 +1334,12 @@ loop:
doseek:
if ((fdc->sc_flags & FDC_EIS) &&
(bp->b_flags & B_FORMAT) == 0) {
- fd->sc_cylin = bp->b_cylinder;
+ fd->sc_cylin = cylin;
/* We use implied seek */
goto doio;
}
- if (fd->sc_cylin == bp->b_cylinder)
+ if (fd->sc_cylin == cylin)
goto doio;
fd->sc_cylin = -1;
@@ -1363,7 +1361,7 @@ loop:
/* seek function */
FDC_WRFIFO(fdc, NE7CMD_SEEK);
FDC_WRFIFO(fdc, fd->sc_drive); /* drive number */
- FDC_WRFIFO(fdc, bp->b_cylinder * fd->sc_type->step);
+ FDC_WRFIFO(fdc, cylin * fd->sc_type->step);
return (1);
@@ -1459,7 +1457,7 @@ loop:
/* Make sure seek really happened. */
if (fdc->sc_nstat != 2 || (st0 & 0xf8) != 0x20 ||
- cyl != bp->b_cylinder * fd->sc_type->step) {
+ cyl != cylin * fd->sc_type->step) {
#ifdef FD_DEBUG
if (fdc_debug)
fdcstatus(fdc, "seek failed");
@@ -1467,7 +1465,7 @@ loop:
fdcretry(fdc);
goto loop;
}
- fd->sc_cylin = bp->b_cylinder;
+ fd->sc_cylin = cylin;
goto doio;
case IOTIMEDOUT:
@@ -1574,8 +1572,9 @@ loop:
fd->sc_blkno += fd->sc_nblks;
fd->sc_skip += fd->sc_nbytes;
fd->sc_bcount -= fd->sc_nbytes;
+ bp->b_resid -= fd->sc_nbytes;
if (finfo == NULL && fd->sc_bcount > 0) {
- bp->b_cylinder = fd->sc_blkno / fd->sc_type->seccyl;
+ cylin = fd->sc_blkno / fd->sc_type->seccyl;
goto doseek;
}
fdfinish(fd, bp);
@@ -1723,6 +1722,7 @@ fdcretry(fdc)
failsilent:
bp->b_flags |= B_ERROR;
bp->b_error = error;
+ bp->b_resid = bp->b_bcount;
fdfinish(fd, bp);
}
fdc->sc_errors++;