Make sure a MCPCIA exists before trying to initialize it. Also make

sure a MCPCIA softc exists before trying to do post-config cleanup
on it.
This commit is contained in:
mjacob 1999-11-16 18:33:11 +00:00
parent 87bb3a7b2b
commit ce28c5e558
1 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcpcia.c,v 1.6 1999/11/04 19:15:23 thorpej Exp $ */
/* $NetBSD: mcpcia.c,v 1.7 1999/11/16 18:33:11 mjacob Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -74,7 +74,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcpcia.c,v 1.6 1999/11/04 19:15:23 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcpcia.c,v 1.7 1999/11/16 18:33:11 mjacob Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -97,6 +97,12 @@ __KERNEL_RCSID(0, "$NetBSD: mcpcia.c,v 1.6 1999/11/04 19:15:23 thorpej Exp $");
(((unsigned long) (mc)->cc_mid) << MCBUS_MID_SHIFT) | \
(MCBUS_IOSPACE))
#define MCPCIA_PROBE(mid, gid) \
badaddr((void *)KV(((((unsigned long) gid) << MCBUS_GID_SHIFT) | \
(((unsigned long) mid) << MCBUS_MID_SHIFT) | \
(MCBUS_IOSPACE) | MCPCIA_PCI_BRIDGE | _MCPCIA_PCI_REV)), \
sizeof(u_int32_t))
static int mcpciamatch __P((struct device *, struct cfdata *, void *));
static void mcpciaattach __P((struct device *, struct device *, void *));
struct cfattach mcpcia_ca = {
@ -152,6 +158,14 @@ mcpciaattach(parent, self, aux)
struct pcibus_attach_args pba;
u_int32_t ctl;
/*
* Make sure this MCPCIA exists...
*/
if (MCPCIA_PROBE(ma->ma_mid, ma->ma_gid)) {
mcp->mcpcia_cc = NULL;
printf(" (not present)\n");
return;
}
printf("\n");
/*
@ -328,6 +342,8 @@ mcpcia_config_cleanup()
continue;
ccp = mcp->mcpcia_cc;
if (ccp == NULL)
continue;
ctl = REGVAL(MCPCIA_INT_MASK0(ccp));
ctl |= MCPCIA_GEN_IENABL;