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.
This commit is contained in:
Bruce Evans 2000-01-30 07:58:14 +00:00
parent 268b25e18a
commit d02b52e7b5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56905

View File

@ -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. */