diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 9c054170d535..ed856615a776 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -400,12 +400,18 @@ wdattach(struct isa_device *dvp) struct disk *du; struct wdparams *wp; static char buf[] = "wdcXXX"; + static int once; dvp->id_intr = wdintr; if (dvp->id_unit >= NWDC) return (0); + if (!once) { + cdevsw_add(&wd_cdevsw); + once++; + } + if (eide_quirks & Q_CMD640B) { if (dvp->id_unit == PRIMARY) { printf("wdc0: CMD640B workaround enabled\n"); @@ -1187,6 +1193,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) if (du == NULL) return (ENXIO); + dev->si_iosize_max = 248 * 512; /* Finish flushing IRQs left over from wdattach(). */ if (wdtab[du->dk_ctrlr_cmd640].b_active == 2) wdtab[du->dk_ctrlr_cmd640].b_active = 0; @@ -2290,16 +2297,4 @@ wdwait(struct disk *du, u_char bits_wanted, int timeout) return (-1); } -static void wd_drvinit(void *unused) -{ - - if (wd_cdevsw.d_maxio == 0) - wd_cdevsw.d_maxio = 248 * 512; - cdevsw_add(&wd_cdevsw); -} - -SYSINIT(wddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wd_drvinit,NULL) - - - #endif /* NWDC > 0 */ diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index 4cfc1041e9c6..596857e3a541 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -481,12 +481,18 @@ wdattach(struct isa_device *dvp) struct disk *du; struct wdparams *wp; static char buf[] = "wdcXXX"; + static int once; dvp->id_intr = wdintr; if (dvp->id_unit >= NWDC) return (0); + if (!once) { + cdevsw_add(&wd_cdevsw); + once++; + } + if (eide_quirks & Q_CMD640B) { if (dvp->id_unit == PRIMARY) { printf("wdc0: CMD640B workaround enabled\n"); @@ -1309,6 +1315,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) if (du == NULL) return (ENXIO); + dev->si_iosize_max = 248 * 512; #ifdef PC98 outb(0x432,(du->dk_unit)%2); #endif @@ -2563,21 +2570,4 @@ wdwait(struct disk *du, u_char bits_wanted, int timeout) return (-1); } -static int wd_devsw_installed; - -static void wd_drvinit(void *unused) -{ - - if( ! wd_devsw_installed ) { - if (wd_cdevsw.d_maxio == 0) - wd_cdevsw.d_maxio = 248 * 512; - cdevsw_add(&wd_cdevsw); - wd_devsw_installed = 1; - } -} - -SYSINIT(wddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wd_drvinit,NULL) - - - #endif /* NWDC > 0 */