diff options
author | 2011-11-15 22:27:52 +0000 | |
---|---|---|
committer | 2011-11-15 22:27:52 +0000 | |
commit | 40e7fd949122c781db87f2643f28345efb8ac16c (patch) | |
tree | 6f7594038f9d41576f55dfcb7a164881ee5c8c6f /sys/dev | |
parent | delay(1) is an extremely short delay, increase this to a measurable amount (diff) | |
download | wireguard-openbsd-40e7fd949122c781db87f2643f28345efb8ac16c.tar.xz wireguard-openbsd-40e7fd949122c781db87f2643f28345efb8ac16c.zip |
Simplify various parts of the puc(4) attachment code. Tested lightly
by krw and myself.
Diffstat (limited to 'sys/dev')
-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 |
7 files changed, 15 insertions, 98 deletions
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); } |