1/*- 2 * Copyright (c) 2000 Takanori Watanabe <takawata@jp.freebsd.org> 3 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> 4 * Copyright (c) 2000, 2001 Michael Smith 5 * Copyright (c) 2000 BSDi 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi.c 165875 2007-01-07 21:53:42Z njl $"); |
32 33#include "opt_acpi.h" 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/proc.h> 37#include <sys/fcntl.h> 38#include <sys/malloc.h> 39#include <sys/module.h> --- 1065 unchanged lines hidden (view full) --- 1105 1106 rl = acpi_get_rlist(bus, child); 1107 resource_list_delete(rl, type, rid); 1108} 1109 1110/* Allocate an IO port or memory resource, given its GAS. */ 1111int 1112acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas, |
1113 struct resource **res, u_int flags) |
1114{ 1115 int error, res_type; 1116 1117 error = ENOMEM; 1118 if (type == NULL || rid == NULL || gas == NULL || res == NULL) 1119 return (EINVAL); 1120 1121 /* We only support memory and IO spaces. */ --- 16 unchanged lines hidden (view full) --- 1138 gas->RegisterBitWidth = 8; 1139 1140 /* Validate the address after we're sure we support the space. */ 1141 if (!ACPI_VALID_ADDRESS(gas->Address) || gas->RegisterBitWidth == 0) 1142 return (EINVAL); 1143 1144 bus_set_resource(dev, res_type, *rid, gas->Address, 1145 gas->RegisterBitWidth / 8); |
1146 *res = bus_alloc_resource_any(dev, res_type, rid, RF_ACTIVE | flags); |
1147 if (*res != NULL) { 1148 *type = res_type; 1149 error = 0; 1150 } else 1151 bus_delete_resource(dev, res_type, *rid); 1152 1153 return (error); 1154} --- 2016 unchanged lines hidden --- |