diff options
author | phk <phk@FreeBSD.org> | 1999-12-08 09:33:00 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-12-08 09:33:00 +0000 |
commit | 551bfa2f51cfd055117aec7f1a0f17294cfbc260 (patch) | |
tree | 50da86bbbf154ce5c4d4932b562730a10096f3ab /sys/pc98 | |
parent | 224ba89395ce157c152e89a1113bab7205c0dcf9 (diff) | |
download | FreeBSD-src-551bfa2f51cfd055117aec7f1a0f17294cfbc260.zip FreeBSD-src-551bfa2f51cfd055117aec7f1a0f17294cfbc260.tar.gz |
Remove BAD144 support, it has already been disabled for some time.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/boot/biosboot/boot.c | 2 | ||||
-rw-r--r-- | sys/pc98/boot/biosboot/disk.c | 116 | ||||
-rw-r--r-- | sys/pc98/pc98/wd.c | 86 |
3 files changed, 4 insertions, 200 deletions
diff --git a/sys/pc98/boot/biosboot/boot.c b/sys/pc98/boot/biosboot/boot.c index c225bd3..faa4c37 100644 --- a/sys/pc98/boot/biosboot/boot.c +++ b/sys/pc98/boot/biosboot/boot.c @@ -363,7 +363,7 @@ loadprog(void) * because no str*() functions are available. The file has to be * copied to &disklabel for userconfig. It can't be loaded there * directly because the label is used late in readfile() in some - * unusual cases, e.g., for bad144 handling. + * unusual cases. */ s = name; t = kernel_config_namebuf; diff --git a/sys/pc98/boot/biosboot/disk.c b/sys/pc98/boot/biosboot/disk.c index ad9d3ff..5f9033f 100644 --- a/sys/pc98/boot/biosboot/disk.c +++ b/sys/pc98/boot/biosboot/disk.c @@ -42,9 +42,6 @@ */ #include "boot.h" -#ifdef DO_BAD144 -#include <sys/dkbad.h> -#endif DO_BAD144 #include <sys/disklabel.h> #include <sys/diskslice.h> @@ -55,10 +52,6 @@ #define SPT(di) ((di)&0xff) #define HEADS(di) (((di)>>8)&0xff) -#ifdef DO_BAD144 -static struct dkbad dkb; -static int do_bad144; -#endif DO_BAD144 static int bsize; static int spt, spc; @@ -79,7 +72,6 @@ static int ra_dev; static int ra_end; static int ra_first; -static int badsect(int sector); static char *Bread(int dosdev, int sector); int @@ -161,54 +153,6 @@ devopen(void) #endif -#ifdef DO_BAD144 - do_bad144 = 0; - if (dl->d_flags & D_BADSECT) { - /* this disk uses bad144 */ - int i; - int dkbbnum; - struct dkbad *dkbptr; - - /* find the first readable bad sector table */ - /* some of this code is copied from ufs/ufs_disksubr.c */ - /* including the bugs :-( */ - /* read a bad sector table */ - -#define BAD144_PART 2 /* XXX scattered magic numbers */ -#define BSD_PART 0 /* XXX should be 2 but bad144.c uses 0 */ - if (dl->d_partitions[BSD_PART].p_offset != 0) - dkbbnum = dl->d_partitions[BAD144_PART].p_offset - + dl->d_partitions[BAD144_PART].p_size; - else - dkbbnum = dl->d_secperunit; - dkbbnum -= dl->d_nsectors; - - if (dl->d_secsize > DEV_BSIZE) - dkbbnum *= dl->d_secsize / DEV_BSIZE; - else - dkbbnum /= DEV_BSIZE / dl->d_secsize; - i = 0; - do_bad144 = 0; - do { - /* XXX: what if the "DOS sector" < 512 bytes ??? */ - p = Bread(dosdev_copy, dkbbnum + i); - dkbptr = (struct dkbad *) p; -/* XXX why is this not in <sys/dkbad.h> ??? */ -#define DKBAD_MAGIC 0x4321 - if (dkbptr->bt_mbz == 0 && - dkbptr->bt_flag == DKBAD_MAGIC) { - dkb = *dkbptr; /* structure copy */ - do_bad144 = 1; - break; - } - i += 2; - } while (i < 10 && (unsigned)i < dl->d_nsectors); - if (!do_bad144) - printf("Bad bad sector table\n"); - else - printf("Using bad sector table at %d\n", dkbbnum+i); - } -#endif /* DO_BAD144 */ } #endif /* RAWBOOT */ return 0; @@ -228,7 +172,7 @@ devread(char *iodest, int sector, int cnt) for (offset = 0; offset < cnt; offset += BPS) { dosdev_copy = dosdev; - p = Bread(dosdev_copy, badsect(sector++)); + p = Bread(dosdev_copy, sector++); bcopy(p, iodest+offset, BPS); } } @@ -270,61 +214,3 @@ Bread(int dosdev, int sector) } return (ra_buf + (sector - ra_first) * BPS); } - -static int -badsect(int sector) -{ -#if defined(DO_BAD144) && !defined(RAWBOOT) - int i; - if (do_bad144) { - u_short cyl; - u_short head; - u_short sec; - int newsec; - struct disklabel *dl = &disklabel; - - /* XXX */ - /* from wd.c */ - /* bt_cyl = cylinder number in sorted order */ - /* bt_trksec is actually (head << 8) + sec */ - - /* only remap sectors in the partition */ - if (sector < boff || sector >= boff + bsize) { - goto no_remap; - } - - cyl = (sector-boff) / dl->d_secpercyl; - head = ((sector-boff) % dl->d_secpercyl) / dl->d_nsectors; - sec = (sector-boff) % dl->d_nsectors; - sec = (head<<8) + sec; - - /* now, look in the table for a possible bad sector */ - for (i=0; i<126; i++) { - if (dkb.bt_bad[i].bt_cyl == cyl) { - /* found same cylinder */ - if (dkb.bt_bad[i].bt_trksec == sec) { - /* FOUND! */ - break; - } - } else if (dkb.bt_bad[i].bt_cyl > cyl) { - i = 126; - break; - } - } - if (i == 126) { - /* didn't find bad sector */ - goto no_remap; - } - /* otherwise find replacement sector */ - if (dl->d_partitions[BSD_PART].p_offset != 0) - newsec = dl->d_partitions[BAD144_PART].p_offset - + dl->d_partitions[BAD144_PART].p_size; - else - newsec = dl->d_secperunit; - newsec -= dl->d_nsectors + i + 1; - return newsec; - } - no_remap: -#endif - return sector; -} diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index de272df..99976f5 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -41,12 +41,9 @@ * o Bump error count after timeout. * o Satisfy ATA timing in all cases. * o Finish merging berry/sos timeout code (bump error count...). - * o Merge/fix TIH/NetBSD bad144 code. * o Don't use polling except for initialization. Need to * reorganize the state machine. Then "extra" interrupts * shouldn't happen (except maybe one for initialization). - * o Fix disklabel, boot and driver inconsistencies with - * bad144 in standard versions. * o Support extended DOS partitions. * o Support swapping to DOS partitions. * o Handle bad sectors, clustering, disklabelling, DOS @@ -68,7 +65,6 @@ #include "opt_ide_delay.h" #include <sys/param.h> -#include <sys/dkbad.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/conf.h> @@ -679,35 +675,6 @@ wdstrategy(register struct buf *bp) if (dscheck(bp, du->dk_slices) <= 0) goto done; - /* - * Check for *any* block on this transfer being on the bad block list - * if it is, then flag the block as a transfer that requires - * bad block handling. Also, used as a hint for low level disksort - * clustering code to keep from coalescing a bad transfer into - * a normal transfer. Single block transfers for a large number of - * blocks associated with a cluster I/O are undesirable. - * - * XXX the old disksort() doesn't look at B_BAD. Coalescing _is_ - * desirable. We should split the results at bad blocks just - * like we should split them at MAXTRANSFER boundaries. - */ - if (dsgetbad(bp->b_dev, du->dk_slices) != NULL) { - long *badsect = dsgetbad(bp->b_dev, du->dk_slices)->bi_bad; - int i; - int nsecs = howmany(bp->b_bcount, DEV_BSIZE); - /* XXX pblkno is too physical. */ - daddr_t nspblkno = bp->b_pblkno - - du->dk_slices->dss_slices[dkslice(bp->b_dev)].ds_offset; - int blkend = nspblkno + nsecs; - - for (i = 0; badsect[i] != -1 && badsect[i] < blkend; i++) { - if (badsect[i] >= nspblkno) { - bp->b_flags |= B_BAD; - break; - } - } - } - /* queue transfer on drive, activate drive and controller if idle */ s = splbio(); @@ -864,16 +831,6 @@ wdstart(int ctrlr) du->dk_flags |= DKFL_SINGLE; } - if (du->dk_flags & DKFL_SINGLE - && dsgetbad(bp->b_dev, du->dk_slices) != NULL) { - /* XXX */ - u_long ds_offset = - du->dk_slices->dss_slices[dkslice(bp->b_dev)].ds_offset; - - blknum = transbad144(dsgetbad(bp->b_dev, du->dk_slices), - blknum - ds_offset) + ds_offset; - } - wdtab[ctrlr].b_active = 1; /* mark controller active */ /* if starting a multisector transfer, or doing single transfers */ @@ -1171,10 +1128,7 @@ oops: goto outt; } - if (du->dk_flags & DKFL_BADSCAN) { - bp->b_error = EIO; - bp->b_flags |= B_ERROR; - } else if (du->dk_status & WDCS_ERR) { + if (du->dk_status & WDCS_ERR) { if (++wdtab[unit].b_errcnt < RETRIES) { wdtab[unit].b_active = 0; } else { @@ -1389,9 +1343,6 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) &du->dk_dd); /* XXX check value returned by wdwsetctlr(). */ wdwsetctlr(du); - if (msg == NULL && du->dk_dd.d_flags & D_BADSECT) - msg = readbad144(dkmodpart(dev, RAW_PART), - &du->dk_dd, &du->dk_bad); du->dk_flags &= ~DKFL_LABELLING; if (msg != NULL) { log(LOG_WARNING, "wd%d: cannot find label (%s)\n", @@ -2078,17 +2029,7 @@ wdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) #ifdef PC98 outb(0x432,(du->dk_unit)%2); #endif - switch (cmd) { - case DIOCSBADSCAN: - if (*(int *)addr) - du->dk_flags |= DKFL_BADSCAN; - else - du->dk_flags &= ~DKFL_BADSCAN; - return (0); - - default: - return (ENOTTY); - } + return (ENOTTY); } int @@ -2205,29 +2146,6 @@ wddump(dev_t dev) * sector is bad, then reduce reduce the transfer to * avoid any bad sectors. */ - if (du->dk_flags & DKFL_SINGLE - && dsgetbad(dev, du->dk_slices) != NULL) { - for (blkchk = blknum; blkchk < blknum + blkcnt; blkchk++) { - daddr_t blknew; - blknew = transbad144(dsgetbad(dev, du->dk_slices), - blkchk - ds_offset) + ds_offset; - if (blknew != blkchk) { - /* Found bad block. */ - blkcnt = blkchk - blknum; - if (blkcnt > 0) { - blknext = blknum + blkcnt; - goto out; - } - blkcnt = 1; - blknext = blknum + blkcnt; -#if 1 || defined(WDDEBUG) - printf("bad block %ld -> %ld\n", - (long)blknum, (long)blknew); -#endif - break; - } - } - } out: /* Compute disk address. */ |