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/pci/eisa_pci.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 /*-
    2  * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier
    3  * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
    4  * Copyright (c) 2000 BSDi
    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. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. The name of the author may not be used to endorse or promote products
   16  *    derived from this software without specific prior written permission.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28  * SUCH DAMAGE.
   29  */
   30 
   31 #include <sys/cdefs.h>
   32 __FBSDID("$FreeBSD$");
   33 
   34 /*
   35  * PCI:EISA bridge support
   36  */
   37 
   38 #include <sys/param.h>
   39 #include <sys/kernel.h>
   40 #include <sys/module.h>
   41 #include <sys/bus.h>
   42 
   43 #include <dev/pci/pcivar.h>
   44 #include <dev/pci/pcireg.h>
   45 
   46 static int      eisab_probe(device_t dev);
   47 static int      eisab_attach(device_t dev);
   48 
   49 static device_method_t eisab_methods[] = {
   50     /* Device interface */
   51     DEVMETHOD(device_probe,             eisab_probe),
   52     DEVMETHOD(device_attach,            eisab_attach),
   53     DEVMETHOD(device_shutdown,          bus_generic_shutdown),
   54     DEVMETHOD(device_suspend,           bus_generic_suspend),
   55     DEVMETHOD(device_resume,            bus_generic_resume),
   56 
   57     /* Bus interface */
   58     DEVMETHOD(bus_print_child,          bus_generic_print_child),
   59     DEVMETHOD(bus_alloc_resource,       bus_generic_alloc_resource),
   60     DEVMETHOD(bus_release_resource,     bus_generic_release_resource),
   61     DEVMETHOD(bus_activate_resource,    bus_generic_activate_resource),
   62     DEVMETHOD(bus_deactivate_resource,  bus_generic_deactivate_resource),
   63     DEVMETHOD(bus_setup_intr,           bus_generic_setup_intr),
   64     DEVMETHOD(bus_teardown_intr,        bus_generic_teardown_intr),
   65 
   66     { 0, 0 }
   67 };
   68 
   69 static driver_t eisab_driver = {
   70     "eisab",
   71     eisab_methods,
   72     0,
   73 };
   74 
   75 static devclass_t eisab_devclass;
   76 
   77 DRIVER_MODULE(eisab, pci, eisab_driver, eisab_devclass, 0, 0);
   78 
   79 static int
   80 eisab_probe(device_t dev)
   81 {
   82     int         matched = 0;
   83 
   84     /*
   85      * Generic match by class/subclass.
   86      */
   87     if ((pci_get_class(dev) == PCIC_BRIDGE) &&
   88         (pci_get_subclass(dev) == PCIS_BRIDGE_EISA))
   89         matched = 1;
   90 
   91     /*
   92      * Some bridges don't correctly report their class.
   93      */
   94     switch (pci_get_devid(dev)) {
   95     case 0x04828086:            /* may show up as PCI-HOST or 0:0 */
   96         matched = 1;
   97         break;
   98     default:
   99         break;
  100     }
  101     
  102     if (matched) {
  103         device_set_desc(dev, "PCI-EISA bridge");
  104         return(-10000);
  105     }
  106     return(ENXIO);
  107 }
  108 
  109 static int
  110 eisab_attach(device_t dev)
  111 {
  112     /*
  113      * Attach an EISA bus.  Note that we can only have one EISA bus.
  114      */
  115     if (!devclass_get_device(devclass_find("eisa"), 0))
  116         device_add_child(dev, "eisa", -1);
  117 
  118     /*
  119      * Attach an ISA bus as well, since the EISA bus may have ISA
  120      * cards installed, and we may have no EISA support in the system.
  121      */
  122     if (!devclass_get_device(devclass_find("isa"), 0))
  123         device_add_child(dev, "isa", -1);
  124 
  125     bus_generic_attach(dev);
  126 
  127     return(0);
  128 }

Cache object: 1571fd54560c0749b9baf64aca24fa62


[ 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.