summaryrefslogtreecommitdiff
path: root/sys/arch/octeon/dev
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2014-07-12 20:36:46 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2014-07-12 20:36:46 +0000
commit3dd428fff20728fb26f32433a9e3ffefe3b45d2e (patch)
tree5dcbf2ab5d7b8ba32f1cd5d80cc9d0d7c9be9f1a /sys/arch/octeon/dev
parentfb354461cf2882dc68d763f0115e3ebe1b1c0d03 (diff)
Calculate i/o starts and sizes in 'proper' sectors rather assuming
512-byte sectors. Unlikely to affect CF's in the near future. ok pirofti@
Diffstat (limited to 'sys/arch/octeon/dev')
-rw-r--r--sys/arch/octeon/dev/octcf.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/arch/octeon/dev/octcf.c b/sys/arch/octeon/dev/octcf.c
index 4f7b75ed621..4787dbed9d7 100644
--- a/sys/arch/octeon/dev/octcf.c
+++ b/sys/arch/octeon/dev/octcf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: octcf.c,v 1.15 2014/07/12 18:44:42 tedu Exp $ */
+/* $OpenBSD: octcf.c,v 1.16 2014/07/12 20:36:45 krw Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/*
@@ -367,13 +367,14 @@ octcfstart(void *arg)
void
_octcfstart(struct octcf_softc *wd, struct buf *bp)
{
- uint32_t blkno;
- uint32_t nblks;
+ struct disklabel *lp;
+ u_int64_t secno;
+ u_int64_t nsecs;
- blkno = bp->b_blkno +
- DL_GETPOFFSET(&wd->sc_dk.dk_label->d_partitions[DISKPART(bp->b_dev)]);
- blkno /= (SECTOR_SIZE / DEV_BSIZE);
- nblks = bp->b_bcount / SECTOR_SIZE;
+ lp = wd->sc_dk.dk_label;
+ secno = DL_BLKTOSEC(lp, bp->b_blkno) +
+ DL_GETPOFFSET(lp->d_partitions[DISKPART(bp->b_dev)]);
+ nblks = howmany(bp->b_bcount, lp->d_secsize);
wd->sc_bp = bp;
@@ -381,9 +382,9 @@ _octcfstart(struct octcf_softc *wd, struct buf *bp)
disk_busy(&wd->sc_dk);
if (bp->b_flags & B_READ)
- bp->b_error = octcf_read_sectors(wd, nblks, blkno, bp->b_data);
+ bp->b_error = octcf_read_sectors(wd, nsecs, secno, bp->b_data);
else
- bp->b_error = octcf_write_sectors(wd, nblks, blkno, bp->b_data);
+ bp->b_error = octcf_write_sectors(wd, nsecs, secno, bp->b_data);
octcfdone(wd);
}