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/ofw/ofw_bus_if.m

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) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org>
    3 # Copyright (c) 2004, 2005 by Marius Strobl <marius@FreeBSD.org>
    4 # All rights reserved.
    5 #
    6 # Redistribution and use in source and binary forms, with or without
    7 # modification, are permitted provided that the following conditions
    8 # are met:
    9 # 1. Redistributions of source code must retain the above copyright
   10 #    notice, this list of conditions and the following disclaimer.
   11 # 2. Redistributions in binary form must reproduce the above copyright
   12 #    notice, this list of conditions and the following disclaimer in the
   13 #    documentation and/or other materials provided with the distribution.
   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 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   19 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   20 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   21 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   22 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   23 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
   24 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25 #
   26 # $FreeBSD$
   27 
   28 # Interface for retrieving the package handle and a subset, namely
   29 # 'compatible', 'device_type', 'model' and 'name', of the standard
   30 # properties of a device on an Open Firmware assisted bus for use
   31 # in device drivers. The rest of the standard properties, 'address',
   32 # 'interrupts', 'reg' and 'status', are not covered by this interface
   33 # as they are expected to be only of interest in the respective bus
   34 # driver.
   35 
   36 #include <sys/bus.h>
   37 
   38 #include <dev/ofw/openfirm.h>
   39 
   40 INTERFACE ofw_bus;
   41 
   42 HEADER {
   43         struct ofw_bus_devinfo {
   44                 phandle_t       obd_node;
   45                 char            *obd_compat;
   46                 char            *obd_model;
   47                 char            *obd_name;
   48                 char            *obd_type;
   49                 char            *obd_status;
   50         };
   51 };
   52 
   53 CODE {
   54         static ofw_bus_get_devinfo_t ofw_bus_default_get_devinfo;
   55         static ofw_bus_get_compat_t ofw_bus_default_get_compat;
   56         static ofw_bus_get_model_t ofw_bus_default_get_model;
   57         static ofw_bus_get_name_t ofw_bus_default_get_name;
   58         static ofw_bus_get_node_t ofw_bus_default_get_node;
   59         static ofw_bus_get_type_t ofw_bus_default_get_type;
   60         static ofw_bus_map_intr_t ofw_bus_default_map_intr;
   61 
   62         static const struct ofw_bus_devinfo *
   63         ofw_bus_default_get_devinfo(device_t bus, device_t dev)
   64         {
   65 
   66                 return (NULL);
   67         }
   68 
   69         static const char *
   70         ofw_bus_default_get_compat(device_t bus, device_t dev)
   71         {
   72 
   73                 return (NULL);
   74         }
   75 
   76         static const char *
   77         ofw_bus_default_get_model(device_t bus, device_t dev)
   78         {
   79 
   80                 return (NULL);
   81         }
   82 
   83         static const char *
   84         ofw_bus_default_get_name(device_t bus, device_t dev)
   85         {
   86 
   87                 return (NULL);
   88         }
   89 
   90         static phandle_t
   91         ofw_bus_default_get_node(device_t bus, device_t dev)
   92         {
   93 
   94                 return (-1);
   95         }
   96 
   97         static const char *
   98         ofw_bus_default_get_type(device_t bus, device_t dev)
   99         {
  100 
  101                 return (NULL);
  102         }
  103 
  104         int
  105         ofw_bus_default_map_intr(device_t bus, device_t dev, phandle_t iparent,
  106             int icells, pcell_t *interrupt)
  107         {
  108                 /* Propagate up the bus hierarchy until someone handles it. */  
  109                 if (device_get_parent(bus) != NULL)
  110                         return OFW_BUS_MAP_INTR(device_get_parent(bus), dev,
  111                             iparent, icells, interrupt);
  112 
  113                 /* If that fails, then assume a one-domain system */
  114                 return (interrupt[0]);
  115         }
  116 };
  117 
  118 # Get the ofw_bus_devinfo struct for the device dev on the bus. Used for bus
  119 # drivers which use the generic methods in ofw_bus_subr.c to implement the
  120 # reset of this interface. The default method will return NULL, which means
  121 # there is no such struct associated with the device.
  122 METHOD const struct ofw_bus_devinfo * get_devinfo {
  123         device_t bus;
  124         device_t dev;
  125 } DEFAULT ofw_bus_default_get_devinfo;
  126 
  127 # Get the alternate firmware name for the device dev on the bus. The default
  128 # method will return NULL, which means the device doesn't have such a property.
  129 METHOD const char * get_compat {
  130         device_t bus;
  131         device_t dev;
  132 } DEFAULT ofw_bus_default_get_compat;
  133 
  134 # Get the firmware model name for the device dev on the bus. The default method
  135 # will return NULL, which means the device doesn't have such a property.
  136 METHOD const char * get_model {
  137         device_t bus;
  138         device_t dev;
  139 } DEFAULT ofw_bus_default_get_model;
  140 
  141 # Get the firmware name for the device dev on the bus. The default method will
  142 # return NULL, which means the device doesn't have such a property.
  143 METHOD const char * get_name {
  144         device_t bus;
  145         device_t dev;
  146 } DEFAULT ofw_bus_default_get_name;
  147 
  148 # Get the firmware node for the device dev on the bus. The default method will
  149 # return -1, which signals that there is no such node.
  150 METHOD phandle_t get_node {
  151         device_t bus;
  152         device_t dev;
  153 } DEFAULT ofw_bus_default_get_node;
  154 
  155 # Get the firmware device type for the device dev on the bus. The default
  156 # method will return NULL, which means the device doesn't have such a property.
  157 METHOD const char * get_type {
  158         device_t bus;
  159         device_t dev;
  160 } DEFAULT ofw_bus_default_get_type;
  161 
  162 # Map an (interrupt parent, IRQ) pair to a unique system-wide interrupt number.
  163 # If the interrupt encoding includes a sense field, the interrupt sense will
  164 # also be configured.
  165 METHOD int map_intr {
  166         device_t bus;
  167         device_t dev;
  168         phandle_t iparent;
  169         int icells;
  170         pcell_t *interrupt;
  171 } DEFAULT ofw_bus_default_map_intr;

Cache object: e4bfdbfefc8a56812bb7a5de1de6ef16


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