diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-06-30 16:06:00 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-06-30 16:06:00 +0000 |
commit | 1459f9d620b69d196d9b1cc96af1063580b04229 (patch) | |
tree | 12f48e23f200dc18d609b897ec0db305d92ce998 /sys/dev/isa | |
parent | 06f11f10e94a862c42c4109c4d04ce1dd7a67a6e (diff) |
When duplicating isa_attach_args structures to build several attachement
possibilities for isapnp devices, make sure to carry the original ia_ic
member. Although mostly unused on i386, it is vital on alpha.
This makes isapnp on alpha attach without panicing.
Diffstat (limited to 'sys/dev/isa')
-rw-r--r-- | sys/dev/isa/isapnp.c | 4 | ||||
-rw-r--r-- | sys/dev/isa/isapnpres.c | 11 | ||||
-rw-r--r-- | sys/dev/isa/isavar.h | 9 |
3 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/isa/isapnp.c b/sys/dev/isa/isapnp.c index 1664d719990..18c9a8e23eb 100644 --- a/sys/dev/isa/isapnp.c +++ b/sys/dev/isa/isapnp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isapnp.c,v 1.32 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: isapnp.c,v 1.33 2002/06/30 16:05:58 miod Exp $ */ /* $NetBSD: isapnp.c,v 1.9.4.3 1997/10/29 00:40:43 thorpej Exp $ */ /* @@ -911,7 +911,7 @@ isapnp_attach(parent, self, aux) /* Good morning card c */ isapnp_write_reg(sc, ISAPNP_WAKE, c + 1); - if ((ipa = isapnp_get_resource(sc, c)) == NULL) + if ((ipa = isapnp_get_resource(sc, c, ia)) == NULL) continue; DPRINTF(("Selecting attachments\n")); diff --git a/sys/dev/isa/isapnpres.c b/sys/dev/isa/isapnpres.c index 09d434fd82b..d13189927ef 100644 --- a/sys/dev/isa/isapnpres.c +++ b/sys/dev/isa/isapnpres.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isapnpres.c,v 1.5 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: isapnpres.c,v 1.6 2002/06/30 16:05:59 miod Exp $ */ /* $NetBSD: isapnpres.c,v 1.7.4.1 1997/11/20 07:46:13 mellon Exp $ */ /* @@ -93,7 +93,7 @@ isapnp_newdev(card) { struct isa_attach_args *ipa, *dev = ISAPNP_MALLOC(sizeof(*dev)); - bzero(dev, sizeof(*dev)); + ISAPNP_CLONE_SETUP(dev, card); dev->ipa_pref = ISAPNP_DEP_ACCEPTABLE; bcopy(card->ipa_devident, dev->ipa_devident, @@ -122,7 +122,7 @@ isapnp_newconf(dev) { struct isa_attach_args *ipa, *conf = ISAPNP_MALLOC(sizeof(*conf)); - bzero(conf, sizeof(*conf)); + ISAPNP_CLONE_SETUP(conf, dev); bcopy(dev->ipa_devident, conf->ipa_devident, sizeof(conf->ipa_devident)); @@ -437,9 +437,10 @@ isapnp_process_tag(tag, len, buf, card, dev, conf) * Read the resources for card c */ struct isa_attach_args * -isapnp_get_resource(sc, c) +isapnp_get_resource(sc, c, template) struct isapnp_softc *sc; int c; + struct isa_attach_args *template; { u_char d, tag; u_short len; @@ -451,7 +452,7 @@ isapnp_get_resource(sc, c) bzero(buf, sizeof(buf)); card = ISAPNP_MALLOC(sizeof(*card)); - bzero(card, sizeof(*card)); + ISAPNP_CLONE_SETUP(card, template); #define NEXT_BYTE \ if (isapnp_wait_status(sc)) \ diff --git a/sys/dev/isa/isavar.h b/sys/dev/isa/isavar.h index 40c407f2a98..83185aa53c5 100644 --- a/sys/dev/isa/isavar.h +++ b/sys/dev/isa/isavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isavar.h,v 1.43 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: isavar.h,v 1.44 2002/06/30 16:05:59 miod Exp $ */ /* $NetBSD: isavar.h,v 1.26 1997/06/06 23:43:57 thorpej Exp $ */ /*- @@ -179,6 +179,11 @@ ERROR: COMPILING ISAPNP FOR UNSUPPORTED MACHINE, OR MORE THAN ONE. # define ISAPNP_MALLOC(a) malloc(a, M_DEVBUF, M_WAITOK) # define ISAPNP_FREE(a) free(a, M_DEVBUF) +# define ISAPNP_CLONE_SETUP(dest, src) \ + do { \ + bzero((dest), sizeof(*(dest))); \ + (dest)->ia_ic = (src)->ia_ic; \ + } while (0) #ifndef _DEV_ISA_ISAPNPREG_H_ /* @@ -443,7 +448,7 @@ isapnp_read_reg(sc, r) } struct isa_attach_args * - isapnp_get_resource(struct isapnp_softc *, int); + isapnp_get_resource(struct isapnp_softc *, int, struct isa_attach_args *); char *isapnp_id_to_vendor(char *, const u_char *); int isapnp_config(bus_space_tag_t, bus_space_tag_t, |