diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-11-15 22:27:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-11-15 22:27:54 +0000 |
commit | 7d501144194e45646a9b40ab87d4313a80408531 (patch) | |
tree | bdc9232e49f14d4782df07f168350888857055ec | |
parent | 6c1d993ab3048631209562f45bbd8cbb45b1196e (diff) |
Simplify various parts of the puc(4) attachment code. Tested lightly
by krw and myself.
-rw-r--r-- | sys/arch/alpha/conf/files.alpha | 4 | ||||
-rw-r--r-- | sys/arch/amd64/conf/files.amd64 | 4 | ||||
-rw-r--r-- | sys/arch/armish/conf/files.armish | 3 | ||||
-rw-r--r-- | sys/arch/i386/conf/files.i386 | 9 | ||||
-rw-r--r-- | sys/arch/macppc/conf/files.macppc | 4 | ||||
-rw-r--r-- | sys/arch/sgi/conf/files.sgi | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/conf/files.sparc64 | 4 | ||||
-rw-r--r-- | sys/dev/cardbus/puc_cardbus.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/files.pci | 12 | ||||
-rw-r--r-- | sys/dev/pci/puc.c | 67 | ||||
-rw-r--r-- | sys/dev/pci/pucvar.h | 4 | ||||
-rw-r--r-- | sys/dev/puc/com_puc.c | 8 | ||||
-rw-r--r-- | sys/dev/puc/files.puc | 9 | ||||
-rw-r--r-- | sys/dev/puc/lpt_puc.c | 9 |
14 files changed, 22 insertions, 123 deletions
diff --git a/sys/arch/alpha/conf/files.alpha b/sys/arch/alpha/conf/files.alpha index 73c31a39268..7c416d1157e 100644 --- a/sys/arch/alpha/conf/files.alpha +++ b/sys/arch/alpha/conf/files.alpha @@ -1,4 +1,4 @@ -# $OpenBSD: files.alpha,v 1.92 2011/10/06 20:49:28 deraadt Exp $ +# $OpenBSD: files.alpha,v 1.93 2011/11/15 22:27:52 deraadt Exp $ # $NetBSD: files.alpha,v 1.32 1996/11/25 04:03:21 cgd Exp $ # # alpha-specific configuration info @@ -133,8 +133,6 @@ include "dev/pci/files.pci" # XXX some ISA devs are 'at pci' too. include "dev/isa/files.isa" major {wd = 0} -include "dev/puc/files.puc" - # # ISA Bus devices # diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64 index a021096237d..f7ec52acd39 100644 --- a/sys/arch/amd64/conf/files.amd64 +++ b/sys/arch/amd64/conf/files.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.amd64,v 1.65 2011/11/14 15:06:16 deraadt Exp $ +# $OpenBSD: files.amd64,v 1.66 2011/11/15 22:27:52 deraadt Exp $ maxpartitions 16 maxusers 2 16 128 @@ -114,8 +114,6 @@ file arch/amd64/pci/pci_machdep.c pci file arch/amd64/pci/pciide_machdep.c pciide file arch/amd64/pci/vga_post.c vga_pci & x86emu -include "dev/puc/files.puc" - # PCI Host bridge chipsets device pchb: pcibus, agpbus attach pchb at pci diff --git a/sys/arch/armish/conf/files.armish b/sys/arch/armish/conf/files.armish index 5ed6b8d971e..4dd04f795a9 100644 --- a/sys/arch/armish/conf/files.armish +++ b/sys/arch/armish/conf/files.armish @@ -1,4 +1,4 @@ -# $OpenBSD: files.armish,v 1.14 2010/12/06 20:10:17 jasper Exp $ +# $OpenBSD: files.armish,v 1.15 2011/11/15 22:27:52 deraadt Exp $ maxpartitions 16 maxusers 2 8 64 @@ -70,7 +70,6 @@ include "dev/mii/files.mii" include "dev/pci/files.pci" file arch/armish/dev/pciide_machdep.c pciide -include "dev/puc/files.puc" include "dev/atapiscsi/files.atapiscsi" diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index 516fbee3f20..01e2ae4b025 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: files.i386,v 1.208 2011/10/06 20:49:28 deraadt Exp $ +# $OpenBSD: files.i386,v 1.209 2011/11/15 22:27:52 deraadt Exp $ # # new style config file for i386 architecture # @@ -367,13 +367,6 @@ attach tcic at isa with tcic_isa file dev/isa/tcic2_isa.c tcic_isa # -# Machine-independent PUC drivers -# -include "dev/puc/files.puc" - -# PCMCIA wants to be probed as late as possible. - -# # Machine-independent PCMCIA drivers # include "dev/pcmcia/files.pcmcia" diff --git a/sys/arch/macppc/conf/files.macppc b/sys/arch/macppc/conf/files.macppc index f2b7ba88d56..60b69d7fc6b 100644 --- a/sys/arch/macppc/conf/files.macppc +++ b/sys/arch/macppc/conf/files.macppc @@ -1,4 +1,4 @@ -# $OpenBSD: files.macppc,v 1.64 2011/05/25 07:42:15 mpi Exp $ +# $OpenBSD: files.macppc,v 1.65 2011/11/15 22:27:53 deraadt Exp $ # # macppc-specific configuration info @@ -66,8 +66,6 @@ include "dev/i2o/files.i2o" include "dev/pci/files.pci" file arch/macppc/pci/pciide_machdep.c pciide -include "dev/puc/files.puc" - device mpcpcibr {} : pcibus attach mpcpcibr at mainbus file arch/macppc/pci/mpcpcibus.c mpcpcibr diff --git a/sys/arch/sgi/conf/files.sgi b/sys/arch/sgi/conf/files.sgi index a11b5cff8cc..83953010ed9 100644 --- a/sys/arch/sgi/conf/files.sgi +++ b/sys/arch/sgi/conf/files.sgi @@ -1,4 +1,4 @@ -# $OpenBSD: files.sgi,v 1.45 2010/03/22 21:22:08 miod Exp $ +# $OpenBSD: files.sgi,v 1.46 2011/11/15 22:27:53 deraadt Exp $ # # maxpartitions must be first item in files.${ARCH} # @@ -93,8 +93,6 @@ include "dev/i2o/files.i2o" include "dev/pci/files.pci" file arch/sgi/pci/pci_machdep.c pci -include "dev/puc/files.puc" - # Sun HME Ethernet controllers device hme: ether, ifnet, mii, ifmedia file dev/ic/hme.c hme diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64 index 76a1b8eeab2..3928f162592 100644 --- a/sys/arch/sparc64/conf/files.sparc64 +++ b/sys/arch/sparc64/conf/files.sparc64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.sparc64,v 1.134 2011/07/06 05:48:57 kettenis Exp $ +# $OpenBSD: files.sparc64,v 1.135 2011/11/15 22:27:53 deraadt Exp $ # $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $ # maxpartitions must be first item in files.${ARCH} @@ -109,8 +109,6 @@ file arch/sparc64/dev/gfb.c gfb include "dev/pci/files.pci" major {wd = 12} -include "dev/puc/files.puc" - device psycho: pcibus, iommu attach psycho at mainbus file arch/sparc64/dev/psycho.c psycho diff --git a/sys/dev/cardbus/puc_cardbus.c b/sys/dev/cardbus/puc_cardbus.c index f0dc17dc338..c900ae7ee8f 100644 --- a/sys/dev/cardbus/puc_cardbus.c +++ b/sys/dev/cardbus/puc_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: puc_cardbus.c,v 1.7 2010/03/27 23:36:36 jsg Exp $ */ +/* $OpenBSD: puc_cardbus.c,v 1.8 2011/11/15 22:27:53 deraadt Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -136,9 +136,9 @@ puc_cardbus_attach(struct device *parent, struct device *self, void *aux) (*cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE); paa.puc = sc; - paa.hwtype = COM_UART_OX16C950; /* XXX */ paa.intr_string = &puc_cardbus_intr_string; paa.intr_establish = &puc_cardbus_intr_establish; + puc_common_attach(sc, &paa); } diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index ad258f51deb..016858ae923 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.280 2011/11/14 00:25:17 mlarkin Exp $ +# $OpenBSD: files.pci,v 1.281 2011/11/15 22:27:53 deraadt 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. @@ -528,13 +528,17 @@ device msk: ether, ifnet, mii, ifmedia attach msk at mskc file dev/pci/if_msk.c mskc | msk -# PCI "universal" communication device driver, for PCI com, lpt, etc. ports -# (see documentation in the driver for what, exactly, should be supported) +# PCI "universal" communication for PCI com, lpt device puc {[port = -1]} -attach puc at pci with puc_pci file dev/pci/puc.c puc file dev/pci/pucdata.c puc +attach com at puc with com_puc +file dev/puc/com_puc.c com_puc +attach lpt at puc with lpt_puc +file dev/puc/lpt_puc.c lpt_puc +attach puc at pci with puc_pci + # WaveLAN/PrismII card behind a PLX 805x dumb bridge # device declaration in sys/conf/files attach wi at pci with wi_pci diff --git a/sys/dev/pci/puc.c b/sys/dev/pci/puc.c index 5f581d96e39..af33f219cdd 100644 --- a/sys/dev/pci/puc.c +++ b/sys/dev/pci/puc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: puc.c,v 1.19 2011/10/25 20:02:21 deraadt Exp $ */ +/* $OpenBSD: puc.c,v 1.20 2011/11/15 22:27:53 deraadt Exp $ */ /* $NetBSD: puc.c,v 1.3 1999/02/06 06:29:54 cgd Exp $ */ /* @@ -104,14 +104,6 @@ puc_pci_match(struct device *parent, void *match, void *aux) desc = puc_find_description(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id), PCI_VENDOR(subsys), PCI_PRODUCT(subsys)); if (desc != NULL) - return (10); - - /* - * Match class/subclass, so we can tell people to compile kernel - * with options that cause this driver to spew. - */ - if (PCI_CLASS(pa->pa_class) == PCI_CLASS_COMMUNICATIONS && - PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_PCI) return (1); return (0); @@ -151,41 +143,9 @@ puc_pci_attach(struct device *parent, struct device *self, void *aux) subsys = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG); sc->sc_desc = puc_find_description(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id), PCI_VENDOR(subsys), PCI_PRODUCT(subsys)); - if (sc->sc_desc == NULL) { - /* - * This was a class/subclass match, so tell people to compile - * kernel with options that cause this driver to spew. - */ -#ifdef PUC_PRINT_REGS - printf(":\n"); - pci_conf_print(pa->pa_pc, pa->pa_tag, NULL); -#else - printf(": unknown PCI communications device\n"); - printf("%s: compile kernel with PUC_PRINT_REGS and larger\n", - sc->sc_dev.dv_xname); - printf("%s: message buffer (via 'options MSGBUFSIZE=...'),\n", - sc->sc_dev.dv_xname); - printf("%s: and report the result with sendbug(1)\n", - sc->sc_dev.dv_xname); -#endif - return; - } puc_print_ports(sc->sc_desc); - /* - * XXX This driver assumes that 'com' ports attached to it - * XXX can not be console. That isn't unreasonable, because PCI - * XXX devices are supposed to be dynamically mapped, and com - * XXX console ports want fixed addresses. When/if baseboard - * XXX 'com' ports are identified as PCI/communications/serial - * XXX devices and are known to be mapped at the standard - * XXX addresses, if they can be the system console then we have - * XXX to cope with doing the mapping right. Then this will get - * XXX really ugly. Of course, by then we might know the real - * XXX definition of PCI/communications/serial, and attach 'com' - * XXX directly on PCI. - */ for (i = 0; i < PUC_NBARS; i++) { pcireg_t type; int bar; @@ -214,18 +174,9 @@ puc_pci_attach(struct device *parent, struct device *self, void *aux) } paa.puc = sc; - paa.hwtype = 0; /* autodetect */ paa.intr_string = &puc_pci_intr_string; paa.intr_establish = &puc_pci_intr_establish; - /* - * If this is a serial card with a known specific chip, provide - * the UART type. - */ - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_PLX && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_PLX_CRONYX_OMEGA) - paa.hwtype = 0x08; /* XXX COM_UART_ST16C654 */ - puc_common_attach(sc, &paa); } @@ -234,22 +185,6 @@ puc_common_attach(struct puc_softc *sc, struct puc_attach_args *paa) { int i, bar; - /* - * XXX the sub-devices establish the interrupts, for the - * XXX following reasons: - * XXX - * XXX * we can't really know what IPLs they'd want - * XXX - * XXX * the MD dispatching code can ("should") dispatch - * XXX chained interrupts better than we can. - * XXX - * XXX It would be nice if we could indicate to the MD interrupt - * XXX handling code that the interrupt line used by the device - * XXX was a PCI (level triggered) interrupt. - * XXX - * XXX It's not pretty, but hey, what is? - */ - /* Configure each port. */ for (i = 0; i < PUC_MAX_PORTS; i++) { if (sc->sc_desc->ports[i].type == 0) /* neither com or lpt */ diff --git a/sys/dev/pci/pucvar.h b/sys/dev/pci/pucvar.h index e15a72ba01c..2b1745806e2 100644 --- a/sys/dev/pci/pucvar.h +++ b/sys/dev/pci/pucvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pucvar.h,v 1.12 2011/10/25 20:02:21 deraadt Exp $ */ +/* $OpenBSD: pucvar.h,v 1.13 2011/11/15 22:27:53 deraadt Exp $ */ /* $NetBSD: pucvar.h,v 1.2 1999/02/06 06:29:54 cgd Exp $ */ /* @@ -70,7 +70,6 @@ struct puc_device_description { struct puc_attach_args { int port; int type; - int hwtype; void *puc; bus_addr_t a; @@ -80,7 +79,6 @@ struct puc_attach_args { const char *(*intr_string)(struct puc_attach_args *); void *(*intr_establish)(struct puc_attach_args *, int, int (*)(void *), void *, char *); - void (*intr_disestablish)(struct puc_attach_args *, void *); }; extern const struct puc_device_description puc_devs[]; diff --git a/sys/dev/puc/com_puc.c b/sys/dev/puc/com_puc.c index ca5dcde6801..d0bba48fbf1 100644 --- a/sys/dev/puc/com_puc.c +++ b/sys/dev/puc/com_puc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_puc.c,v 1.19 2011/10/25 20:02:20 deraadt Exp $ */ +/* $OpenBSD: com_puc.c,v 1.20 2011/11/15 22:27:53 deraadt Exp $ */ /* * Copyright (c) 1997 - 1999, Jason Downs. All rights reserved. @@ -107,12 +107,6 @@ com_puc_attach(parent, self, aux) else sc->sc_frequency = COM_FREQ * (1 << PUC_COM_GET_POW2(pa->type)); - if (pa->hwtype) - sc->sc_uarttype = pa->hwtype; - - sc->sc_hwflags = 0; - sc->sc_swflags = 0; - com_attach_subr(sc); } diff --git a/sys/dev/puc/files.puc b/sys/dev/puc/files.puc index 093c34df6c3..e69de29bb2d 100644 --- a/sys/dev/puc/files.puc +++ b/sys/dev/puc/files.puc @@ -1,9 +0,0 @@ -# $OpenBSD: files.puc,v 1.3 2008/05/21 18:49:47 kettenis Exp $ -# -# Config file and device description for machine-independent PUC drivers. -# Requires PCI to be defined first. - -attach com at puc with com_puc -file dev/puc/com_puc.c com_puc -attach lpt at puc with lpt_puc -file dev/puc/lpt_puc.c lpt_puc diff --git a/sys/dev/puc/lpt_puc.c b/sys/dev/puc/lpt_puc.c index c84f2cd4cb0..f59e8ae944b 100644 --- a/sys/dev/puc/lpt_puc.c +++ b/sys/dev/puc/lpt_puc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpt_puc.c,v 1.6 2011/10/25 20:02:20 deraadt Exp $ */ +/* $OpenBSD: lpt_puc.c,v 1.7 2011/11/15 22:27:53 deraadt Exp $ */ /* $NetBSD: lpt_puc.c,v 1.1 1998/06/26 18:52:41 cgd Exp $ */ /* @@ -54,7 +54,7 @@ void lpt_puc_attach(struct device *, struct device *, void *); int lpt_puc_detach(struct device *, int); struct cfattach lpt_puc_ca = { - sizeof(struct lpt_softc), lpt_puc_probe, lpt_puc_attach, lpt_puc_detach + sizeof(struct lpt_softc), lpt_puc_probe, lpt_puc_attach, lpt_puc_detach, }; int @@ -97,16 +97,11 @@ lpt_puc_attach(parent, self, aux) } printf(" %s", intrstr); - sc->sc_state = 0; - lpt_attach_common(sc); } int lpt_puc_detach(struct device *self, int flags) { - - /* cardbus_intr_disestablish(psc->sc_cc, psc->sc_cf, csc->cc_ih); */ - return (0); } |