subr_bus.c (66014) | subr_bus.c (67278) |
---|---|
1/*- 2 * Copyright (c) 1997,1998 Doug Rabson 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 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1997,1998 Doug Rabson 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 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/kern/subr_bus.c 66014 2000-09-17 23:57:52Z mdodd $ | 26 * $FreeBSD: head/sys/kern/subr_bus.c 67278 2000-10-18 05:15:40Z mdodd $ |
27 */ 28 29#include "opt_bus.h" 30 31#include <sys/param.h> 32#include <sys/queue.h> 33#include <sys/malloc.h> 34#include <sys/kernel.h> --- 1924 unchanged lines hidden (view full) --- 1959 1960int 1961bus_generic_write_ivar(device_t dev, device_t child, int index, 1962 uintptr_t value) 1963{ 1964 return ENOENT; 1965} 1966 | 27 */ 28 29#include "opt_bus.h" 30 31#include <sys/param.h> 32#include <sys/queue.h> 33#include <sys/malloc.h> 34#include <sys/kernel.h> --- 1924 unchanged lines hidden (view full) --- 1959 1960int 1961bus_generic_write_ivar(device_t dev, device_t child, int index, 1962 uintptr_t value) 1963{ 1964 return ENOENT; 1965} 1966 |
1967int 1968bus_generic_get_resource_list (device_t dev, device_t child, 1969 struct resource_list *rl) 1970{ 1971 return ENOENT; 1972} 1973 |
|
1967void 1968bus_generic_driver_added(device_t dev, driver_t *driver) 1969{ 1970 device_t child; 1971 1972 DEVICE_IDENTIFY(driver, dev); 1973 for (child = TAILQ_FIRST(&dev->children); 1974 child; child = TAILQ_NEXT(child, link)) --- 68 unchanged lines hidden (view full) --- 2043 /* Propagate up the bus hierarchy until someone handles it. */ 2044 if (dev->parent) 2045 return (BUS_DEACTIVATE_RESOURCE(dev->parent, child, type, rid, 2046 r)); 2047 else 2048 return (EINVAL); 2049} 2050 | 1974void 1975bus_generic_driver_added(device_t dev, driver_t *driver) 1976{ 1977 device_t child; 1978 1979 DEVICE_IDENTIFY(driver, dev); 1980 for (child = TAILQ_FIRST(&dev->children); 1981 child; child = TAILQ_NEXT(child, link)) --- 68 unchanged lines hidden (view full) --- 2050 /* Propagate up the bus hierarchy until someone handles it. */ 2051 if (dev->parent) 2052 return (BUS_DEACTIVATE_RESOURCE(dev->parent, child, type, rid, 2053 r)); 2054 else 2055 return (EINVAL); 2056} 2057 |
2058int 2059bus_generic_rl_get_resource (device_t dev, device_t child, int type, int rid, 2060 u_long *startp, u_long *countp) 2061{ 2062 struct resource_list * rl = NULL; 2063 struct resource_list_entry * rle = NULL; 2064 int retval = 0; 2065 2066 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 2067 if (retval) 2068 return (retval); 2069 2070 rle = resource_list_find(rl, type, rid); 2071 if (!rle) 2072 return ENOENT; 2073 2074 if (startp) 2075 *startp = rle->start; 2076 if (countp) 2077 *countp = rle->count; 2078 2079 return (0); 2080} 2081 2082int 2083bus_generic_rl_set_resource (device_t dev, device_t child, int type, int rid, 2084 u_long start, u_long count) 2085{ 2086 struct resource_list * rl = NULL; 2087 int retval = 0; 2088 2089 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 2090 if (retval) 2091 return (retval); 2092 2093 resource_list_add(rl, type, rid, start, (start + count - 1), count); 2094 2095 return (0); 2096} 2097 2098void 2099bus_generic_rl_delete_resource (device_t dev, device_t child, int type, int rid) 2100{ 2101 struct resource_list * rl = NULL; 2102 int retval = 0; 2103 2104 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 2105 if (retval) 2106 return; 2107 2108 resource_list_delete(rl, type, rid); 2109 2110 return; 2111} 2112 2113int 2114bus_generic_rl_release_resource (device_t dev, device_t child, int type, 2115 int rid, struct resource *r) 2116{ 2117 struct resource_list * rl = NULL; 2118 int retval = 0; 2119 2120 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 2121 if (retval) 2122 return (retval); 2123 2124 return (resource_list_release(rl, dev, child, type, rid, r)); 2125} 2126 2127struct resource * 2128bus_generic_rl_alloc_resource (device_t dev, device_t child, int type, 2129 int *rid, u_long start, u_long end, 2130 u_long count, u_int flags) 2131{ 2132 struct resource_list * rl = NULL; 2133 int retval = 0; 2134 2135 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 2136 if (retval) 2137 return (0); 2138 2139 return resource_list_alloc(rl, dev, child, type, rid, 2140 start, end, count, flags); 2141} 2142 |
|
2051/* 2052 * Some convenience functions to make it easier for drivers to use the 2053 * resource-management functions. All these really do is hide the 2054 * indirection through the parent's method table, making for slightly 2055 * less-wordy code. In the future, it might make sense for this code 2056 * to maintain some sort of a list of resources allocated by each device. 2057 */ 2058struct resource * --- 391 unchanged lines hidden --- | 2143/* 2144 * Some convenience functions to make it easier for drivers to use the 2145 * resource-management functions. All these really do is hide the 2146 * indirection through the parent's method table, making for slightly 2147 * less-wordy code. In the future, it might make sense for this code 2148 * to maintain some sort of a list of resources allocated by each device. 2149 */ 2150struct resource * --- 391 unchanged lines hidden --- |