diff options
author | kato <kato@FreeBSD.org> | 1999-12-09 12:30:32 +0000 |
---|---|---|
committer | kato <kato@FreeBSD.org> | 1999-12-09 12:30:32 +0000 |
commit | 5cec9086b077ebf2671fb2717b21dd799e11a9e1 (patch) | |
tree | 7d50de89f077abe80bec33966cfd338d3de5973c /sys/pc98 | |
parent | 123ed1d90ae05cc101d2646d269653214548c3e2 (diff) | |
download | FreeBSD-src-5cec9086b077ebf2671fb2717b21dd799e11a9e1.zip FreeBSD-src-5cec9086b077ebf2671fb2717b21dd799e11a9e1.tar.gz |
Sync with sys/i386/isa/wd.c rev 1.216.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/pc98/wd.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index 99976f5..727aeb4 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -46,9 +46,9 @@ * shouldn't happen (except maybe one for initialization). * o Support extended DOS partitions. * o Support swapping to DOS partitions. - * o Handle bad sectors, clustering, disklabelling, DOS - * partitions and swapping driver-independently. Use - * i386/dkbad.c for bad sectors. Swapping will need new + * o Handle clustering, disklabelling, DOS + * partitions and swapping driver-independently. + * Swapping will need new * driver entries for polled reinit and polled write). */ @@ -174,7 +174,6 @@ struct disk { #define DKFL_LABELLING 0x00080 /* readdisklabel() in progress */ #define DKFL_32BIT 0x00100 /* use 32-bit i/o mode */ #define DKFL_MULTI 0x00200 /* use multi-i/o mode */ -#define DKFL_BADSCAN 0x00400 /* report all errors */ #define DKFL_USEDMA 0x00800 /* use DMA for data transfers */ #define DKFL_DMA 0x01000 /* using DMA on this transfer-- DKFL_SINGLE * overrides this @@ -1272,8 +1271,6 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) if (wdtab[du->dk_ctrlr_cmd640].b_active == 2) wdtab[du->dk_ctrlr_cmd640].b_active = 0; - du->dk_flags &= ~DKFL_BADSCAN; - /* spin waiting for anybody else reading the disk label */ while (du->dk_flags & DKFL_LABELLING) tsleep((caddr_t)&du->dk_flags, PZERO - 1, "wdopen", 1); @@ -1343,6 +1340,9 @@ 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", @@ -1810,8 +1810,7 @@ again: } /* * Fake minimal drive geometry for reading the MBR. - * readdisklabel() may enlarge it to read the label and the - * bad sector table. + * readdisklabel() may enlarge it to read the label. */ du->dk_dd.d_secsize = DEV_BSIZE; du->dk_dd.d_nsectors = 17; @@ -2029,7 +2028,17 @@ wdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) #ifdef PC98 outb(0x432,(du->dk_unit)%2); #endif - return (ENOTTY); + switch (cmd) { + case DIOCSBADSCAN: + if (*(int *)addr) + du->dk_flags |= DKFL_BADSCAN; + else + du->dk_flags &= ~DKFL_BADSCAN; + return (0); + + default: + return (ENOTTY); + } } int @@ -2063,7 +2072,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; @@ -2146,7 +2155,6 @@ wddump(dev_t dev) * sector is bad, then reduce reduce the transfer to * avoid any bad sectors. */ -out: /* Compute disk address. */ cylin = blknum / secpercyl; |