From d02b52e7b559b54c6beff960cec18b3e3627cdd0 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Sun, 30 Jan 2000 07:58:14 +0000 Subject: [PATCH] Fixed longstanding brokenness of wddump() in LBA mode. LBA mode may now be safe enough to recommend for working around the problem with CHS mode normally being limited to 65536*16*63 sectors. Fixed bitrot in related debugging code. Fixed related style bugs. Removed another vestige of bad144 support. --- sys/i386/isa/wd.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 66ae5fcb247b..160bd2a4e32f 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -725,8 +725,7 @@ wdstart(int ctrlr) sector = (blknum >> 0) & 0xff; cylin = (blknum >> 8) & 0xffff; head = ((blknum >> 24) & 0xf) | WDSD_LBA; - } - else { + } else { cylin = blknum / secpercyl; head = (blknum % secpercyl) / secpertrk; sector = blknum % secpertrk; @@ -1860,8 +1859,8 @@ wddump(dev_t dev) blkoff += ds_offset; #if 0 - pg("part %x, nblocks %d, dumplo %d num %d\n", - part, nblocks, dumplo, num); + printf("part %d, nblocks %lu, dumplo %ld num %ld\n", + part, nblocks, dumplo, num); #endif /* Check transfer bounds against partition size. */ @@ -1894,28 +1893,30 @@ wddump(dev_t dev) blkcnt = num; if (blkcnt > MAXTRANSFER) blkcnt = MAXTRANSFER; - /* Keep transfer within current cylinder. */ - if ((blknum + blkcnt - 1) / secpercyl != blknum / secpercyl) - blkcnt = secpercyl - (blknum % secpercyl); + if ((du->dk_flags & DKFL_LBA) == 0) { + /* XXX keep transfer within current cylinder. */ + if ((blknum + blkcnt - 1) / secpercyl != + blknum / secpercyl) + blkcnt = secpercyl - (blknum % secpercyl); + } blknext = blknum + blkcnt; - /* - * See if one of the sectors is in the bad sector list - * (if we have one). If the first sector is bad, then - * reduce the transfer to this one bad sector; if another - * sector is bad, then reduce reduce the transfer to - * avoid any bad sectors. - */ - /* Compute disk address. */ - cylin = blknum / secpercyl; - head = (blknum % secpercyl) / secpertrk; - sector = blknum % secpertrk; + if (du->dk_flags & DKFL_LBA) { + sector = (blknum >> 0) & 0xff; + cylin = (blknum >> 8) & 0xffff; + head = ((blknum >> 24) & 0xf) | WDSD_LBA; + } else { + cylin = blknum / secpercyl; + head = (blknum % secpercyl) / secpertrk; + sector = blknum % secpertrk; + } #if 0 /* Let's just talk about this first... */ - pg("cylin l%d head %ld sector %ld addr 0x%x count %ld", - cylin, head, sector, addr, blkcnt); + printf("cylin %ld head %ld sector %ld addr %p count %ld\n", + cylin, head, sector, addr, blkcnt); + cngetc(); #endif /* Do the write. */