Synced with sys/i386/isa/wd.c revision 1.219.

Approved by:	jkh
This commit is contained in:
kato 2000-02-01 08:57:21 +00:00
parent 30a54f9992
commit 60a186b3e8

View File

@ -834,8 +834,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;
@ -2062,7 +2061,7 @@ wddump(dev_t dev)
long num; /* number of sectors to write */
int lunit, part;
long blkoff, blknum;
long blkchk, blkcnt, blknext;
long blkcnt, blknext;
u_long ds_offset;
u_long nblocks;
static int wddoingadump = 0;
@ -2099,8 +2098,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. */
@ -2133,29 +2132,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.
*/
out:
/* 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. */