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/quicc/quicc_bfe_ocp.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) 2006 Juniper Networks.
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. The name of the author may not be used to endorse or promote products
   14  *    derived from this software without specific prior written permission.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  * SUCH DAMAGE.
   27  */
   28 
   29 #include <sys/cdefs.h>
   30 __FBSDID("$FreeBSD: releng/8.4/sys/dev/quicc/quicc_bfe_ocp.c 176772 2008-03-03 18:20:17Z raj $");
   31 
   32 #include <sys/param.h>
   33 #include <sys/systm.h>
   34 #include <sys/bus.h>
   35 #include <sys/conf.h>
   36 #include <sys/kernel.h>
   37 #include <sys/lock.h>
   38 #include <sys/malloc.h>
   39 #include <sys/module.h>
   40 #include <sys/rman.h>
   41 #include <sys/tty.h>
   42 #include <machine/bus.h>
   43 
   44 #include <machine/ocpbus.h>
   45 
   46 #include <dev/quicc/quicc_bfe.h>
   47 
   48 static int quicc_ocp_probe(device_t dev);
   49 
   50 static device_method_t quicc_ocp_methods[] = {
   51         /* Device interface */
   52         DEVMETHOD(device_probe,         quicc_ocp_probe),
   53         DEVMETHOD(device_attach,        quicc_bfe_attach),
   54         DEVMETHOD(device_detach,        quicc_bfe_detach),
   55 
   56         DEVMETHOD(bus_alloc_resource,   quicc_bus_alloc_resource),
   57         DEVMETHOD(bus_release_resource, quicc_bus_release_resource),
   58         DEVMETHOD(bus_get_resource,     quicc_bus_get_resource),
   59         DEVMETHOD(bus_read_ivar,        quicc_bus_read_ivar),
   60         DEVMETHOD(bus_setup_intr,       quicc_bus_setup_intr),
   61         DEVMETHOD(bus_teardown_intr,    quicc_bus_teardown_intr),
   62         DEVMETHOD(bus_print_child,      bus_generic_print_child),
   63         DEVMETHOD(bus_driver_added,     bus_generic_driver_added),
   64 
   65         { 0, 0 }
   66 };
   67 
   68 static driver_t quicc_ocp_driver = {
   69         quicc_driver_name,
   70         quicc_ocp_methods,
   71         sizeof(struct quicc_softc),
   72 };
   73 
   74 static int
   75 quicc_ocp_probe(device_t dev)
   76 {
   77         device_t parent;
   78         uintptr_t clock, devtype;
   79         int error;
   80 
   81         parent = device_get_parent(dev);
   82 
   83         error = BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_DEVTYPE, &devtype);
   84         if (error)
   85                 return (error);
   86         if (devtype != OCPBUS_DEVTYPE_QUICC)
   87                 return (ENXIO);
   88 
   89         if (BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_CLOCK, &clock))
   90                 clock = 0;
   91         return (quicc_bfe_probe(dev, clock));
   92 }
   93 
   94 DRIVER_MODULE(quicc, ocpbus, quicc_ocp_driver, quicc_devclass, 0, 0);

Cache object: f317cda734e7c610d693c2bcf2e42296


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