puc.c (102894) | puc.c (102895) |
---|---|
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 102894 2002-09-03 11:19:44Z phk $"); | 61__FBSDID("$FreeBSD: head/sys/dev/puc/puc.c 102895 2002-09-03 11:22:13Z 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 | |
163 irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, | 162 irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, |
164 INTR_TYPE_TTY | INTR_FAST, puc_intr, sc, &sc->intr_cookie); 165#else 166 irq_setup = ENXIO; 167#endif | 163 INTR_TYPE_TTY, puc_intr, sc, &sc->intr_cookie); |
168 if (irq_setup != 0) | 164 if (irq_setup != 0) |
169 irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, 170 INTR_TYPE_TTY, puc_intr, sc, &sc->intr_cookie); 171 if (irq_setup != 0) | |
172 return (ENXIO); 173 174 rid = 0; 175 for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { 176 if (i > 0 && rid == sc->sc_desc->ports[i].bar) 177 sc->barmuxed = 1; 178 rid = sc->sc_desc->ports[i].bar; 179 bidx = puc_port_bar_index(sc, rid); --- 272 unchanged lines hidden (view full) --- 452 453int 454puc_setup_intr(device_t dev, device_t child, struct resource *r, int flags, 455 void (*ihand)(void *), void *arg, void **cookiep) 456{ 457 int i; 458 struct puc_softc *sc; 459 | 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; 172 bidx = puc_port_bar_index(sc, rid); --- 272 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 |
460printf("puc_setup_intr()\n"); | 453 if (flags & INTR_FAST) 454 return (ENXIO); |
461 sc = (struct puc_softc *)device_get_softc(dev); 462 for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { 463 if (sc->sc_ports[i].dev == child) { 464 if (sc->sc_ports[i].ihand != 0) 465 return (ENXIO); 466 sc->sc_ports[i].ihand = ihand; 467 sc->sc_ports[i].ihandarg = arg; 468 *cookiep = arg; --- 5 unchanged lines hidden (view full) --- 474 475int 476puc_teardown_intr(device_t dev, device_t child, struct resource *r, 477 void *cookie) 478{ 479 int i; 480 struct puc_softc *sc; 481 | 455 sc = (struct puc_softc *)device_get_softc(dev); 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; --- 5 unchanged lines hidden (view full) --- 468 469int 470puc_teardown_intr(device_t dev, device_t child, struct resource *r, 471 void *cookie) 472{ 473 int i; 474 struct puc_softc *sc; 475 |
482printf("puc_teardown_intr()\n"); | |
483 sc = (struct puc_softc *)device_get_softc(dev); 484 for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { 485 if (sc->sc_ports[i].dev == child) { 486 sc->sc_ports[i].ihand = NULL; 487 sc->sc_ports[i].ihandarg = NULL; 488 return (0); 489 } 490 } --- 21 unchanged lines hidden --- | 476 sc = (struct puc_softc *)device_get_softc(dev); 477 for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { 478 if (sc->sc_ports[i].dev == child) { 479 sc->sc_ports[i].ihand = NULL; 480 sc->sc_ports[i].ihandarg = NULL; 481 return (0); 482 } 483 } --- 21 unchanged lines hidden --- |