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/powerpc/mpc85xx/isa.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) 2009 Marcel Moolenaar
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  *
   13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   15  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   16  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   17  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   18  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   20  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   21  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   23  * SUCH DAMAGE.
   24  */
   25 
   26 #include <sys/cdefs.h>
   27 __FBSDID("$FreeBSD: releng/11.0/sys/powerpc/mpc85xx/isa.c 295832 2016-02-20 01:32:58Z jhibbits $");
   28 
   29 #include <sys/param.h>
   30 #include <sys/bus.h>
   31 #include <sys/malloc.h>
   32 #include <machine/bus.h>
   33 #include <sys/rman.h>
   34 
   35 #include <machine/intr_machdep.h>
   36 #include <machine/resource.h>
   37 
   38 #include <isa/isareg.h>
   39 #include <isa/isavar.h>
   40 #include <isa/isa_common.h>
   41 
   42 void
   43 isa_init(device_t dev)
   44 {
   45 }
   46 
   47 struct resource *
   48 isa_alloc_resource(device_t bus, device_t child, int type, int *rid,
   49     u_long start, u_long end, u_long count, u_int flags)
   50 {
   51         struct isa_device* idev = DEVTOISA(child);
   52         struct resource_list *rl = &idev->id_resources;
   53         int isdefault, passthrough, rids;
   54 
   55         isdefault = RMAN_IS_DEFAULT_RANGE(start, end) ? 1 : 0;
   56         passthrough = (device_get_parent(child) != bus) ? 1 : 0;
   57 
   58         if (!passthrough && !isdefault &&
   59             resource_list_find(rl, type, *rid) == NULL) {
   60                 switch (type) {
   61                 case SYS_RES_IOPORT:    rids = ISA_PNP_NPORT; break;
   62                 case SYS_RES_IRQ:       rids = ISA_PNP_NIRQ; break;
   63                 case SYS_RES_MEMORY:    rids = ISA_PNP_NMEM; break;
   64                 default:                rids = 0; break;
   65                 }
   66                 if (*rid < 0 || *rid >= rids)
   67                         return (NULL);
   68 
   69                 resource_list_add(rl, type, *rid, start, end, count);
   70         }
   71 
   72         return (resource_list_alloc(rl, bus, child, type, rid, start, end,
   73             count, flags));
   74 }
   75 
   76 int
   77 isa_release_resource(device_t bus, device_t child, int type, int rid,
   78     struct resource *r)
   79 {
   80         struct isa_device* idev = DEVTOISA(child);
   81         struct resource_list *rl = &idev->id_resources;
   82 
   83         return (resource_list_release(rl, bus, child, type, rid, r));
   84 }

Cache object: 3555f729275fb4f634fff1a19ba36525


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