Home | History | Annotate | Line # | Download | only in acpi
acpi_resource.c revision 1.6.2.1
      1  1.6.2.1    skrll /*	$NetBSD: acpi_resource.c,v 1.6.2.1 2004/08/03 10:45:03 skrll Exp $	*/
      2      1.1  thorpej 
      3      1.1  thorpej /*
      4      1.1  thorpej  * Copyright 2001 Wasabi Systems, Inc.
      5      1.1  thorpej  * All rights reserved.
      6      1.1  thorpej  *
      7      1.1  thorpej  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
      8      1.1  thorpej  *
      9      1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     10      1.1  thorpej  * modification, are permitted provided that the following conditions
     11      1.1  thorpej  * are met:
     12      1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     13      1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     14      1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     15      1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     16      1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     17      1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     18      1.1  thorpej  *    must display the following acknowledgement:
     19      1.1  thorpej  *	This product includes software developed for the NetBSD Project by
     20      1.1  thorpej  *	Wasabi Systems, Inc.
     21      1.1  thorpej  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22      1.1  thorpej  *    or promote products derived from this software without specific prior
     23      1.1  thorpej  *    written permission.
     24      1.1  thorpej  *
     25      1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26      1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27      1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28      1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29      1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30      1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31      1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32      1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33      1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34      1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35      1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     36      1.1  thorpej  */
     37      1.1  thorpej 
     38      1.1  thorpej /*-
     39      1.1  thorpej  * Copyright (c) 2000 Michael Smith
     40      1.1  thorpej  * Copyright (c) 2000 BSDi
     41      1.1  thorpej  * All rights reserved.
     42      1.1  thorpej  *
     43      1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     44      1.1  thorpej  * modification, are permitted provided that the following conditions
     45      1.1  thorpej  * are met:
     46      1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     47      1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     48      1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     49      1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     50      1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     51  1.6.2.1    skrll  *
     52      1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     53      1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     54      1.1  thorpej  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     55  1.6.2.1    skrll  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     56      1.1  thorpej  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     57      1.1  thorpej  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     58      1.1  thorpej  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     59      1.1  thorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     60      1.1  thorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     61      1.1  thorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     62  1.6.2.1    skrll  * SUCH DAMAGE.
     63      1.1  thorpej  */
     64      1.1  thorpej 
     65      1.1  thorpej /*
     66      1.1  thorpej  * ACPI resource parsing.
     67      1.1  thorpej  */
     68      1.2    lukem 
     69      1.2    lukem #include <sys/cdefs.h>
     70  1.6.2.1    skrll __KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.6.2.1 2004/08/03 10:45:03 skrll Exp $");
     71      1.1  thorpej 
     72      1.1  thorpej #include <sys/param.h>
     73      1.1  thorpej #include <sys/systm.h>
     74      1.1  thorpej #include <sys/device.h>
     75      1.1  thorpej 
     76      1.1  thorpej #include <dev/acpi/acpica.h>
     77      1.1  thorpej #include <dev/acpi/acpireg.h>
     78      1.1  thorpej #include <dev/acpi/acpivar.h>
     79      1.1  thorpej 
     80      1.4  thorpej #define	_COMPONENT	ACPI_RESOURCE_COMPONENT
     81      1.4  thorpej ACPI_MODULE_NAME("RESOURCE")
     82      1.1  thorpej 
     83  1.6.2.1    skrll static ACPI_STATUS acpi_resource_parse_callback(ACPI_RESOURCE *, void *);
     84  1.6.2.1    skrll 
     85  1.6.2.1    skrll struct resource_parse_callback_arg {
     86  1.6.2.1    skrll 	const struct acpi_resource_parse_ops *ops;
     87  1.6.2.1    skrll 	struct device *dev;
     88      1.1  thorpej 	void *context;
     89  1.6.2.1    skrll };
     90  1.6.2.1    skrll 
     91  1.6.2.1    skrll static ACPI_STATUS
     92  1.6.2.1    skrll acpi_resource_parse_callback(ACPI_RESOURCE *res, void *context)
     93  1.6.2.1    skrll {
     94  1.6.2.1    skrll 	struct resource_parse_callback_arg *arg = context;
     95  1.6.2.1    skrll 	const struct acpi_resource_parse_ops *ops;
     96      1.1  thorpej 	int i;
     97      1.1  thorpej 
     98      1.4  thorpej 	ACPI_FUNCTION_TRACE(__FUNCTION__);
     99      1.1  thorpej 
    100  1.6.2.1    skrll 	ops = arg->ops;
    101      1.1  thorpej 
    102  1.6.2.1    skrll 	switch (res->Id) {
    103  1.6.2.1    skrll 	case ACPI_RSTYPE_FIXED_IO:
    104  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    105  1.6.2.1    skrll 				     "FixedIo 0x%x/%d\n",
    106  1.6.2.1    skrll 				     res->Data.FixedIo.BaseAddress,
    107  1.6.2.1    skrll 				     res->Data.FixedIo.RangeLength));
    108  1.6.2.1    skrll 		if (ops->ioport)
    109  1.6.2.1    skrll 			(*ops->ioport)(arg->dev, arg->context,
    110      1.1  thorpej 			    res->Data.FixedIo.BaseAddress,
    111      1.1  thorpej 			    res->Data.FixedIo.RangeLength);
    112  1.6.2.1    skrll 		break;
    113      1.1  thorpej 
    114  1.6.2.1    skrll 	case ACPI_RSTYPE_IO:
    115  1.6.2.1    skrll 		if (res->Data.Io.MinBaseAddress ==
    116      1.1  thorpej 			    res->Data.Io.MaxBaseAddress) {
    117  1.6.2.1    skrll 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    118  1.6.2.1    skrll 					     "Io 0x%x/%d\n",
    119  1.6.2.1    skrll 					     res->Data.Io.MinBaseAddress,
    120  1.6.2.1    skrll 					     res->Data.Io.RangeLength));
    121  1.6.2.1    skrll 			if (ops->ioport)
    122  1.6.2.1    skrll 				(*ops->ioport)(arg->dev, arg->context,
    123      1.1  thorpej 				    res->Data.Io.MinBaseAddress,
    124      1.1  thorpej 				    res->Data.Io.RangeLength);
    125  1.6.2.1    skrll 		} else {
    126  1.6.2.1    skrll 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    127  1.6.2.1    skrll 					     "Io 0x%x-0x%x/%d\n",
    128  1.6.2.1    skrll 					     res->Data.Io.MinBaseAddress,
    129  1.6.2.1    skrll 					     res->Data.Io.MaxBaseAddress,
    130  1.6.2.1    skrll 					     res->Data.Io.RangeLength));
    131  1.6.2.1    skrll 			if (ops->ioport)
    132  1.6.2.1    skrll 				(*ops->iorange)(arg->dev, arg->context,
    133      1.1  thorpej 				    res->Data.Io.MinBaseAddress,
    134      1.1  thorpej 				    res->Data.Io.MaxBaseAddress,
    135      1.1  thorpej 				    res->Data.Io.RangeLength,
    136      1.1  thorpej 				    res->Data.Io.Alignment);
    137  1.6.2.1    skrll 		}
    138  1.6.2.1    skrll 		break;
    139      1.1  thorpej 
    140  1.6.2.1    skrll 	case ACPI_RSTYPE_FIXED_MEM32:
    141  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    142  1.6.2.1    skrll 				     "FixedMemory32 0x%x/%d\n",
    143  1.6.2.1    skrll 				     res->Data.FixedMemory32.RangeBaseAddress,
    144  1.6.2.1    skrll 				     res->Data.FixedMemory32.RangeLength));
    145  1.6.2.1    skrll 		if (ops->memory)
    146  1.6.2.1    skrll 			(*ops->memory)(arg->dev, arg->context,
    147      1.1  thorpej 			    res->Data.FixedMemory32.RangeBaseAddress,
    148      1.1  thorpej 			    res->Data.FixedMemory32.RangeLength);
    149  1.6.2.1    skrll 		break;
    150      1.1  thorpej 
    151  1.6.2.1    skrll 	case ACPI_RSTYPE_MEM32:
    152  1.6.2.1    skrll 		if (res->Data.Memory32.MinBaseAddress ==
    153  1.6.2.1    skrll 		    res->Data.Memory32.MaxBaseAddress) {
    154  1.6.2.1    skrll 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    155  1.6.2.1    skrll 					     "Memory32 0x%x/%d\n",
    156  1.6.2.1    skrll 					     res->Data.Memory32.MinBaseAddress,
    157  1.6.2.1    skrll 					     res->Data.Memory32.RangeLength));
    158  1.6.2.1    skrll 			if (ops->memory)
    159  1.6.2.1    skrll 				(*ops->memory)(arg->dev, arg->context,
    160      1.1  thorpej 				    res->Data.Memory32.MinBaseAddress,
    161      1.1  thorpej 				    res->Data.Memory32.RangeLength);
    162  1.6.2.1    skrll 		} else {
    163  1.6.2.1    skrll 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    164  1.6.2.1    skrll 					     "Memory32 0x%x-0x%x/%d\n",
    165  1.6.2.1    skrll 					     res->Data.Memory32.MinBaseAddress,
    166  1.6.2.1    skrll 					     res->Data.Memory32.MaxBaseAddress,
    167  1.6.2.1    skrll 					     res->Data.Memory32.RangeLength));
    168  1.6.2.1    skrll 			if (ops->memrange)
    169  1.6.2.1    skrll 				(*ops->memrange)(arg->dev, arg->context,
    170      1.1  thorpej 				    res->Data.Memory32.MinBaseAddress,
    171      1.1  thorpej 				    res->Data.Memory32.MaxBaseAddress,
    172      1.1  thorpej 				    res->Data.Memory32.RangeLength,
    173      1.1  thorpej 				    res->Data.Memory32.Alignment);
    174  1.6.2.1    skrll 		}
    175  1.6.2.1    skrll 		break;
    176      1.1  thorpej 
    177  1.6.2.1    skrll 	case ACPI_RSTYPE_MEM24:
    178  1.6.2.1    skrll 		if (res->Data.Memory24.MinBaseAddress ==
    179  1.6.2.1    skrll 		    res->Data.Memory24.MaxBaseAddress) {
    180  1.6.2.1    skrll 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    181  1.6.2.1    skrll 					     "Memory24 0x%x/%d\n",
    182  1.6.2.1    skrll 					     res->Data.Memory24.MinBaseAddress,
    183  1.6.2.1    skrll 					     res->Data.Memory24.RangeLength));
    184  1.6.2.1    skrll 			if (ops->memory)
    185  1.6.2.1    skrll 				(*ops->memory)(arg->dev, arg->context,
    186      1.1  thorpej 				    res->Data.Memory24.MinBaseAddress,
    187      1.1  thorpej 				    res->Data.Memory24.RangeLength);
    188  1.6.2.1    skrll 		} else {
    189  1.6.2.1    skrll 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    190  1.6.2.1    skrll 					     "Memory24 0x%x-0x%x/%d\n",
    191  1.6.2.1    skrll 					     res->Data.Memory24.MinBaseAddress,
    192  1.6.2.1    skrll 					     res->Data.Memory24.MaxBaseAddress,
    193  1.6.2.1    skrll 					     res->Data.Memory24.RangeLength));
    194  1.6.2.1    skrll 			if (ops->memrange)
    195  1.6.2.1    skrll 				(*ops->memrange)(arg->dev, arg->context,
    196      1.1  thorpej 				    res->Data.Memory24.MinBaseAddress,
    197      1.1  thorpej 				    res->Data.Memory24.MaxBaseAddress,
    198      1.1  thorpej 				    res->Data.Memory24.RangeLength,
    199      1.1  thorpej 				    res->Data.Memory24.Alignment);
    200  1.6.2.1    skrll 		}
    201  1.6.2.1    skrll 		break;
    202      1.1  thorpej 
    203  1.6.2.1    skrll 	case ACPI_RSTYPE_IRQ:
    204  1.6.2.1    skrll 		for (i = 0; i < res->Data.Irq.NumberOfInterrupts; i++) {
    205  1.6.2.1    skrll 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    206  1.6.2.1    skrll 					     "IRQ %d\n",
    207  1.6.2.1    skrll 					     res->Data.Irq.Interrupts[i]));
    208  1.6.2.1    skrll 			if (ops->irq)
    209  1.6.2.1    skrll 				(*ops->irq)(arg->dev, arg->context,
    210      1.5     matt 				    res->Data.Irq.Interrupts[i],
    211      1.5     matt 				    res->Data.Irq.EdgeLevel);
    212  1.6.2.1    skrll 		}
    213  1.6.2.1    skrll 		break;
    214      1.1  thorpej 
    215  1.6.2.1    skrll 	case ACPI_RSTYPE_DMA:
    216  1.6.2.1    skrll 		for (i = 0; i < res->Data.Dma.NumberOfChannels; i++) {
    217  1.6.2.1    skrll 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    218  1.6.2.1    skrll 					     "DRQ %d\n",
    219  1.6.2.1    skrll 					     res->Data.Dma.Channels[i]));
    220  1.6.2.1    skrll 			if (ops->drq)
    221  1.6.2.1    skrll 				(*ops->drq)(arg->dev, arg->context,
    222      1.1  thorpej 				    res->Data.Dma.Channels[i]);
    223  1.6.2.1    skrll 		}
    224  1.6.2.1    skrll 		break;
    225      1.1  thorpej 
    226  1.6.2.1    skrll 	case ACPI_RSTYPE_START_DPF:
    227  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    228  1.6.2.1    skrll 				     "Start dependant functions: %d\n",
    229  1.6.2.1    skrll 				     res->Data.StartDpf.CompatibilityPriority));
    230  1.6.2.1    skrll 		if (ops->start_dep)
    231  1.6.2.1    skrll 			(*ops->start_dep)(arg->dev, arg->context,
    232      1.1  thorpej 			    res->Data.StartDpf.CompatibilityPriority);
    233  1.6.2.1    skrll 		break;
    234      1.1  thorpej 
    235  1.6.2.1    skrll 	case ACPI_RSTYPE_END_DPF:
    236  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    237  1.6.2.1    skrll 				     "End dependant functions\n"));
    238  1.6.2.1    skrll 		if (ops->end_dep)
    239  1.6.2.1    skrll 			(*ops->end_dep)(arg->dev, arg->context);
    240  1.6.2.1    skrll 
    241  1.6.2.1    skrll 	case ACPI_RSTYPE_ADDRESS32:
    242  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    243  1.6.2.1    skrll 				     "Address32 unimplemented\n"));
    244  1.6.2.1    skrll 		break;
    245  1.6.2.1    skrll 
    246  1.6.2.1    skrll 	case ACPI_RSTYPE_ADDRESS16:
    247  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    248  1.6.2.1    skrll 				     "Address16 unimplemented\n"));
    249  1.6.2.1    skrll 		break;
    250  1.6.2.1    skrll 
    251  1.6.2.1    skrll 	case ACPI_RSTYPE_EXT_IRQ:
    252  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    253  1.6.2.1    skrll 				     "ExtendedIrq unimplemented\n"));
    254  1.6.2.1    skrll 		break;
    255  1.6.2.1    skrll 
    256  1.6.2.1    skrll 	case ACPI_RSTYPE_VENDOR:
    257  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    258  1.6.2.1    skrll 				     "VendorSpecific unimplemented\n"));
    259  1.6.2.1    skrll 		break;
    260  1.6.2.1    skrll 
    261  1.6.2.1    skrll 	default:
    262  1.6.2.1    skrll 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
    263  1.6.2.1    skrll 				     "Unknown resource type: %d\n", res->Id));
    264  1.6.2.1    skrll 		break;
    265  1.6.2.1    skrll 	}
    266      1.1  thorpej 
    267  1.6.2.1    skrll 	return_ACPI_STATUS(AE_OK);
    268  1.6.2.1    skrll }
    269      1.1  thorpej 
    270      1.1  thorpej 
    271  1.6.2.1    skrll /*
    272  1.6.2.1    skrll  * acpi_resource_parse:
    273  1.6.2.1    skrll  *
    274  1.6.2.1    skrll  *	Parse a device node's resources and fill them in for the
    275  1.6.2.1    skrll  *	client.
    276  1.6.2.1    skrll  *
    277  1.6.2.1    skrll  *	This API supports _CRS (current resources) and
    278  1.6.2.1    skrll  *	_PRS (possible resources).
    279  1.6.2.1    skrll  *
    280  1.6.2.1    skrll  *	Note that it might be nice to also locate ACPI-specific resource
    281  1.6.2.1    skrll  *	items, such as GPE bits.
    282  1.6.2.1    skrll  */
    283  1.6.2.1    skrll ACPI_STATUS
    284  1.6.2.1    skrll acpi_resource_parse(struct device *dev, ACPI_HANDLE handle, char *path,
    285  1.6.2.1    skrll     void *arg, const struct acpi_resource_parse_ops *ops)
    286  1.6.2.1    skrll {
    287  1.6.2.1    skrll 	struct resource_parse_callback_arg cbarg;
    288  1.6.2.1    skrll 	ACPI_STATUS rv;
    289      1.1  thorpej 
    290  1.6.2.1    skrll 	ACPI_FUNCTION_TRACE(__FUNCTION__);
    291      1.1  thorpej 
    292  1.6.2.1    skrll 	if (ops->init)
    293  1.6.2.1    skrll 		(*ops->init)(dev, arg, &cbarg.context);
    294  1.6.2.1    skrll 	else
    295  1.6.2.1    skrll 		cbarg.context = arg;
    296  1.6.2.1    skrll 	cbarg.ops = ops;
    297  1.6.2.1    skrll 	cbarg.dev = dev;
    298  1.6.2.1    skrll 
    299  1.6.2.1    skrll 	rv =AcpiWalkResources(handle, path, acpi_resource_parse_callback,
    300  1.6.2.1    skrll 	    &cbarg);
    301  1.6.2.1    skrll 	if (ACPI_FAILURE(rv)) {
    302  1.6.2.1    skrll 		printf("%s: ACPI: unable to get %s resources: %s\n",
    303  1.6.2.1    skrll 		    dev->dv_xname, path, AcpiFormatException(rv));
    304  1.6.2.1    skrll 		return_ACPI_STATUS(rv);
    305      1.1  thorpej 	}
    306      1.1  thorpej 
    307  1.6.2.1    skrll 	if (ops->fini)
    308  1.6.2.1    skrll 		(*ops->fini)(dev, cbarg.context);
    309      1.1  thorpej 
    310      1.1  thorpej 	return_ACPI_STATUS(AE_OK);
    311      1.1  thorpej }
    312      1.1  thorpej 
    313      1.1  thorpej /*
    314      1.1  thorpej  * acpi_resource_print:
    315      1.1  thorpej  *
    316      1.1  thorpej  *	Print the resources assigned to a device.
    317      1.1  thorpej  */
    318      1.1  thorpej void
    319      1.1  thorpej acpi_resource_print(struct device *dev, struct acpi_resources *res)
    320      1.1  thorpej {
    321      1.1  thorpej 	const char *sep;
    322      1.1  thorpej 
    323      1.1  thorpej 	if (SIMPLEQ_EMPTY(&res->ar_io) &&
    324      1.1  thorpej 	    SIMPLEQ_EMPTY(&res->ar_iorange) &&
    325      1.1  thorpej 	    SIMPLEQ_EMPTY(&res->ar_mem) &&
    326      1.1  thorpej 	    SIMPLEQ_EMPTY(&res->ar_memrange) &&
    327      1.1  thorpej 	    SIMPLEQ_EMPTY(&res->ar_irq) &&
    328      1.1  thorpej 	    SIMPLEQ_EMPTY(&res->ar_drq))
    329      1.1  thorpej 		return;
    330      1.1  thorpej 
    331      1.1  thorpej 	printf("%s:", dev->dv_xname);
    332      1.1  thorpej 
    333      1.1  thorpej 	if (SIMPLEQ_EMPTY(&res->ar_io) == 0) {
    334      1.1  thorpej 		struct acpi_io *ar;
    335      1.1  thorpej 
    336      1.1  thorpej 		sep = "";
    337      1.1  thorpej 		printf(" io ");
    338      1.3    lukem 		SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) {
    339      1.1  thorpej 			printf("%s0x%x", sep, ar->ar_base);
    340      1.1  thorpej 			if (ar->ar_length > 1)
    341      1.1  thorpej 				printf("-0x%x", ar->ar_base +
    342      1.1  thorpej 				    ar->ar_length - 1);
    343      1.1  thorpej 			sep = ",";
    344      1.1  thorpej 		}
    345      1.1  thorpej 	}
    346      1.1  thorpej 
    347      1.1  thorpej 	/* XXX iorange */
    348      1.1  thorpej 
    349      1.1  thorpej 	if (SIMPLEQ_EMPTY(&res->ar_mem) == 0) {
    350      1.1  thorpej 		struct acpi_mem *ar;
    351      1.1  thorpej 
    352      1.1  thorpej 		sep = "";
    353      1.1  thorpej 		printf(" mem ");
    354      1.3    lukem 		SIMPLEQ_FOREACH(ar, &res->ar_mem, ar_list) {
    355      1.1  thorpej 			printf("%s0x%x", sep, ar->ar_base);
    356      1.1  thorpej 			if (ar->ar_length > 1)
    357      1.1  thorpej 				printf("-0x%x", ar->ar_base +
    358      1.1  thorpej 				    ar->ar_length - 1);
    359      1.1  thorpej 			sep = ",";
    360      1.1  thorpej 		}
    361      1.1  thorpej 	}
    362      1.1  thorpej 
    363      1.1  thorpej 	/* XXX memrange */
    364      1.1  thorpej 
    365      1.1  thorpej 	if (SIMPLEQ_EMPTY(&res->ar_irq) == 0) {
    366      1.1  thorpej 		struct acpi_irq *ar;
    367      1.1  thorpej 
    368      1.1  thorpej 		sep = "";
    369      1.1  thorpej 		printf(" irq ");
    370      1.3    lukem 		SIMPLEQ_FOREACH(ar, &res->ar_irq, ar_list) {
    371      1.1  thorpej 			printf("%s%d", sep, ar->ar_irq);
    372      1.1  thorpej 			sep = ",";
    373      1.1  thorpej 		}
    374      1.1  thorpej 	}
    375      1.1  thorpej 
    376      1.1  thorpej 	if (SIMPLEQ_EMPTY(&res->ar_drq) == 0) {
    377      1.1  thorpej 		struct acpi_drq *ar;
    378      1.1  thorpej 
    379      1.1  thorpej 		sep = "";
    380      1.1  thorpej 		printf(" drq ");
    381      1.3    lukem 		SIMPLEQ_FOREACH(ar, &res->ar_drq, ar_list) {
    382      1.1  thorpej 			printf("%s%d", sep, ar->ar_drq);
    383      1.1  thorpej 			sep = ",";
    384      1.1  thorpej 		}
    385      1.1  thorpej 	}
    386      1.1  thorpej 
    387      1.1  thorpej 	printf("\n");
    388      1.1  thorpej }
    389      1.1  thorpej 
    390  1.6.2.1    skrll /*
    391  1.6.2.1    skrll  * acpi_resource_cleanup:
    392  1.6.2.1    skrll  *
    393  1.6.2.1    skrll  *	Free all allocated buffers
    394  1.6.2.1    skrll  */
    395  1.6.2.1    skrll void
    396  1.6.2.1    skrll acpi_resource_cleanup(struct acpi_resources *res)
    397  1.6.2.1    skrll {
    398  1.6.2.1    skrll 	while (!SIMPLEQ_EMPTY(&res->ar_io)) {
    399  1.6.2.1    skrll 		struct acpi_io *ar;
    400  1.6.2.1    skrll 		ar = SIMPLEQ_FIRST(&res->ar_io);
    401  1.6.2.1    skrll 		SIMPLEQ_REMOVE_HEAD(&res->ar_io, ar_list);
    402  1.6.2.1    skrll 		AcpiOsFree(ar);
    403  1.6.2.1    skrll 	}
    404  1.6.2.1    skrll 
    405  1.6.2.1    skrll 	while (!SIMPLEQ_EMPTY(&res->ar_iorange)) {
    406  1.6.2.1    skrll 		struct acpi_iorange *ar;
    407  1.6.2.1    skrll 		ar = SIMPLEQ_FIRST(&res->ar_iorange);
    408  1.6.2.1    skrll 		SIMPLEQ_REMOVE_HEAD(&res->ar_iorange, ar_list);
    409  1.6.2.1    skrll 		AcpiOsFree(ar);
    410  1.6.2.1    skrll 	}
    411  1.6.2.1    skrll 
    412  1.6.2.1    skrll 	while (!SIMPLEQ_EMPTY(&res->ar_mem)) {
    413  1.6.2.1    skrll 		struct acpi_mem *ar;
    414  1.6.2.1    skrll 		ar = SIMPLEQ_FIRST(&res->ar_mem);
    415  1.6.2.1    skrll 		SIMPLEQ_REMOVE_HEAD(&res->ar_mem, ar_list);
    416  1.6.2.1    skrll 		AcpiOsFree(ar);
    417  1.6.2.1    skrll 	}
    418  1.6.2.1    skrll 
    419  1.6.2.1    skrll 	while (!SIMPLEQ_EMPTY(&res->ar_memrange)) {
    420  1.6.2.1    skrll 		struct acpi_memrange *ar;
    421  1.6.2.1    skrll 		ar = SIMPLEQ_FIRST(&res->ar_memrange);
    422  1.6.2.1    skrll 		SIMPLEQ_REMOVE_HEAD(&res->ar_memrange, ar_list);
    423  1.6.2.1    skrll 		AcpiOsFree(ar);
    424  1.6.2.1    skrll 	}
    425  1.6.2.1    skrll 
    426  1.6.2.1    skrll 	while (!SIMPLEQ_EMPTY(&res->ar_irq)) {
    427  1.6.2.1    skrll 		struct acpi_irq *ar;
    428  1.6.2.1    skrll 		ar = SIMPLEQ_FIRST(&res->ar_irq);
    429  1.6.2.1    skrll 		SIMPLEQ_REMOVE_HEAD(&res->ar_irq, ar_list);
    430  1.6.2.1    skrll 		AcpiOsFree(ar);
    431  1.6.2.1    skrll 	}
    432  1.6.2.1    skrll 
    433  1.6.2.1    skrll 	while (!SIMPLEQ_EMPTY(&res->ar_drq)) {
    434  1.6.2.1    skrll 		struct acpi_drq *ar;
    435  1.6.2.1    skrll 		ar = SIMPLEQ_FIRST(&res->ar_drq);
    436  1.6.2.1    skrll 		SIMPLEQ_REMOVE_HEAD(&res->ar_drq, ar_list);
    437  1.6.2.1    skrll 		AcpiOsFree(ar);
    438  1.6.2.1    skrll 	}
    439  1.6.2.1    skrll 
    440  1.6.2.1    skrll 	res->ar_nio = res->ar_niorange = res->ar_nmem =
    441  1.6.2.1    skrll 	    res->ar_nmemrange = res->ar_nirq = res->ar_ndrq = 0;
    442  1.6.2.1    skrll }
    443  1.6.2.1    skrll 
    444      1.1  thorpej struct acpi_io *
    445      1.1  thorpej acpi_res_io(struct acpi_resources *res, int idx)
    446      1.1  thorpej {
    447      1.1  thorpej 	struct acpi_io *ar;
    448      1.1  thorpej 
    449      1.1  thorpej 	SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) {
    450      1.1  thorpej 		if (ar->ar_index == idx)
    451  1.6.2.1    skrll 			return ar;
    452      1.1  thorpej 	}
    453  1.6.2.1    skrll 	return NULL;
    454      1.1  thorpej }
    455      1.1  thorpej 
    456      1.1  thorpej struct acpi_iorange *
    457      1.1  thorpej acpi_res_iorange(struct acpi_resources *res, int idx)
    458      1.1  thorpej {
    459      1.1  thorpej 	struct acpi_iorange *ar;
    460      1.1  thorpej 
    461      1.1  thorpej 	SIMPLEQ_FOREACH(ar, &res->ar_iorange, ar_list) {
    462      1.1  thorpej 		if (ar->ar_index == idx)
    463  1.6.2.1    skrll 			return ar;
    464      1.1  thorpej 	}
    465  1.6.2.1    skrll 	return NULL;
    466      1.1  thorpej }
    467      1.1  thorpej 
    468      1.1  thorpej struct acpi_mem *
    469      1.1  thorpej acpi_res_mem(struct acpi_resources *res, int idx)
    470      1.1  thorpej {
    471      1.1  thorpej 	struct acpi_mem *ar;
    472      1.1  thorpej 
    473      1.1  thorpej 	SIMPLEQ_FOREACH(ar, &res->ar_mem, ar_list) {
    474      1.1  thorpej 		if (ar->ar_index == idx)
    475  1.6.2.1    skrll 			return ar;
    476      1.1  thorpej 	}
    477  1.6.2.1    skrll 	return NULL;
    478      1.1  thorpej }
    479      1.1  thorpej 
    480      1.1  thorpej struct acpi_memrange *
    481      1.1  thorpej acpi_res_memrange(struct acpi_resources *res, int idx)
    482      1.1  thorpej {
    483      1.1  thorpej 	struct acpi_memrange *ar;
    484      1.1  thorpej 
    485      1.1  thorpej 	SIMPLEQ_FOREACH(ar, &res->ar_memrange, ar_list) {
    486      1.1  thorpej 		if (ar->ar_index == idx)
    487  1.6.2.1    skrll 			return ar;
    488      1.1  thorpej 	}
    489  1.6.2.1    skrll 	return NULL;
    490      1.1  thorpej }
    491      1.1  thorpej 
    492      1.1  thorpej struct acpi_irq *
    493      1.1  thorpej acpi_res_irq(struct acpi_resources *res, int idx)
    494      1.1  thorpej {
    495      1.1  thorpej 	struct acpi_irq *ar;
    496      1.1  thorpej 
    497      1.1  thorpej 	SIMPLEQ_FOREACH(ar, &res->ar_irq, ar_list) {
    498      1.1  thorpej 		if (ar->ar_index == idx)
    499  1.6.2.1    skrll 			return ar;
    500      1.1  thorpej 	}
    501  1.6.2.1    skrll 	return NULL;
    502      1.1  thorpej }
    503      1.1  thorpej 
    504      1.1  thorpej struct acpi_drq *
    505      1.1  thorpej acpi_res_drq(struct acpi_resources *res, int idx)
    506      1.1  thorpej {
    507      1.1  thorpej 	struct acpi_drq *ar;
    508      1.1  thorpej 
    509      1.1  thorpej 	SIMPLEQ_FOREACH(ar, &res->ar_drq, ar_list) {
    510      1.1  thorpej 		if (ar->ar_index == idx)
    511  1.6.2.1    skrll 			return ar;
    512      1.1  thorpej 	}
    513  1.6.2.1    skrll 	return NULL;
    514      1.1  thorpej }
    515      1.1  thorpej 
    516      1.1  thorpej /*****************************************************************************
    517      1.1  thorpej  * Default ACPI resource parse operations.
    518      1.1  thorpej  *****************************************************************************/
    519      1.1  thorpej 
    520      1.1  thorpej static void	acpi_res_parse_init(struct device *, void *, void **);
    521      1.1  thorpej static void	acpi_res_parse_fini(struct device *, void *);
    522      1.1  thorpej 
    523      1.1  thorpej static void	acpi_res_parse_ioport(struct device *, void *, uint32_t,
    524      1.1  thorpej 		    uint32_t);
    525      1.1  thorpej static void	acpi_res_parse_iorange(struct device *, void *, uint32_t,
    526      1.1  thorpej 		    uint32_t, uint32_t, uint32_t);
    527      1.1  thorpej 
    528      1.1  thorpej static void	acpi_res_parse_memory(struct device *, void *, uint32_t,
    529      1.1  thorpej 		    uint32_t);
    530      1.1  thorpej static void	acpi_res_parse_memrange(struct device *, void *, uint32_t,
    531      1.1  thorpej 		    uint32_t, uint32_t, uint32_t);
    532      1.1  thorpej 
    533      1.5     matt static void	acpi_res_parse_irq(struct device *, void *, uint32_t, uint32_t);
    534      1.1  thorpej static void	acpi_res_parse_drq(struct device *, void *, uint32_t);
    535      1.1  thorpej 
    536      1.1  thorpej static void	acpi_res_parse_start_dep(struct device *, void *, int);
    537      1.1  thorpej static void	acpi_res_parse_end_dep(struct device *, void *);
    538      1.1  thorpej 
    539      1.1  thorpej const struct acpi_resource_parse_ops acpi_resource_parse_ops_default = {
    540  1.6.2.1    skrll 	.init = acpi_res_parse_init,
    541  1.6.2.1    skrll 	.fini = acpi_res_parse_fini,
    542      1.1  thorpej 
    543  1.6.2.1    skrll 	.ioport = acpi_res_parse_ioport,
    544  1.6.2.1    skrll 	.iorange = acpi_res_parse_iorange,
    545      1.1  thorpej 
    546  1.6.2.1    skrll 	.memory = acpi_res_parse_memory,
    547  1.6.2.1    skrll 	.memrange = acpi_res_parse_memrange,
    548      1.1  thorpej 
    549  1.6.2.1    skrll 	.irq = acpi_res_parse_irq,
    550  1.6.2.1    skrll 	.drq = acpi_res_parse_drq,
    551      1.1  thorpej 
    552  1.6.2.1    skrll 	.start_dep = acpi_res_parse_start_dep,
    553  1.6.2.1    skrll 	.end_dep = acpi_res_parse_end_dep,
    554      1.1  thorpej };
    555      1.1  thorpej 
    556      1.1  thorpej static void
    557      1.1  thorpej acpi_res_parse_init(struct device *dev, void *arg, void **contextp)
    558      1.1  thorpej {
    559      1.1  thorpej 	struct acpi_resources *res = arg;
    560      1.1  thorpej 
    561      1.1  thorpej 	SIMPLEQ_INIT(&res->ar_io);
    562      1.1  thorpej 	res->ar_nio = 0;
    563      1.1  thorpej 
    564      1.1  thorpej 	SIMPLEQ_INIT(&res->ar_iorange);
    565      1.1  thorpej 	res->ar_niorange = 0;
    566      1.1  thorpej 
    567      1.1  thorpej 	SIMPLEQ_INIT(&res->ar_mem);
    568      1.1  thorpej 	res->ar_nmem = 0;
    569      1.1  thorpej 
    570      1.1  thorpej 	SIMPLEQ_INIT(&res->ar_memrange);
    571      1.1  thorpej 	res->ar_nmemrange = 0;
    572      1.1  thorpej 
    573      1.1  thorpej 	SIMPLEQ_INIT(&res->ar_irq);
    574      1.1  thorpej 	res->ar_nirq = 0;
    575      1.1  thorpej 
    576      1.1  thorpej 	SIMPLEQ_INIT(&res->ar_drq);
    577      1.1  thorpej 	res->ar_ndrq = 0;
    578      1.1  thorpej 
    579      1.1  thorpej 	*contextp = res;
    580      1.1  thorpej }
    581      1.1  thorpej 
    582      1.1  thorpej static void
    583      1.1  thorpej acpi_res_parse_fini(struct device *dev, void *context)
    584      1.1  thorpej {
    585      1.1  thorpej 	struct acpi_resources *res = context;
    586      1.1  thorpej 
    587      1.1  thorpej 	/* Print the resources we're using. */
    588      1.1  thorpej 	acpi_resource_print(dev, res);
    589      1.1  thorpej }
    590      1.1  thorpej 
    591      1.1  thorpej static void
    592      1.1  thorpej acpi_res_parse_ioport(struct device *dev, void *context, uint32_t base,
    593      1.1  thorpej     uint32_t length)
    594      1.1  thorpej {
    595      1.1  thorpej 	struct acpi_resources *res = context;
    596      1.1  thorpej 	struct acpi_io *ar;
    597      1.1  thorpej 
    598  1.6.2.1    skrll 	/*
    599  1.6.2.1    skrll 	 * Check if there is another I/O port directly below/under
    600  1.6.2.1    skrll 	 * this one.
    601  1.6.2.1    skrll 	 */
    602  1.6.2.1    skrll 	SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) {
    603  1.6.2.1    skrll 		if (ar->ar_base == base + length ) {
    604  1.6.2.1    skrll 			/*
    605  1.6.2.1    skrll 			 * Entry just below existing entry - adjust
    606  1.6.2.1    skrll 			 * the entry and return.
    607  1.6.2.1    skrll 			 */
    608  1.6.2.1    skrll 			ar->ar_base = base;
    609  1.6.2.1    skrll 			ar->ar_length += length;
    610  1.6.2.1    skrll 			return;
    611  1.6.2.1    skrll 		} else if (ar->ar_base + ar->ar_length == base) {
    612  1.6.2.1    skrll 			/*
    613  1.6.2.1    skrll 			 * Entry just above existing entry - adjust
    614  1.6.2.1    skrll 			 * the entry and return.
    615  1.6.2.1    skrll 			 */
    616  1.6.2.1    skrll 			ar->ar_length += length;
    617  1.6.2.1    skrll 			return;
    618  1.6.2.1    skrll 		}
    619  1.6.2.1    skrll 	}
    620  1.6.2.1    skrll 
    621      1.1  thorpej 	ar = AcpiOsAllocate(sizeof(*ar));
    622      1.1  thorpej 	if (ar == NULL) {
    623      1.1  thorpej 		printf("%s: ACPI: unable to allocate I/O resource %d\n",
    624      1.1  thorpej 		    dev->dv_xname, res->ar_nio);
    625      1.1  thorpej 		res->ar_nio++;
    626      1.1  thorpej 		return;
    627      1.1  thorpej 	}
    628      1.1  thorpej 
    629      1.1  thorpej 	ar->ar_index = res->ar_nio++;
    630      1.1  thorpej 	ar->ar_base = base;
    631      1.1  thorpej 	ar->ar_length = length;
    632      1.1  thorpej 
    633      1.1  thorpej 	SIMPLEQ_INSERT_TAIL(&res->ar_io, ar, ar_list);
    634      1.1  thorpej }
    635      1.1  thorpej 
    636      1.1  thorpej static void
    637      1.1  thorpej acpi_res_parse_iorange(struct device *dev, void *context, uint32_t low,
    638      1.1  thorpej     uint32_t high, uint32_t length, uint32_t align)
    639      1.1  thorpej {
    640      1.1  thorpej 	struct acpi_resources *res = context;
    641      1.1  thorpej 	struct acpi_iorange *ar;
    642      1.1  thorpej 
    643      1.1  thorpej 	ar = AcpiOsAllocate(sizeof(*ar));
    644      1.1  thorpej 	if (ar == NULL) {
    645      1.1  thorpej 		printf("%s: ACPI: unable to allocate I/O range resource %d\n",
    646      1.1  thorpej 		    dev->dv_xname, res->ar_niorange);
    647      1.1  thorpej 		res->ar_niorange++;
    648      1.1  thorpej 		return;
    649      1.1  thorpej 	}
    650      1.1  thorpej 
    651      1.1  thorpej 	ar->ar_index = res->ar_niorange++;
    652      1.1  thorpej 	ar->ar_low = low;
    653      1.1  thorpej 	ar->ar_high = high;
    654      1.1  thorpej 	ar->ar_length = length;
    655      1.1  thorpej 	ar->ar_align = align;
    656      1.1  thorpej 
    657      1.1  thorpej 	SIMPLEQ_INSERT_TAIL(&res->ar_iorange, ar, ar_list);
    658      1.1  thorpej }
    659      1.1  thorpej 
    660      1.1  thorpej static void
    661      1.1  thorpej acpi_res_parse_memory(struct device *dev, void *context, uint32_t base,
    662      1.1  thorpej     uint32_t length)
    663      1.1  thorpej {
    664      1.1  thorpej 	struct acpi_resources *res = context;
    665      1.1  thorpej 	struct acpi_mem *ar;
    666      1.1  thorpej 
    667      1.1  thorpej 	ar = AcpiOsAllocate(sizeof(*ar));
    668      1.1  thorpej 	if (ar == NULL) {
    669      1.1  thorpej 		printf("%s: ACPI: unable to allocate Memory resource %d\n",
    670      1.1  thorpej 		    dev->dv_xname, res->ar_nmem);
    671      1.1  thorpej 		res->ar_nmem++;
    672      1.1  thorpej 		return;
    673      1.1  thorpej 	}
    674      1.1  thorpej 
    675      1.1  thorpej 	ar->ar_index = res->ar_nmem++;
    676      1.1  thorpej 	ar->ar_base = base;
    677      1.1  thorpej 	ar->ar_length = length;
    678      1.1  thorpej 
    679      1.1  thorpej 	SIMPLEQ_INSERT_TAIL(&res->ar_mem, ar, ar_list);
    680      1.1  thorpej }
    681      1.1  thorpej 
    682      1.1  thorpej static void
    683      1.1  thorpej acpi_res_parse_memrange(struct device *dev, void *context, uint32_t low,
    684      1.1  thorpej     uint32_t high, uint32_t length, uint32_t align)
    685      1.1  thorpej {
    686      1.1  thorpej 	struct acpi_resources *res = context;
    687      1.1  thorpej 	struct acpi_memrange *ar;
    688      1.1  thorpej 
    689      1.1  thorpej 	ar = AcpiOsAllocate(sizeof(*ar));
    690      1.1  thorpej 	if (ar == NULL) {
    691      1.1  thorpej 		printf("%s: ACPI: unable to allocate Memory range resource "
    692      1.1  thorpej 		    "%d\n", dev->dv_xname, res->ar_nmemrange);
    693      1.1  thorpej 		res->ar_nmemrange++;
    694      1.1  thorpej 		return;
    695      1.1  thorpej 	}
    696      1.1  thorpej 
    697      1.1  thorpej 	ar->ar_index = res->ar_nmemrange++;
    698      1.1  thorpej 	ar->ar_low = low;
    699      1.1  thorpej 	ar->ar_high = high;
    700      1.1  thorpej 	ar->ar_length = length;
    701      1.1  thorpej 	ar->ar_align = align;
    702      1.1  thorpej 
    703      1.1  thorpej 	SIMPLEQ_INSERT_TAIL(&res->ar_memrange, ar, ar_list);
    704      1.1  thorpej }
    705      1.1  thorpej 
    706      1.1  thorpej static void
    707      1.5     matt acpi_res_parse_irq(struct device *dev, void *context, uint32_t irq, uint32_t type)
    708      1.1  thorpej {
    709      1.1  thorpej 	struct acpi_resources *res = context;
    710      1.1  thorpej 	struct acpi_irq *ar;
    711      1.1  thorpej 
    712      1.1  thorpej 	ar = AcpiOsAllocate(sizeof(*ar));
    713      1.1  thorpej 	if (ar == NULL) {
    714      1.1  thorpej 		printf("%s: ACPI: unable to allocate IRQ resource %d\n",
    715      1.1  thorpej 		    dev->dv_xname, res->ar_nirq);
    716      1.1  thorpej 		res->ar_nirq++;
    717      1.1  thorpej 		return;
    718      1.1  thorpej 	}
    719      1.1  thorpej 
    720      1.1  thorpej 	ar->ar_index = res->ar_nirq++;
    721      1.1  thorpej 	ar->ar_irq = irq;
    722      1.5     matt 	ar->ar_type = type;
    723      1.1  thorpej 
    724      1.1  thorpej 	SIMPLEQ_INSERT_TAIL(&res->ar_irq, ar, ar_list);
    725      1.1  thorpej }
    726      1.1  thorpej 
    727      1.1  thorpej static void
    728      1.1  thorpej acpi_res_parse_drq(struct device *dev, void *context, uint32_t drq)
    729      1.1  thorpej {
    730      1.1  thorpej 	struct acpi_resources *res = context;
    731      1.1  thorpej 	struct acpi_drq *ar;
    732      1.1  thorpej 
    733      1.1  thorpej 	ar = AcpiOsAllocate(sizeof(*ar));
    734      1.1  thorpej 	if (ar == NULL) {
    735      1.1  thorpej 		printf("%s: ACPI: unable to allocate DRQ resource %d\n",
    736      1.1  thorpej 		    dev->dv_xname, res->ar_ndrq);
    737      1.1  thorpej 		res->ar_ndrq++;
    738      1.1  thorpej 		return;
    739      1.1  thorpej 	}
    740      1.1  thorpej 
    741      1.1  thorpej 	ar->ar_index = res->ar_ndrq++;
    742      1.1  thorpej 	ar->ar_drq = drq;
    743      1.1  thorpej 
    744      1.1  thorpej 	SIMPLEQ_INSERT_TAIL(&res->ar_drq, ar, ar_list);
    745      1.1  thorpej }
    746      1.1  thorpej 
    747      1.1  thorpej static void
    748      1.1  thorpej acpi_res_parse_start_dep(struct device *dev, void *context, int preference)
    749      1.1  thorpej {
    750  1.6.2.1    skrll 
    751      1.1  thorpej 	printf("%s: ACPI: dependant functions not supported\n",
    752      1.1  thorpej 	    dev->dv_xname);
    753      1.1  thorpej }
    754      1.1  thorpej 
    755      1.1  thorpej static void
    756      1.1  thorpej acpi_res_parse_end_dep(struct device *dev, void *context)
    757      1.1  thorpej {
    758      1.1  thorpej 
    759      1.1  thorpej 	/* Nothing to do. */
    760      1.1  thorpej }
    761