subr_bus.c (68727) | subr_bus.c (69294) |
---|---|
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 68727 2000-11-14 20:46:02Z mckusick $ | 26 * $FreeBSD: head/sys/kern/subr_bus.c 69294 2000-11-28 06:49:15Z 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> --- 1810 unchanged lines hidden (view full) --- 1845 1846int 1847bus_generic_write_ivar(device_t dev, device_t child, int index, 1848 uintptr_t value) 1849{ 1850 return ENOENT; 1851} 1852 | 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> --- 1810 unchanged lines hidden (view full) --- 1845 1846int 1847bus_generic_write_ivar(device_t dev, device_t child, int index, 1848 uintptr_t value) 1849{ 1850 return ENOENT; 1851} 1852 |
1853int 1854bus_generic_get_resource_list (device_t dev, device_t child, 1855 struct resource_list *rl) | 1853struct resource_list * 1854bus_generic_get_resource_list (device_t dev, device_t child) |
1856{ | 1855{ |
1857 return ENOENT; | 1856 return NULL; |
1858} 1859 1860void 1861bus_generic_driver_added(device_t dev, driver_t *driver) 1862{ 1863 device_t child; 1864 1865 DEVICE_IDENTIFY(driver, dev); --- 76 unchanged lines hidden (view full) --- 1942} 1943 1944int 1945bus_generic_rl_get_resource (device_t dev, device_t child, int type, int rid, 1946 u_long *startp, u_long *countp) 1947{ 1948 struct resource_list * rl = NULL; 1949 struct resource_list_entry * rle = NULL; | 1857} 1858 1859void 1860bus_generic_driver_added(device_t dev, driver_t *driver) 1861{ 1862 device_t child; 1863 1864 DEVICE_IDENTIFY(driver, dev); --- 76 unchanged lines hidden (view full) --- 1941} 1942 1943int 1944bus_generic_rl_get_resource (device_t dev, device_t child, int type, int rid, 1945 u_long *startp, u_long *countp) 1946{ 1947 struct resource_list * rl = NULL; 1948 struct resource_list_entry * rle = NULL; |
1950 int retval = 0; | |
1951 | 1949 |
1952 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 1953 if (retval) 1954 return (retval); | 1950 rl = BUS_GET_RESOURCE_LIST(dev, child); 1951 if (!rl) 1952 return (EINVAL); |
1955 1956 rle = resource_list_find(rl, type, rid); 1957 if (!rle) 1958 return ENOENT; 1959 1960 if (startp) 1961 *startp = rle->start; 1962 if (countp) 1963 *countp = rle->count; 1964 1965 return (0); 1966} 1967 1968int 1969bus_generic_rl_set_resource (device_t dev, device_t child, int type, int rid, 1970 u_long start, u_long count) 1971{ 1972 struct resource_list * rl = NULL; | 1953 1954 rle = resource_list_find(rl, type, rid); 1955 if (!rle) 1956 return ENOENT; 1957 1958 if (startp) 1959 *startp = rle->start; 1960 if (countp) 1961 *countp = rle->count; 1962 1963 return (0); 1964} 1965 1966int 1967bus_generic_rl_set_resource (device_t dev, device_t child, int type, int rid, 1968 u_long start, u_long count) 1969{ 1970 struct resource_list * rl = NULL; |
1973 int retval = 0; | |
1974 | 1971 |
1975 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 1976 if (retval) 1977 return (retval); | 1972 rl = BUS_GET_RESOURCE_LIST(dev, child); 1973 if (!rl) 1974 return (EINVAL); |
1978 1979 resource_list_add(rl, type, rid, start, (start + count - 1), count); 1980 1981 return (0); 1982} 1983 1984void 1985bus_generic_rl_delete_resource (device_t dev, device_t child, int type, int rid) 1986{ 1987 struct resource_list * rl = NULL; | 1975 1976 resource_list_add(rl, type, rid, start, (start + count - 1), count); 1977 1978 return (0); 1979} 1980 1981void 1982bus_generic_rl_delete_resource (device_t dev, device_t child, int type, int rid) 1983{ 1984 struct resource_list * rl = NULL; |
1988 int retval = 0; | |
1989 | 1985 |
1990 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 1991 if (retval) | 1986 rl = BUS_GET_RESOURCE_LIST(dev, child); 1987 if (!rl) |
1992 return; 1993 1994 resource_list_delete(rl, type, rid); 1995 1996 return; 1997} 1998 1999int 2000bus_generic_rl_release_resource (device_t dev, device_t child, int type, 2001 int rid, struct resource *r) 2002{ 2003 struct resource_list * rl = NULL; | 1988 return; 1989 1990 resource_list_delete(rl, type, rid); 1991 1992 return; 1993} 1994 1995int 1996bus_generic_rl_release_resource (device_t dev, device_t child, int type, 1997 int rid, struct resource *r) 1998{ 1999 struct resource_list * rl = NULL; |
2004 int retval = 0; | |
2005 | 2000 |
2006 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 2007 if (retval) 2008 return (retval); | 2001 rl = BUS_GET_RESOURCE_LIST(dev, child); 2002 if (!rl) 2003 return (EINVAL); |
2009 2010 return (resource_list_release(rl, dev, child, type, rid, r)); 2011} 2012 2013struct resource * 2014bus_generic_rl_alloc_resource (device_t dev, device_t child, int type, 2015 int *rid, u_long start, u_long end, 2016 u_long count, u_int flags) 2017{ 2018 struct resource_list * rl = NULL; | 2004 2005 return (resource_list_release(rl, dev, child, type, rid, r)); 2006} 2007 2008struct resource * 2009bus_generic_rl_alloc_resource (device_t dev, device_t child, int type, 2010 int *rid, u_long start, u_long end, 2011 u_long count, u_int flags) 2012{ 2013 struct resource_list * rl = NULL; |
2019 int retval = 0; | |
2020 | 2014 |
2021 retval = BUS_GET_RESOURCE_LIST(dev, child, rl); 2022 if (retval) 2023 return (0); | 2015 rl = BUS_GET_RESOURCE_LIST(dev, child); 2016 if (!rl) 2017 return (NULL); |
2024 2025 return resource_list_alloc(rl, dev, child, type, rid, 2026 start, end, count, flags); 2027} 2028 2029/* 2030 * Some convenience functions to make it easier for drivers to use the 2031 * resource-management functions. All these really do is hide the --- 579 unchanged lines hidden --- | 2018 2019 return resource_list_alloc(rl, dev, child, type, rid, 2020 start, end, count, flags); 2021} 2022 2023/* 2024 * Some convenience functions to make it easier for drivers to use the 2025 * resource-management functions. All these really do is hide the --- 579 unchanged lines hidden --- |