The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/eisa/if_fea.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: if_fea.c,v 1.33 2006/11/16 01:32:50 christos Exp $     */
    2 
    3 /*-
    4  * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
    5  * 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
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. The name of the author may not be used to endorse or promote products
   13  *    derived from this software without specific prior written permission
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * Id: if_fea.c,v 1.8 1997/03/21 13:45:45 thomas Exp
   27  */
   28 
   29 /*
   30  * DEC PDQ FDDI Controller
   31  *
   32  *      This module support the DEFEA EISA FDDI Controller.
   33  */
   34 
   35 #include <sys/cdefs.h>
   36 __KERNEL_RCSID(0, "$NetBSD: if_fea.c,v 1.33 2006/11/16 01:32:50 christos Exp $");
   37 
   38 #include "opt_inet.h"
   39 
   40 #include <sys/param.h>
   41 #include <sys/kernel.h>
   42 #include <sys/mbuf.h>
   43 #include <sys/protosw.h>
   44 #include <sys/socket.h>
   45 #include <sys/ioctl.h>
   46 #include <sys/errno.h>
   47 #include <sys/malloc.h>
   48 #if defined(__FreeBSD__)
   49 #include <sys/devconf.h>
   50 #elif defined(__bsdi__) || defined(__NetBSD__)
   51 #include <sys/device.h>
   52 #endif
   53 
   54 #include <net/if.h>
   55 #include <net/if_types.h>
   56 #include <net/if_dl.h>
   57 
   58 #include "bpfilter.h"
   59 #if NBPFILTER > 0
   60 #include <net/bpf.h>
   61 #include <net/bpfdesc.h>
   62 #endif
   63 
   64 #ifdef INET
   65 #include <netinet/in.h>
   66 #include <netinet/in_systm.h>
   67 #include <netinet/in_var.h>
   68 #include <netinet/ip.h>
   69 #endif
   70 
   71 #if defined(__FreeBSD__)
   72 #include <netinet/if_fddi.h>
   73 #else
   74 #include <net/if_fddi.h>
   75 #endif
   76 
   77 #if defined(__FreeBSD__)
   78 #include <netinet/if_ether.h>
   79 #include <i386/eisa/eisaconf.h>
   80 #include <i386/isa/icu.h>
   81 #include <dev/pdq/pdqvar.h>
   82 #include <dev/pdq/pdqreg.h>
   83 #elif defined(__bsdi__)
   84 #include <netinet/if_ether.h>
   85 #include <i386/isa/isa.h>
   86 #include <i386/isa/icu.h>
   87 #include <i386/isa/dma.h>
   88 #include <i386/isa/isavar.h>
   89 #include <i386/eisa/eisa.h>
   90 #include <dev/pdq/pdqvar.h>
   91 #include <dev/pdq/pdqreg.h>
   92 #elif defined(__NetBSD__)
   93 #include <machine/cpu.h>
   94 #include <machine/bus.h>
   95 
   96 #include <dev/ic/pdqvar.h>
   97 #include <dev/ic/pdqreg.h>
   98 
   99 #include <dev/eisa/eisareg.h>
  100 #include <dev/eisa/eisavar.h>
  101 #include <dev/eisa/eisadevs.h>
  102 #endif
  103 
  104 /*
  105  *
  106  */
  107 
  108 #define DEFEA_IRQS              0x0000FBA9U
  109 
  110 #if defined(__FreeBSD__)
  111 static pdq_softc_t *pdqs_eisa[16];
  112 #define PDQ_EISA_UNIT_TO_SOFTC(unit)    (pdqs_eisa[unit])
  113 #define DEFEA_INTRENABLE                0x8     /* level interrupt */
  114 #define pdq_eisa_ifwatchdog             NULL
  115 #define DEFEA_DECODE_IRQ(n)             ((DEFEA_IRQS >> ((n) << 2)) & 0x0f)
  116 
  117 #elif defined(__bsdi__)
  118 extern struct cfdriver feacd;
  119 #define PDQ_EISA_UNIT_TO_SOFTC(unit)    ((pdq_softc_t *)feacd.cd_devs[unit])
  120 #define DEFEA_INTRENABLE                0x28    /* edge interrupt */
  121 static const int pdq_eisa_irqs[4] = { IRQ9, IRQ10, IRQ11, IRQ15 };
  122 #define DEFEA_DECODE_IRQ(n)             (pdq_eisa_irqs[(n)])
  123 
  124 #elif defined(__NetBSD__)
  125 #define DEFEA_INTRENABLE                0x8     /* level interrupt */
  126 #define pdq_eisa_ifwatchdog             NULL
  127 #define DEFEA_DECODE_IRQ(n)             ((DEFEA_IRQS >> ((n) << 2)) & 0x0f)
  128 
  129 #else
  130 #error unknown system
  131 #endif
  132 
  133 #ifndef pdq_eisa_ifwatchdog
  134 static ifnet_ret_t
  135 pdq_eisa_ifwatchdog(
  136     int unit)
  137 {
  138     pdq_ifwatchdog(&PDQ_EISA_UNIT_TO_SOFTC(unit)->sc_if);
  139 }
  140 #endif
  141 
  142 static void
  143 pdq_eisa_subprobe(
  144     pdq_bus_t bc,
  145     pdq_bus_ioport_t iobase,
  146     pdq_uint32_t *maddr,
  147     pdq_uint32_t *msiz,
  148     pdq_uint32_t *irq)
  149 {
  150     if (irq != NULL)
  151         *irq = DEFEA_DECODE_IRQ(PDQ_OS_IORD_8(bc, iobase, PDQ_EISA_IO_CONFIG_STAT_0) & 3);
  152     *maddr = (PDQ_OS_IORD_8(bc, iobase, PDQ_EISA_MEM_ADD_CMP_0) << 8)
  153         | (PDQ_OS_IORD_8(bc, iobase, PDQ_EISA_MEM_ADD_CMP_1) << 16);
  154     *msiz = (PDQ_OS_IORD_8(bc, iobase, PDQ_EISA_MEM_ADD_MASK_0) + 4) << 8;
  155 }
  156 
  157 static void
  158 pdq_eisa_devinit(
  159     pdq_softc_t *sc)
  160 {
  161     pdq_uint8_t data;
  162 
  163     /*
  164      * Do the standard initialization for the DEFEA registers.
  165      */
  166     PDQ_OS_IOWR_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_FUNCTION_CTRL, 0x23);
  167     PDQ_OS_IOWR_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_IO_CMP_1_1, (sc->sc_iobase >> 8) & 0xF0);
  168     PDQ_OS_IOWR_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_IO_CMP_0_1, (sc->sc_iobase >> 8) & 0xF0);
  169     PDQ_OS_IOWR_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_SLOT_CTRL, 0x01);
  170     data = PDQ_OS_IORD_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_BURST_HOLDOFF);
  171 #if defined(__NetBSD__)
  172     PDQ_OS_IOWR_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_BURST_HOLDOFF,
  173                   sc->sc_iotag == sc->sc_csrtag ? data & ~1 : data | 1);
  174 #elif defined(PDQ_IOMAPPED)
  175     PDQ_OS_IOWR_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_BURST_HOLDOFF, data & ~1);
  176 #else
  177     PDQ_OS_IOWR_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_BURST_HOLDOFF, data | 1);
  178 #endif
  179     data = PDQ_OS_IORD_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_IO_CONFIG_STAT_0);
  180     PDQ_OS_IOWR_8(sc->sc_iotag, sc->sc_iobase, PDQ_EISA_IO_CONFIG_STAT_0, data | DEFEA_INTRENABLE);
  181 }
  182 
  183 #if defined(__FreeBSD__)
  184 static int pdq_eisa_shutdown(struct kern_devconf *kdc, int force);
  185 static int pdq_eisa_probe(void);
  186 static int pdq_eisa_attach(struct eisa_device *ed);
  187 
  188 static unsigned long pdq_eisa_unit;
  189 
  190 static struct eisa_driver pdq_eisa_driver = {
  191     "fea", pdq_eisa_probe, pdq_eisa_attach, NULL, &pdq_eisa_unit
  192 };
  193 
  194 DATA_SET(eisadriver_set, pdq_eisa_driver);
  195 
  196 static struct kern_devconf kdc_pdq_eisa = {
  197     0, 0, 0,                    /* filled in by dev_attach */
  198     "fea", 0, { MDDT_EISA, 0, "net" },
  199     eisa_generic_externalize, 0, pdq_eisa_shutdown, EISA_EXTERNALLEN,
  200     &kdc_eisa0,                 /* parent */
  201     0,                          /* parentdata */
  202     DC_BUSY,                    /* host adapters are always ``in use'' */
  203     "DEC DEFEA EISA FDDI Controller",
  204     DC_CLS_NETIF
  205 };
  206 
  207 static const char *
  208 pdq_eisa_match(
  209     eisa_id_t type)
  210 {
  211     if ((type >> 8) == 0x10a330)
  212         return kdc_pdq_eisa.kdc_description;
  213     return NULL;
  214 }
  215 
  216 static int
  217 pdq_eisa_probe(
  218     void)
  219 {
  220     struct eisa_device *ed = NULL;
  221     int count;
  222 
  223     for (count = 0; (ed = eisa_match_dev(ed, pdq_eisa_match)) != NULL; count++) {
  224         pdq_bus_ioport_t iobase = ed->ioconf.slot * EISA_SLOT_SIZE;
  225         pdq_uint32_t irq, maddr, msiz;
  226 
  227         eisa_add_iospace(ed, iobase, 0x200, RESVADDR_NONE);
  228         pdq_eisa_subprobe(PDQ_BUS_EISA, iobase, &maddr, &msiz, &irq);
  229         eisa_add_mspace(ed, maddr, msiz, RESVADDR_NONE);
  230         eisa_add_intr(ed, irq);
  231         eisa_registerdev(ed, &pdq_eisa_driver, &kdc_pdq_eisa);
  232     }
  233     return count;
  234 }
  235 
  236 static void
  237 pdq_eisa_interrupt(
  238     void *arg)
  239 {
  240     pdq_softc_t * const sc = (pdq_softc_t *) arg;
  241     (void) pdq_interrupt(sc->sc_pdq);
  242 }
  243 
  244 static int
  245 pdq_eisa_attach(
  246     struct eisa_device *ed)
  247 {
  248     pdq_softc_t *sc;
  249     resvaddr_t *iospace;
  250     resvaddr_t *mspace;
  251     int irq = ffs(ed->ioconf.irq) - 1;
  252 
  253     sc = (pdq_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
  254     if (sc == NULL) {
  255         printf("fea%d: malloc failed!\n", sc->sc_if.if_unit);
  256         return -1;
  257     }
  258     pdqs_eisa[ed->unit] = sc;
  259 
  260     sc->sc_if.if_name = "fea";
  261     sc->sc_if.if_unit = ed->unit;
  262 
  263     if ((iospace = ed->ioconf.ioaddrs.lh_first) == NULL) {
  264         printf("fea%d: no iospace??\n", sc->sc_if.if_unit);
  265         return -1;
  266     }
  267     if ((mspace = ed->ioconf.maddrs.lh_first) == NULL) {
  268         printf("fea%d: no memory space??\n", sc->sc_if.if_unit);
  269         return -1;
  270     }
  271 
  272     sc->sc_iobase = (pdq_bus_ioport_t) iospace->addr;
  273     sc->sc_membase = (pdq_bus_memaddr_t) pmap_mapdev(mspace->addr, mspace->size);
  274     if (sc->sc_membase == NULL) {
  275         printf("fea%d: failed to map memory 0x%x-0x%x!\n",
  276                sc->sc_if.if_unit, mspace->addr, mspace->addr + mspace->size - 1);
  277         return -1;
  278     }
  279 
  280     eisa_reg_start(ed);
  281     if (eisa_reg_iospace(ed, iospace)) {
  282         printf("fea%d: failed to register iospace 0x%x-0x%x!\n",
  283                sc->sc_if.if_unit, iospace->addr, iospace->addr + iospace->size - 1);
  284         return -1;
  285     }
  286     if (eisa_reg_mspace(ed, mspace)) {
  287         printf("fea%d: failed to register memory 0x%x-0x%x!\n",
  288                sc->sc_if.if_unit, mspace->addr, mspace->addr + mspace->size - 1);
  289         return -1;
  290     }
  291 
  292     if (eisa_reg_intr(ed, irq, pdq_eisa_interrupt, sc, &net_imask, 1)) {
  293         printf("fea%d: interrupt registration failed\n", sc->sc_if.if_unit);
  294         return -1;
  295     }
  296 
  297     eisa_reg_end(ed);
  298 
  299     pdq_eisa_devinit(sc);
  300     sc->sc_pdq = pdq_initialize(PDQ_BUS_EISA, sc->sc_membase,
  301                                 sc->sc_if.if_name, sc->sc_if.if_unit,
  302                                 (void *) sc, PDQ_DEFEA);
  303     if (sc->sc_pdq == NULL) {
  304         printf("fea%d: initialization failed\n", sc->sc_if.if_unit);
  305         return -1;
  306     }
  307 
  308     if (eisa_enable_intr(ed, irq)) {
  309         printf("fea%d: failed to enable interrupt\n", sc->sc_if.if_unit);
  310         return -1;
  311     }
  312 
  313     bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6);
  314     pdq_ifattach(sc, pdq_eisa_ifwatchdog);
  315 
  316     ed->kdc->kdc_state = DC_BUSY;        /* host adapters always busy */
  317 
  318     return 0;
  319 }
  320 
  321 static int
  322 pdq_eisa_shutdown(
  323     struct kern_devconf *kdc,
  324     int force)
  325 {
  326     pdq_hwreset(PDQ_EISA_UNIT_TO_SOFTC(kdc->kdc_unit)->sc_pdq);
  327     (void) dev_detach(kdc);
  328     return 0;
  329 }
  330 #endif /* __FreeBSD__ */
  331 
  332 #if defined(__bsdi__)
  333 static int
  334 pdq_eisa_probe(
  335     struct device *parent,
  336     struct cfdata *cf,
  337     void *aux)
  338 {
  339     struct isa_attach_args *ia = (struct isa_attach_args *) aux;
  340     int slot;
  341     pdq_uint32_t irq, maddr, msiz;
  342 
  343     if (isa_bustype != BUS_EISA)
  344         return 0;
  345 
  346     if ((slot = eisa_match(cf, ia)) == 0)
  347         return 0;
  348     ia->ia_iobase = slot << 12;
  349     ia->ia_iosize = EISA_NPORT;
  350     eisa_slotalloc(slot);
  351 
  352     pdq_eisa_subprobe(PDQ_BUS_EISA, ia->ia_iobase, &maddr, &msiz, &irq);
  353     if (ia->ia_irq != IRQUNK && irq != ia->ia_irq) {
  354         printf("fea%d: error: desired IRQ of %d does not match device's actual IRQ (%d),\n",
  355                cf->cf_unit,
  356                ffs(ia->ia_irq) - 1, ffs(irq) - 1);
  357         return 0;
  358     }
  359     if (ia->ia_irq == IRQUNK) {
  360         if ((ia->ia_irq = isa_irqalloc(irq)) == 0) {
  361             if ((ia->ia_irq = isa_irqalloc(IRQ9|IRQ10|IRQ11|IRQ15)) == 0) {
  362                 printf("fea%d: error: IRQ %d is already in use\n", cf->cf_unit,
  363                        ffs(irq) - 1);
  364                 return 0;
  365             }
  366             irq = PDQ_OS_IORD_8(PDQ_BUS_EISA, ia->ia_iobase, PDQ_EISA_IO_CONFIG_STAT_0) & ~3;
  367             switch (ia->ia_irq) {
  368                 case IRQ9:  irq |= 0;
  369                 case IRQ10: irq |= 1;
  370                 case IRQ11: irq |= 2;
  371                 case IRQ15: irq |= 3;
  372             }
  373             PDQ_OS_IOWR_8(PDQ_BUS_EISA, ia->ia_iobase, PDQ_EISA_IO_CONFIG_STAT_0, irq);
  374         }
  375     }
  376     if (maddr == 0) {
  377         printf("fea%d: error: memory not enabled! ECU reconfiguration required\n",
  378                cf->cf_unit);
  379         return 0;
  380     }
  381 
  382     /* EISA bus masters don't use host DMA channels */
  383     ia->ia_drq = DRQNONE;
  384 
  385     ia->ia_maddr = (caddr_t) maddr;
  386     ia->ia_msize = msiz;
  387     return 1;
  388 }
  389 
  390 static void
  391 pdq_eisa_attach(
  392     struct device *parent,
  393     struct device *self,
  394     void *aux)
  395 {
  396     pdq_softc_t *sc = (pdq_softc_t *) self;
  397     struct isa_attach_args *ia = (struct isa_attach_args *) aux;
  398     struct ifnet *ifp = &sc->sc_if;
  399 
  400     sc->sc_if.if_unit = sc->sc_dev.dv_unit;
  401     sc->sc_if.if_name = "fea";
  402     sc->sc_if.if_flags = 0;
  403 
  404     sc->sc_iobase = ia->ia_iobase;
  405 
  406     pdq_eisa_devinit(sc);
  407     sc->sc_pdq = pdq_initialize(PDQ_BUS_EISA,
  408                                 (pdq_bus_memaddr_t) ISA_HOLE_VADDR(ia->ia_maddr),
  409                                 sc->sc_if.if_name, sc->sc_if.if_unit,
  410                                 (void *) sc, PDQ_DEFEA);
  411     if (sc->sc_pdq == NULL) {
  412         printf("fea%d: initialization failed\n", sc->sc_if.if_unit);
  413         return;
  414     }
  415 
  416     bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6);
  417 
  418     pdq_ifattach(sc, pdq_eisa_ifwatchdog);
  419 
  420     isa_establish(&sc->sc_id, &sc->sc_dev);
  421 
  422     sc->sc_ih.ih_fun = pdq_interrupt;
  423     sc->sc_ih.ih_arg = (void *) sc->sc_pdq;
  424     intr_establish(ia->ia_irq, &sc->sc_ih, DV_NET);
  425 
  426     sc->sc_ats.func = (void (*)(void *)) pdq_hwreset;
  427     sc->sc_ats.arg = (void *) sc->sc_pdq;
  428     atshutdown(&sc->sc_ats, ATSH_ADD);
  429 }
  430 
  431 static char *pdq_eisa_ids[] = {
  432     "DEC3001",  /* 0x0130A310 */
  433     "DEC3002",  /* 0x0230A310 */
  434     "DEC3003",  /* 0x0330A310 */
  435     "DEC3004",  /* 0x0430A310 */
  436 };
  437 
  438 struct cfdriver feacd = {
  439     0, "fea", pdq_eisa_probe, pdq_eisa_attach, DV_IFNET, sizeof(pdq_softc_t),
  440     pdq_eisa_ids
  441 };
  442 #endif /* __bsdi__ */
  443 
  444 #if defined(__NetBSD__)
  445 static int
  446 pdq_eisa_match(
  447     struct device *parent,
  448     struct cfdata *match,
  449     void *aux)
  450 {
  451     const struct eisa_attach_args * const ea = (struct eisa_attach_args *) aux;
  452 
  453     if (strncmp(ea->ea_idstring, "DEC300", 6) == 0)
  454         return 1;
  455 
  456     return 0;
  457 }
  458 
  459 static void
  460 pdq_eisa_attach(
  461     struct device *parent,
  462     struct device *self,
  463     void *aux)
  464 {
  465     pdq_softc_t * const sc = device_private(self);
  466     struct eisa_attach_args * const ea = (struct eisa_attach_args *) aux;
  467     pdq_uint32_t irq, maddr, msiz;
  468     eisa_intr_handle_t ih;
  469     const char *intrstr;
  470 
  471     sc->sc_iotag = ea->ea_iot;
  472     sc->sc_dmatag = ea->ea_dmat;
  473     bcopy(sc->sc_dev.dv_xname, sc->sc_if.if_xname, IFNAMSIZ);
  474     sc->sc_if.if_flags = 0;
  475     sc->sc_if.if_softc = sc;
  476 
  477     if (bus_space_map(sc->sc_iotag, EISA_SLOT_ADDR(ea->ea_slot), EISA_SLOT_SIZE, 0, &sc->sc_iobase)) {
  478         printf("\n%s: failed to map I/O!\n", sc->sc_dev.dv_xname);
  479         return;
  480     }
  481 
  482     pdq_eisa_subprobe(sc->sc_iotag, sc->sc_iobase, &maddr, &msiz, &irq);
  483 
  484     if (maddr != 0 && msiz != 0) {
  485         sc->sc_csrtag = ea->ea_memt;
  486         if (bus_space_map(sc->sc_csrtag, maddr, msiz, 0, &sc->sc_membase)) {
  487             bus_space_unmap(sc->sc_iotag, sc->sc_iobase, EISA_SLOT_SIZE);
  488             printf("\n%s: failed to map memory (0x%x-0x%x)!\n",
  489                    sc->sc_dev.dv_xname, maddr, maddr + msiz - 1);
  490             return;
  491         }
  492     } else {
  493         sc->sc_csrtag = sc->sc_iotag;
  494         sc->sc_membase = sc->sc_iobase;
  495     }
  496 
  497     pdq_eisa_devinit(sc);
  498     sc->sc_pdq = pdq_initialize(sc->sc_csrtag, sc->sc_membase,
  499                                 sc->sc_if.if_xname, 0,
  500                                 (void *) sc, PDQ_DEFEA);
  501     if (sc->sc_pdq == NULL) {
  502         printf("%s: initialization failed\n", sc->sc_dev.dv_xname);
  503         return;
  504     }
  505 
  506     pdq_ifattach(sc, pdq_eisa_ifwatchdog);
  507 
  508     if (eisa_intr_map(ea->ea_ec, irq, &ih)) {
  509         printf("%s: couldn't map interrupt (%d)\n", sc->sc_dev.dv_xname, irq);
  510         return;
  511     }
  512     intrstr = eisa_intr_string(ea->ea_ec, ih);
  513     sc->sc_ih = eisa_intr_establish(ea->ea_ec, ih, IST_LEVEL, IPL_NET,
  514                                     (int (*)(void *)) pdq_interrupt, sc->sc_pdq);
  515     if (sc->sc_ih == NULL) {
  516         printf("%s: couldn't establish interrupt", sc->sc_dev.dv_xname);
  517         if (intrstr != NULL)
  518             printf(" at %s", intrstr);
  519         printf("\n");
  520         return;
  521     }
  522     sc->sc_ats = shutdownhook_establish((void (*)(void *)) pdq_hwreset, sc->sc_pdq);
  523     if (sc->sc_ats == NULL)
  524         printf("%s: warning: couldn't establish shutdown hook\n", self->dv_xname);
  525     if (sc->sc_csrtag != sc->sc_iotag)
  526         printf("%s: using iomem 0x%x-0x%x\n", sc->sc_dev.dv_xname, maddr, maddr + msiz - 1);
  527     if (intrstr != NULL)
  528         printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
  529 }
  530 
  531 CFATTACH_DECL(fea, sizeof(pdq_softc_t),
  532     pdq_eisa_match, pdq_eisa_attach, NULL, NULL);
  533 #endif

Cache object: 3b6c504aaa1cb35804c437067ca9b107


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.