Rearrange top-level configuration to be more consistent.

This commit is contained in:
mycroft 1994-03-12 03:29:20 +00:00
parent fa9a6175a6
commit d72e576cfb
2 changed files with 22 additions and 94 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: isa.c,v 1.44 1994/03/10 21:38:46 mycroft Exp $ * $Id: isa.c,v 1.45 1994/03/12 03:29:20 mycroft Exp $
*/ */
/* /*
@ -94,8 +94,7 @@ u_short *Crtat = (u_short *)MONO_BUF;
#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */ #define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */ #define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */
int config_isadev(struct isa_device *, u_int *); int config_isadev(struct isa_device *);
void config_attach(struct isa_driver *, struct isa_device *);
static void sysbeepstop(int); static void sysbeepstop(int);
/* /*
@ -111,14 +110,9 @@ isa_configure()
INTREN(IRQ_SLAVE); INTREN(IRQ_SLAVE);
enable_intr(); enable_intr();
for (dvp = isa_devtab_tty; dvp->id_driver; dvp++) for (dvp = isa_devtab; dvp->id_driver; dvp++)
config_isadev(dvp, &ttymask); if (!dvp->id_parent || dvp->id_parent->id_alive)
for (dvp = isa_devtab_bio; dvp->id_driver; dvp++) config_isadev(dvp);
config_isadev(dvp, &biomask);
for (dvp = isa_devtab_net; dvp->id_driver; dvp++)
config_isadev(dvp, &netmask);
for (dvp = isa_devtab_null; dvp->id_driver; dvp++)
config_isadev(dvp, (u_int *) NULL);
printf("biomask %x ttymask %x netmask %x\n", printf("biomask %x ttymask %x netmask %x\n",
biomask, ttymask, netmask); biomask, ttymask, netmask);
@ -135,17 +129,16 @@ isa_configure()
/* /*
* Configure an ISA device. * Configure an ISA device.
*/ */
config_isadev(isdp, mp) config_isadev(isdp)
struct isa_device *isdp; struct isa_device *isdp;
u_int *mp;
{ {
struct isa_driver *dp = isdp->id_driver; struct isa_driver *dp = isdp->id_driver;
if (isdp->id_masunit != -1) { if (isdp->id_parent) {
/* Not really an ISA device; just call the probe and attach. */ /* Not really an ISA device; just call the probe and attach. */
isdp->id_alive = (*dp->probe)(isdp); isdp->id_alive = (*dp->probe)(isdp);
if (isdp->id_alive) if (isdp->id_alive)
config_attach(dp, isdp); (void)(*dp->attach)(isdp);
return; return;
} }
@ -189,7 +182,7 @@ config_isadev(isdp, mp)
printf(" flags 0x%x", isdp->id_flags); printf(" flags 0x%x", isdp->id_flags);
printf(" on isa\n"); printf(" on isa\n");
config_attach(dp, isdp); (void)(*dp->attach)(isdp);
if (isdp->id_irq) { if (isdp->id_irq) {
int intrno; int intrno;
@ -197,42 +190,13 @@ config_isadev(isdp, mp)
intrno = ffs(isdp->id_irq)-1; intrno = ffs(isdp->id_irq)-1;
setidt(ICU_OFFSET+intrno, isdp->id_intr, setidt(ICU_OFFSET+intrno, isdp->id_intr,
SDT_SYS386IGT, SEL_KPL); SDT_SYS386IGT, SEL_KPL);
if(mp) if (isdp->id_mask)
INTRMASK(*mp,isdp->id_irq); INTRMASK(*isdp->id_mask, isdp->id_irq);
INTREN(isdp->id_irq); INTREN(isdp->id_irq);
} }
} }
} }
void
config_attach(struct isa_driver *dp, struct isa_device *isdp)
{
extern struct isa_device isa_subdev[];
struct isa_device *dvp;
(void)(*dp->attach)(isdp);
/* XXXX This is for SCSI controllers, and it sucks. */
for (dvp = isa_subdev; dvp->id_driver; dvp++) {
if (dvp->id_driver != dp)
continue;
if (dvp->id_masunit != isdp->id_unit)
continue;
if (dvp->id_physid == -1)
continue;
dvp->id_alive = (*dp->attach)(dvp);
}
for (dvp = isa_subdev; dvp->id_driver; dvp++) {
if (dvp->id_driver != dp)
continue;
if (dvp->id_masunit != isdp->id_unit)
continue;
if (dvp->id_physid != -1)
continue;
dvp->id_alive = (*dp->attach)(dvp);
}
}
#define IDTVEC(name) __CONCAT(X,name) #define IDTVEC(name) __CONCAT(X,name)
/* default interrupt vector table entries */ /* default interrupt vector table entries */

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: isa.c,v 1.44 1994/03/10 21:38:46 mycroft Exp $ * $Id: isa.c,v 1.45 1994/03/12 03:29:20 mycroft Exp $
*/ */
/* /*
@ -94,8 +94,7 @@ u_short *Crtat = (u_short *)MONO_BUF;
#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */ #define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */ #define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */
int config_isadev(struct isa_device *, u_int *); int config_isadev(struct isa_device *);
void config_attach(struct isa_driver *, struct isa_device *);
static void sysbeepstop(int); static void sysbeepstop(int);
/* /*
@ -111,14 +110,9 @@ isa_configure()
INTREN(IRQ_SLAVE); INTREN(IRQ_SLAVE);
enable_intr(); enable_intr();
for (dvp = isa_devtab_tty; dvp->id_driver; dvp++) for (dvp = isa_devtab; dvp->id_driver; dvp++)
config_isadev(dvp, &ttymask); if (!dvp->id_parent || dvp->id_parent->id_alive)
for (dvp = isa_devtab_bio; dvp->id_driver; dvp++) config_isadev(dvp);
config_isadev(dvp, &biomask);
for (dvp = isa_devtab_net; dvp->id_driver; dvp++)
config_isadev(dvp, &netmask);
for (dvp = isa_devtab_null; dvp->id_driver; dvp++)
config_isadev(dvp, (u_int *) NULL);
printf("biomask %x ttymask %x netmask %x\n", printf("biomask %x ttymask %x netmask %x\n",
biomask, ttymask, netmask); biomask, ttymask, netmask);
@ -135,17 +129,16 @@ isa_configure()
/* /*
* Configure an ISA device. * Configure an ISA device.
*/ */
config_isadev(isdp, mp) config_isadev(isdp)
struct isa_device *isdp; struct isa_device *isdp;
u_int *mp;
{ {
struct isa_driver *dp = isdp->id_driver; struct isa_driver *dp = isdp->id_driver;
if (isdp->id_masunit != -1) { if (isdp->id_parent) {
/* Not really an ISA device; just call the probe and attach. */ /* Not really an ISA device; just call the probe and attach. */
isdp->id_alive = (*dp->probe)(isdp); isdp->id_alive = (*dp->probe)(isdp);
if (isdp->id_alive) if (isdp->id_alive)
config_attach(dp, isdp); (void)(*dp->attach)(isdp);
return; return;
} }
@ -189,7 +182,7 @@ config_isadev(isdp, mp)
printf(" flags 0x%x", isdp->id_flags); printf(" flags 0x%x", isdp->id_flags);
printf(" on isa\n"); printf(" on isa\n");
config_attach(dp, isdp); (void)(*dp->attach)(isdp);
if (isdp->id_irq) { if (isdp->id_irq) {
int intrno; int intrno;
@ -197,42 +190,13 @@ config_isadev(isdp, mp)
intrno = ffs(isdp->id_irq)-1; intrno = ffs(isdp->id_irq)-1;
setidt(ICU_OFFSET+intrno, isdp->id_intr, setidt(ICU_OFFSET+intrno, isdp->id_intr,
SDT_SYS386IGT, SEL_KPL); SDT_SYS386IGT, SEL_KPL);
if(mp) if (isdp->id_mask)
INTRMASK(*mp,isdp->id_irq); INTRMASK(*isdp->id_mask, isdp->id_irq);
INTREN(isdp->id_irq); INTREN(isdp->id_irq);
} }
} }
} }
void
config_attach(struct isa_driver *dp, struct isa_device *isdp)
{
extern struct isa_device isa_subdev[];
struct isa_device *dvp;
(void)(*dp->attach)(isdp);
/* XXXX This is for SCSI controllers, and it sucks. */
for (dvp = isa_subdev; dvp->id_driver; dvp++) {
if (dvp->id_driver != dp)
continue;
if (dvp->id_masunit != isdp->id_unit)
continue;
if (dvp->id_physid == -1)
continue;
dvp->id_alive = (*dp->attach)(dvp);
}
for (dvp = isa_subdev; dvp->id_driver; dvp++) {
if (dvp->id_driver != dp)
continue;
if (dvp->id_masunit != isdp->id_unit)
continue;
if (dvp->id_physid != -1)
continue;
dvp->id_alive = (*dp->attach)(dvp);
}
}
#define IDTVEC(name) __CONCAT(X,name) #define IDTVEC(name) __CONCAT(X,name)
/* default interrupt vector table entries */ /* default interrupt vector table entries */