summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2000-01-30 07:58:14 +0000
committerbde <bde@FreeBSD.org>2000-01-30 07:58:14 +0000
commitc0ba1d663e0dbcbc9c3df48b6474594255f27425 (patch)
tree804252f05df65cbf7e3c9847b62086165d42919b /sys/i386
parentacdc4c82d5f0427f5bd57c515dd1baa6b4d2d4d8 (diff)
downloadFreeBSD-src-c0ba1d663e0dbcbc9c3df48b6474594255f27425.zip
FreeBSD-src-c0ba1d663e0dbcbc9c3df48b6474594255f27425.tar.gz
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.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/isa/wd.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 66ae5fc..160bd2a 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. */
OpenPOWER on IntegriCloud