Set si_iosize_max rather than d_maxio.

Register devsw in *attach instead of a SYSINIT.
This commit is contained in:
Poul-Henning Kamp 1999-09-20 19:58:38 +00:00
parent fae03f66d1
commit 2ab8cd46e9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51480
2 changed files with 14 additions and 29 deletions

View File

@ -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 */

View File

@ -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 */