diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-12-08 09:33:00 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-12-08 09:33:00 +0000 |
commit | 7d5961670c670c1ecf837591da6b69d39e12423c (patch) | |
tree | 1f8191b0c38dfab88f83f5a0e8be2940a515c0be /sys/pc98/boot/biosboot/disk.c | |
parent | a3fb836cb5d5a57a93732f91e2b0d8cb898c108a (diff) |
Remove BAD144 support, it has already been disabled for some time.
Notes
Notes:
svn path=/head/; revision=54294
Diffstat (limited to 'sys/pc98/boot/biosboot/disk.c')
-rw-r--r-- | sys/pc98/boot/biosboot/disk.c | 116 |
1 files changed, 1 insertions, 115 deletions
diff --git a/sys/pc98/boot/biosboot/disk.c b/sys/pc98/boot/biosboot/disk.c index ad9d3ff74d88..5f9033fc801d 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; -} |