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/sparc64/pci/ofw_pcib.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  * Copyright (c) 2001 - 2003 Thomas Moestl <tmm@FreeBSD.org>
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. The name of the author may not be used to endorse or promote products
   17  *    derived from this software without specific prior written permission.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  *
   31  *      from: FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.3 2000/12/13
   32  *
   33  * $FreeBSD$
   34  */
   35 
   36 #include "opt_ofw_pci.h"
   37 
   38 #include <sys/param.h>
   39 #include <sys/kernel.h>
   40 #include <sys/bus.h>
   41 #include <sys/module.h>
   42 
   43 #include <dev/ofw/ofw_bus.h>
   44 #include <dev/ofw/openfirm.h>
   45 
   46 #include <machine/bus.h>
   47 #include <machine/ofw_bus.h>
   48 
   49 #include <dev/pci/pcireg.h>
   50 #include <dev/pci/pcivar.h>
   51 #include <dev/pci/pcib_private.h>
   52 
   53 #include "pcib_if.h"
   54 
   55 #include <sparc64/pci/ofw_pci.h>
   56 #include <sparc64/pci/ofw_pcib_subr.h>
   57 
   58 static device_probe_t ofw_pcib_probe;
   59 static device_attach_t ofw_pcib_attach;
   60 
   61 static device_method_t ofw_pcib_methods[] = {
   62         /* Device interface */
   63         DEVMETHOD(device_probe,         ofw_pcib_probe),
   64         DEVMETHOD(device_attach,        ofw_pcib_attach),
   65         DEVMETHOD(device_shutdown,      bus_generic_shutdown),
   66         DEVMETHOD(device_suspend,       bus_generic_suspend),
   67         DEVMETHOD(device_resume,        bus_generic_resume),
   68 
   69         /* Bus interface */
   70         DEVMETHOD(bus_print_child,      bus_generic_print_child),
   71         DEVMETHOD(bus_read_ivar,        pcib_read_ivar),
   72         DEVMETHOD(bus_write_ivar,       pcib_write_ivar),
   73         DEVMETHOD(bus_alloc_resource,   pcib_alloc_resource),
   74         DEVMETHOD(bus_release_resource, bus_generic_release_resource),
   75         DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
   76         DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
   77         DEVMETHOD(bus_setup_intr,       bus_generic_setup_intr),
   78         DEVMETHOD(bus_teardown_intr,    bus_generic_teardown_intr),
   79 
   80         /* pcib interface */
   81         DEVMETHOD(pcib_maxslots,        pcib_maxslots),
   82         DEVMETHOD(pcib_read_config,     pcib_read_config),
   83         DEVMETHOD(pcib_write_config,    pcib_write_config),
   84         DEVMETHOD(pcib_route_interrupt, ofw_pcib_gen_route_interrupt),
   85 
   86         /* ofw_bus interface */
   87         DEVMETHOD(ofw_bus_get_node,     ofw_pcib_gen_get_node),
   88 
   89         /* ofw_pci interface */
   90         DEVMETHOD(ofw_pci_adjust_busrange,      ofw_pcib_gen_adjust_busrange),
   91 
   92         { 0, 0 }
   93 };
   94 
   95 static driver_t ofw_pcib_driver = {
   96         "pcib",
   97         ofw_pcib_methods,
   98         sizeof(struct ofw_pcib_gen_softc),
   99 };
  100 
  101 DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, 0, 0);
  102 
  103 static int
  104 ofw_pcib_probe(device_t dev)
  105 {
  106         if ((pci_get_class(dev) == PCIC_BRIDGE) &&
  107             (pci_get_subclass(dev) == PCIS_BRIDGE_PCI) &&
  108             ofw_bus_get_node(dev) != 0) {
  109                 device_set_desc(dev, "OFW PCI-PCI bridge");
  110                 return (0);
  111         }
  112         return (ENXIO);
  113 }
  114 
  115 static int
  116 ofw_pcib_attach(device_t dev)
  117 {
  118         struct ofw_pcib_gen_softc *sc = device_get_softc(dev);
  119 
  120         ofw_pcib_gen_setup(dev);
  121         pcib_attach_common(dev);
  122         device_add_child(dev, "pci", sc->ops_pcib_sc.secbus);
  123         return (bus_generic_attach(dev));
  124 }

Cache object: 8f612a4adefa7c7fd4949b6464f52d29


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