puc.c (102895) | puc.c (102929) |
---|---|
1/* $NetBSD: puc.c,v 1.7 2000/07/29 17:43:38 jlam Exp $ */ 2 3/*- 4 * Copyright (c) 2002 JF Hay. All rights reserved. 5 * Copyright (c) 2000 M. Warner Losh. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 44 unchanged lines hidden (view full) --- 53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 */ 59 60#include <sys/cdefs.h> | 1/* $NetBSD: puc.c,v 1.7 2000/07/29 17:43:38 jlam Exp $ */ 2 3/*- 4 * Copyright (c) 2002 JF Hay. All rights reserved. 5 * Copyright (c) 2000 M. Warner Losh. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 44 unchanged lines hidden (view full) --- 53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 */ 59 60#include <sys/cdefs.h> |
61__FBSDID("$FreeBSD: head/sys/dev/puc/puc.c 102895 2002-09-03 11:22:13Z phk $"); | 61__FBSDID("$FreeBSD: head/sys/dev/puc/puc.c 102929 2002-09-04 15:29:04Z phk $"); |
62 63/* 64 * PCI "universal" communication card device driver, glues com, lpt, 65 * and similar ports to PCI via bridge chip often much larger than 66 * the devices being glued. 67 * 68 * Author: Christopher G. Demetriou, May 14, 1998 (derived from NetBSD 69 * sys/dev/pci/pciide.c, revision 1.6). --- 84 unchanged lines hidden (view full) --- 154 rid = 0; 155 res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, 156 RF_ACTIVE | RF_SHAREABLE); 157 if (!res) 158 return (ENXIO); 159 160 sc->irqres = res; 161 sc->irqrid = rid; | 62 63/* 64 * PCI "universal" communication card device driver, glues com, lpt, 65 * and similar ports to PCI via bridge chip often much larger than 66 * the devices being glued. 67 * 68 * Author: Christopher G. Demetriou, May 14, 1998 (derived from NetBSD 69 * sys/dev/pci/pciide.c, revision 1.6). --- 84 unchanged lines hidden (view full) --- 154 rid = 0; 155 res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, 156 RF_ACTIVE | RF_SHAREABLE); 157 if (!res) 158 return (ENXIO); 159 160 sc->irqres = res; 161 sc->irqrid = rid; |
162#ifdef PUC_FASTINTR |
|
162 irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, | 163 irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, |
164 INTR_TYPE_TTY | INTR_FAST, puc_intr, sc, &sc->intr_cookie); 165 if (irq_setup == 0) 166 sc->fastintr = 1; 167 else 168 irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, 169 INTR_TYPE_TTY, puc_intr, sc, &sc->intr_cookie); 170#else 171 irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, |
|
163 INTR_TYPE_TTY, puc_intr, sc, &sc->intr_cookie); | 172 INTR_TYPE_TTY, puc_intr, sc, &sc->intr_cookie); |
173#endif |
|
164 if (irq_setup != 0) 165 return (ENXIO); 166 167 rid = 0; 168 for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { 169 if (i > 0 && rid == sc->sc_desc->ports[i].bar) 170 sc->barmuxed = 1; 171 rid = sc->sc_desc->ports[i].bar; --- 273 unchanged lines hidden (view full) --- 445 446int 447puc_setup_intr(device_t dev, device_t child, struct resource *r, int flags, 448 void (*ihand)(void *), void *arg, void **cookiep) 449{ 450 int i; 451 struct puc_softc *sc; 452 | 174 if (irq_setup != 0) 175 return (ENXIO); 176 177 rid = 0; 178 for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { 179 if (i > 0 && rid == sc->sc_desc->ports[i].bar) 180 sc->barmuxed = 1; 181 rid = sc->sc_desc->ports[i].bar; --- 273 unchanged lines hidden (view full) --- 455 456int 457puc_setup_intr(device_t dev, device_t child, struct resource *r, int flags, 458 void (*ihand)(void *), void *arg, void **cookiep) 459{ 460 int i; 461 struct puc_softc *sc; 462 |
453 if (flags & INTR_FAST) 454 return (ENXIO); | |
455 sc = (struct puc_softc *)device_get_softc(dev); | 463 sc = (struct puc_softc *)device_get_softc(dev); |
464 if ((flags & INTR_FAST) && !sc->fastintr) 465 return (ENXIO); |
|
456 for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { 457 if (sc->sc_ports[i].dev == child) { 458 if (sc->sc_ports[i].ihand != 0) 459 return (ENXIO); 460 sc->sc_ports[i].ihand = ihand; 461 sc->sc_ports[i].ihandarg = arg; 462 *cookiep = arg; 463 return (0); --- 41 unchanged lines hidden --- | 466 for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { 467 if (sc->sc_ports[i].dev == child) { 468 if (sc->sc_ports[i].ihand != 0) 469 return (ENXIO); 470 sc->sc_ports[i].ihand = ihand; 471 sc->sc_ports[i].ihandarg = arg; 472 *cookiep = arg; 473 return (0); --- 41 unchanged lines hidden --- |