diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-08-14 21:50:50 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-08-14 21:50:50 +0000 |
commit | 68a08cd3daa393fda25f32dfe2deba40e312691a (patch) | |
tree | 55fa28431fee7ffda402e87bc77367ea60565e52 /sys/dev | |
parent | b89c8a0d48c60ed6bf4440b7b3e217d8df068f42 (diff) |
Kill the musyccbus/ebus device and use musycc for both functions of the
chip. Using two different devices for one card was a stupid idea.
OK deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/files.pci | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_art.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/musycc.c | 24 | ||||
-rw-r--r-- | sys/dev/pci/musycc_obsd.c | 80 | ||||
-rw-r--r-- | sys/dev/pci/musyccvar.h | 21 |
5 files changed, 46 insertions, 99 deletions
diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index 5501fa17464..e8e592433f0 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.186 2005/08/14 07:30:00 deraadt Exp $ +# $OpenBSD: files.pci,v 1.187 2005/08/14 21:50:49 claudio Exp $ # $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $ # # Config file and device description for machine-independent PCI code. @@ -545,16 +545,14 @@ device ichwdt {} attach ichwdt at pci file dev/pci/ichwdt.c ichwdt -# Mindspeed/Conexant MUSYCC HDLC controller and EBUS bridge +# Mindspeed/Conexant MUSYCC HDLC controller device musycc {} : ifnet attach musycc at pci -device musyccbus {} : musycc -attach musyccbus at pci -file dev/pci/musycc.c musycc | musyccbus -file dev/pci/musycc_obsd.c musycc | musyccbus +file dev/pci/musycc.c musycc +file dev/pci/musycc_obsd.c musycc # Accoom Artery PCI card -device art: musycc, musyccbus, ifnet, ifmedia, sppp +device art: musycc, ifnet, ifmedia, sppp attach art at musycc file dev/pci/if_art.c art file dev/pci/bt8370.c art diff --git a/sys/dev/pci/if_art.c b/sys/dev/pci/if_art.c index 9973f8b9060..0549b6208ea 100644 --- a/sys/dev/pci/if_art.c +++ b/sys/dev/pci/if_art.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_art.c,v 1.3 2005/08/13 23:52:49 claudio Exp $ */ +/* $OpenBSD: if_art.c,v 1.4 2005/08/14 21:50:49 claudio Exp $ */ /* * Copyright (c) 2004,2005 Internet Business Solutions AG, Zurich, Switzerland @@ -321,18 +321,18 @@ art_onesec(void *arg) case 1: link_state = LINK_STATE_UP; /* set led green but ask sppp if red is needed */ - ebus_set_led(ac->art_channel->cc_group->mg_hdlc->mc_ebus, 1); + ebus_set_led(ac->art_channel->cc_group->mg_hdlc->mc_other, 1); ac->art_status |= IFM_ACTIVE; break; case 0: link_state = LINK_STATE_DOWN; /* set led green & red */ - ebus_set_led(ac->art_channel->cc_group->mg_hdlc->mc_ebus, 3); + ebus_set_led(ac->art_channel->cc_group->mg_hdlc->mc_other, 3); break; default: link_state = LINK_STATE_DOWN; /* set led red */ - ebus_set_led(ac->art_channel->cc_group->mg_hdlc->mc_ebus, 2); + ebus_set_led(ac->art_channel->cc_group->mg_hdlc->mc_other, 2); break; } diff --git a/sys/dev/pci/musycc.c b/sys/dev/pci/musycc.c index 33d8a610bcc..253098e32a4 100644 --- a/sys/dev/pci/musycc.c +++ b/sys/dev/pci/musycc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: musycc.c,v 1.2 2005/08/13 23:52:49 claudio Exp $ */ +/* $OpenBSD: musycc.c,v 1.3 2005/08/14 21:50:49 claudio Exp $ */ /* * Copyright (c) 2004,2005 Internet Business Solutions AG, Zurich, Switzerland @@ -1520,15 +1520,9 @@ musycc_sreq(struct musycc_group *mg, int channel, u_int32_t req, int dir, int ebus_intr(void *arg) { - struct ebus_softc *ec = arg; -#if 0 - struct framer_softc *fc; + struct musycc_softc *sc = arg; - SLIST_FOREACH(fc, &sc->sc_hdlc->sc_framers, list) { - f->sc_intr(f); - } -#endif - printf("%s: interrupt\n", ec->ec_dev.dv_xname); + printf("%s: interrupt\n", sc->mc_dev.dv_xname); return (1); } @@ -1536,12 +1530,12 @@ int ebus_attach_device(struct ebus_dev *e, struct musycc_softc *mc, bus_size_t offset, bus_size_t size) { - struct ebus_softc *ec = mc->mc_ebus; + struct musycc_softc *ec = mc->mc_other; e->base = offset << 2; e->size = size; - e->st = ec->ec_st; - return (bus_space_subregion(ec->ec_st, ec->ec_sh, offset << 2, + e->st = ec->mc_st; + return (bus_space_subregion(ec->mc_st, ec->mc_sh, offset << 2, size, &e->sh)); } @@ -1575,10 +1569,10 @@ ebus_read_buf(struct ebus_dev *rom, bus_size_t offset, void *buf, size_t size) } void -ebus_set_led(struct ebus_softc *esc, u_int8_t value) +ebus_set_led(struct musycc_softc *esc, u_int8_t value) { - bus_space_write_1(esc->ec_st, esc->ec_sh, esc->ec_ledbase << 2, value); - bus_space_barrier(esc->ec_st, esc->ec_sh, esc->ec_ledbase << 2, 1, + bus_space_write_1(esc->mc_st, esc->mc_sh, esc->mc_ledbase << 2, value); + bus_space_barrier(esc->mc_st, esc->mc_sh, esc->mc_ledbase << 2, 1, BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE); } diff --git a/sys/dev/pci/musycc_obsd.c b/sys/dev/pci/musycc_obsd.c index 1bbeecb38e9..2f9c215ac4c 100644 --- a/sys/dev/pci/musycc_obsd.c +++ b/sys/dev/pci/musycc_obsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: musycc_obsd.c,v 1.3 2005/08/14 11:43:46 deraadt Exp $ */ +/* $OpenBSD: musycc_obsd.c,v 1.4 2005/08/14 21:50:49 claudio Exp $ */ /* * Copyright (c) 2004,2005 Internet Business Solutions AG, Zurich, Switzerland @@ -43,25 +43,18 @@ int musycc_match(struct device *, void *, void *); int musyccbus_match(struct device *, void *, void *); void musycc_softc_attach(struct device *, struct device *, void *); -void musyccbus_softc_attach(struct device *, struct device *, void *); -int musyccbus_print(void *, const char *); +void musycc_ebus_attach(struct device *, struct musycc_softc *, + struct pci_attach_args *); +int musycc_ebus_print(void *, const char *); struct cfattach musycc_ca = { sizeof(struct musycc_softc), musycc_match, musycc_softc_attach }; -struct cfattach musyccbus_ca = { - sizeof(struct ebus_softc), musyccbus_match, musyccbus_softc_attach -}; - struct cfdriver musycc_cd = { NULL, "musycc", DV_DULL }; -struct cfdriver musyccbus_cd = { - NULL, "ebus", DV_DULL -}; - SLIST_HEAD(, musycc_softc) msc_list = SLIST_HEAD_INITIALIZER(msc_list); const struct pci_matchid musycc_pci_devices[] = { @@ -74,27 +67,8 @@ const struct pci_matchid musycc_pci_devices[] = { int musycc_match(struct device *parent, void *match, void *aux) { - int rv; - struct pci_attach_args *pa = aux; - - rv = pci_matchbyid((struct pci_attach_args *)aux, musycc_pci_devices, - sizeof(musycc_pci_devices)/sizeof(musycc_pci_devices[0])); - if (rv != 0 && pa->pa_function == 0) - return (rv); - return (0); -} - -int -musyccbus_match(struct device *parent, void *match, void *aux) -{ - int rv; - struct pci_attach_args *pa = aux; - - rv = pci_matchbyid((struct pci_attach_args *)aux, musycc_pci_devices, - sizeof(musycc_pci_devices)/sizeof(musycc_pci_devices[0])); - if (rv != 0 && pa->pa_function == 1) - return (rv); - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, musycc_pci_devices, + sizeof(musycc_pci_devices)/sizeof(musycc_pci_devices[0]))); } void @@ -133,6 +107,9 @@ musycc_softc_attach(struct device *parent, struct device *self, void *aux) break; } + if (pa->pa_function == 1) + return (musycc_ebus_attach(parent, sc, pa)); + sc->bus = parent->dv_unit; sc->device = pa->pa_device; SLIST_INSERT_HEAD(&msc_list, sc, list); @@ -163,13 +140,12 @@ musycc_softc_attach(struct device *parent, struct device *self, void *aux) } void -musyccbus_softc_attach(struct device *parent, struct device *self, void *aux) +musycc_ebus_attach(struct device *parent, struct musycc_softc *esc, + struct pci_attach_args *pa) { struct ebus_dev rom; struct musycc_attach_args ma; - struct ebus_softc *esc = (struct ebus_softc *)self; struct musycc_softc *sc; - struct pci_attach_args *pa = aux; pci_chipset_tag_t pc = pa->pa_pc; #if 0 pci_intr_handle_t ih; @@ -190,18 +166,8 @@ musyccbus_softc_attach(struct device *parent, struct device *self, void *aux) } /* ... and link them together */ - esc->ec_hdlc = sc; - sc->mc_ebus = esc; - - if (pci_mapreg_map(pa, MUSYCC_PCI_BAR, - PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0, - &esc->ec_st, &esc->ec_sh, NULL, &iosize, 0)) { - printf(": can't map mem space\n"); - pci_intr_disestablish(pc, sc->mc_ih); - bus_space_unmap(sc->mc_st, sc->mc_sh, sc->mc_iosize); - return; - } - esc->ec_dmat = pa->pa_dmat; + esc->mc_other = sc; + sc->mc_other = esc; #if 0 /* @@ -213,9 +179,9 @@ musyccbus_softc_attach(struct device *parent, struct device *self, void *aux) } intrstr = pci_intr_string(pc, ih); - esc->ec_ih = pci_intr_establish(pc, ih, IPL_NET, ebus_intr, esc, + esc->mc_ih = pci_intr_establish(pc, ih, IPL_NET, ebus_intr, esc, self->dv_xname); - if (esc->ec_ih == NULL) { + if (esc->mc_ih == NULL) { printf(": couldn't establish interrupt"); if (intrstr != NULL) printf(" at %s", intrstr); @@ -227,7 +193,7 @@ musyccbus_softc_attach(struct device *parent, struct device *self, void *aux) printf(": %s\n", intrstr); #endif - if (ebus_attach_device(&rom, esc->ec_hdlc, 0, 0x400) != 0) { + if (ebus_attach_device(&rom, sc, 0, 0x400) != 0) { printf(": failed to map rom @ %05p\n", 0); goto failed; } @@ -247,8 +213,8 @@ musyccbus_softc_attach(struct device *parent, struct device *self, void *aux) /* map and reset leds */ /* (15 * 0x4000) << 2 */ - esc->ec_ledbase = ntohl(baseconf.ledbase); - esc->ec_ledmask = baseconf.ledmask; + esc->mc_ledbase = ntohl(baseconf.ledbase); + esc->mc_ledmask = baseconf.ledmask; ebus_set_led(esc, 0); printf(": card rev %d \n", ntohs(baseconf.rev)); @@ -269,22 +235,22 @@ musyccbus_softc_attach(struct device *parent, struct device *self, void *aux) ma.ma_port = framerconf.port; ma.ma_slot = framerconf.slot; - (void)config_found(&sc->mc_dev, &ma, ebus_print); + (void)config_found(&sc->mc_dev, &ma, musycc_ebus_print); } return; failed: /* Failed! */ pci_intr_disestablish(pc, sc->mc_ih); - if (esc->ec_ih != NULL) - pci_intr_disestablish(pc, esc->ec_ih); + if (esc->mc_ih != NULL) + pci_intr_disestablish(pc, esc->mc_ih); bus_space_unmap(sc->mc_st, sc->mc_sh, sc->mc_iosize); - bus_space_unmap(esc->ec_st, esc->ec_sh, iosize); + bus_space_unmap(esc->mc_st, esc->mc_sh, iosize); return; } int -musyccbus_print(void *aux, const char *pnp) +musycc_ebus_print(void *aux, const char *pnp) { struct musycc_attach_args *ma = aux; diff --git a/sys/dev/pci/musyccvar.h b/sys/dev/pci/musyccvar.h index 869396d8d62..c7e1e49575a 100644 --- a/sys/dev/pci/musyccvar.h +++ b/sys/dev/pci/musyccvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: musyccvar.h,v 1.2 2005/08/13 23:52:49 claudio Exp $ */ +/* $OpenBSD: musyccvar.h,v 1.3 2005/08/14 21:50:49 claudio Exp $ */ /* * Copyright (c) 2004,2005 Internet Business Solutions AG, Zurich, Switzerland @@ -173,24 +173,13 @@ struct musycc_softc { int mc_ngroups; int mc_nports; + struct musycc_softc *mc_other; /* the other EBUS/HDLC dev */ + bus_size_t mc_ledbase; + u_int8_t mc_ledmask; int bus, device; /* location of card */ - struct ebus_softc *mc_ebus; /* corresponding EBUS bridge */ SLIST_ENTRY(musycc_softc) list; /* list of all hdlc ctrls */ }; -/* Softc for the EBUS bridge (function 1) */ -struct ebus_softc { - struct device ec_dev; /* generic device structures */ - void *ec_ih; /* interrupt handler cookie */ - bus_space_tag_t ec_st; /* bus space tag */ - bus_space_handle_t ec_sh; /* bus space handle */ - bus_dma_tag_t ec_dmat; /* bus dma tag */ - struct musycc_softc *ec_hdlc; /* corresponding HDLC - controller */ - bus_size_t ec_ledbase; - u_int8_t ec_ledmask; -}; - int musycc_attach_common(struct musycc_softc *, u_int32_t, u_int32_t); int musycc_init_channel(struct channel_softc *, char); void musycc_stop_channel(struct channel_softc *); @@ -207,7 +196,7 @@ int ebus_attach_device(struct ebus_dev *, struct musycc_softc *, u_int8_t ebus_read(struct ebus_dev *, bus_size_t); void ebus_write(struct ebus_dev *, bus_size_t, u_int8_t); void ebus_read_buf(struct ebus_dev *, bus_size_t, void *, size_t); -void ebus_set_led(struct ebus_softc *, u_int8_t); +void ebus_set_led(struct musycc_softc *, u_int8_t); /* channel API */ struct channel_softc *musycc_channel_create(const char *, u_int8_t); |