Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys change acpi_resource_parse API to support _PRS parsing a...
details: https://anonhg.NetBSD.org/src/rev/f3c91c9826ab
branches: trunk
changeset: 565531:f3c91c9826ab
user: kochi <kochi%NetBSD.org@localhost>
date: Sun Apr 11 08:36:19 2004 +0000
description:
change acpi_resource_parse API to support _PRS parsing as well as _CRS
diffstat:
sys/arch/i386/acpi/npx_acpi.c | 8 +-
sys/arch/i386/acpi/spic_acpi.c | 8 +-
sys/dev/acpi/acpi_ec.c | 8 +-
sys/dev/acpi/acpi_resource.c | 379 ++++++++++++++++++++--------------------
sys/dev/acpi/acpivar.h | 4 +-
sys/dev/acpi/com_acpi.c | 8 +-
sys/dev/acpi/fdc_acpi.c | 8 +-
sys/dev/acpi/lpt_acpi.c | 8 +-
sys/dev/acpi/pckbc_acpi.c | 8 +-
9 files changed, 220 insertions(+), 219 deletions(-)
diffs (truncated from 639 to 300 lines):
diff -r 50467950d352 -r f3c91c9826ab sys/arch/i386/acpi/npx_acpi.c
--- a/sys/arch/i386/acpi/npx_acpi.c Sun Apr 11 06:52:38 2004 +0000
+++ b/sys/arch/i386/acpi/npx_acpi.c Sun Apr 11 08:36:19 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npx_acpi.c,v 1.6 2004/04/10 11:50:55 kochi Exp $ */
+/* $NetBSD: npx_acpi.c,v 1.7 2004/04/11 08:36:45 kochi Exp $ */
/*
* Copyright (c) 2002 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npx_acpi.c,v 1.6 2004/04/10 11:50:55 kochi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npx_acpi.c,v 1.7 2004/04/11 08:36:45 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -91,8 +91,8 @@
printf("\n");
/* parse resources */
- rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node, &res,
- &acpi_resource_parse_ops_default);
+ rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
+ &res, &acpi_resource_parse_ops_default);
if (ACPI_FAILURE(rv))
return;
diff -r 50467950d352 -r f3c91c9826ab sys/arch/i386/acpi/spic_acpi.c
--- a/sys/arch/i386/acpi/spic_acpi.c Sun Apr 11 06:52:38 2004 +0000
+++ b/sys/arch/i386/acpi/spic_acpi.c Sun Apr 11 08:36:19 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spic_acpi.c,v 1.9 2003/11/03 18:07:10 mycroft Exp $ */
+/* $NetBSD: spic_acpi.c,v 1.10 2004/04/11 08:36:45 kochi Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.9 2003/11/03 18:07:10 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.10 2004/04/11 08:36:45 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -100,8 +100,8 @@
sc->sc_node = aa->aa_node;
/* Parse our resources. */
- rv = acpi_resource_parse(&sc->sc_spic.sc_dev, sc->sc_node, &sc->sc_res,
- &acpi_resource_parse_ops_default);
+ rv = acpi_resource_parse(&sc->sc_spic.sc_dev, sc->sc_node->ad_handle,
+ "_CRS", &sc->sc_res, &acpi_resource_parse_ops_default);
if (ACPI_FAILURE(rv))
return;
diff -r 50467950d352 -r f3c91c9826ab sys/dev/acpi/acpi_ec.c
--- a/sys/dev/acpi/acpi_ec.c Sun Apr 11 06:52:38 2004 +0000
+++ b/sys/dev/acpi/acpi_ec.c Sun Apr 11 08:36:19 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_ec.c,v 1.25 2004/04/11 06:48:25 kochi Exp $ */
+/* $NetBSD: acpi_ec.c,v 1.26 2004/04/11 08:36:19 kochi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -172,7 +172,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.25 2004/04/11 06:48:25 kochi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.26 2004/04/11 08:36:19 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -494,8 +494,8 @@
/* Parse our resources. */
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "parsing EC resources\n"));
- rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node, &sc->sc_res,
- &acpi_resource_parse_ops_default);
+ rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
+ &sc->sc_res, &acpi_resource_parse_ops_default);
if (ACPI_FAILURE(rv))
return;
diff -r 50467950d352 -r f3c91c9826ab sys/dev/acpi/acpi_resource.c
--- a/sys/dev/acpi/acpi_resource.c Sun Apr 11 06:52:38 2004 +0000
+++ b/sys/dev/acpi/acpi_resource.c Sun Apr 11 08:36:19 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_resource.c,v 1.11 2004/04/11 06:48:25 kochi Exp $ */
+/* $NetBSD: acpi_resource.c,v 1.12 2004/04/11 08:36:19 kochi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.11 2004/04/11 06:48:25 kochi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.12 2004/04/11 08:36:19 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -80,211 +80,212 @@
#define _COMPONENT ACPI_RESOURCE_COMPONENT
ACPI_MODULE_NAME("RESOURCE")
+struct resource_parse_callback_arg {
+ const struct acpi_resource_parse_ops *ops;
+ struct device *dev;
+ void *context;
+};
+
+static ACPI_STATUS
+acpi_resource_parse_callback(ACPI_RESOURCE *res, void *context)
+{
+ struct resource_parse_callback_arg *arg = context;
+ const struct acpi_resource_parse_ops *ops;
+ int i;
+
+ ops = arg->ops;
+
+ switch (res->Id) {
+ case ACPI_RSTYPE_FIXED_IO:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "FixedIo 0x%x/%d\n",
+ res->Data.FixedIo.BaseAddress,
+ res->Data.FixedIo.RangeLength));
+ (*ops->ioport)(arg->dev, arg->context,
+ res->Data.FixedIo.BaseAddress,
+ res->Data.FixedIo.RangeLength);
+ break;
+
+ case ACPI_RSTYPE_IO:
+ if (res->Data.Io.MinBaseAddress ==
+ res->Data.Io.MaxBaseAddress) {
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Io 0x%x/%d\n",
+ res->Data.Io.MinBaseAddress,
+ res->Data.Io.RangeLength));
+ (*ops->ioport)(arg->dev, arg->context,
+ res->Data.Io.MinBaseAddress,
+ res->Data.Io.RangeLength);
+ } else {
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Io 0x%x-0x%x/%d\n",
+ res->Data.Io.MinBaseAddress,
+ res->Data.Io.MaxBaseAddress,
+ res->Data.Io.RangeLength));
+ (*ops->iorange)(arg->dev, arg->context,
+ res->Data.Io.MinBaseAddress,
+ res->Data.Io.MaxBaseAddress,
+ res->Data.Io.RangeLength,
+ res->Data.Io.Alignment);
+ }
+ break;
+
+ case ACPI_RSTYPE_FIXED_MEM32:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "FixedMemory32 0x%x/%d\n",
+ res->Data.FixedMemory32.RangeBaseAddress,
+ res->Data.FixedMemory32.RangeLength));
+ (*ops->memory)(arg->dev, arg->context,
+ res->Data.FixedMemory32.RangeBaseAddress,
+ res->Data.FixedMemory32.RangeLength);
+ break;
+
+ case ACPI_RSTYPE_MEM32:
+ if (res->Data.Memory32.MinBaseAddress ==
+ res->Data.Memory32.MaxBaseAddress) {
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Memory32 0x%x/%d\n",
+ res->Data.Memory32.MinBaseAddress,
+ res->Data.Memory32.RangeLength));
+ (*ops->memory)(arg->dev, arg->context,
+ res->Data.Memory32.MinBaseAddress,
+ res->Data.Memory32.RangeLength);
+ } else {
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Memory32 0x%x-0x%x/%d\n",
+ res->Data.Memory32.MinBaseAddress,
+ res->Data.Memory32.MaxBaseAddress,
+ res->Data.Memory32.RangeLength));
+ (*ops->memrange)(arg->dev, arg->context,
+ res->Data.Memory32.MinBaseAddress,
+ res->Data.Memory32.MaxBaseAddress,
+ res->Data.Memory32.RangeLength,
+ res->Data.Memory32.Alignment);
+ }
+ break;
+
+ case ACPI_RSTYPE_MEM24:
+ if (res->Data.Memory24.MinBaseAddress ==
+ res->Data.Memory24.MaxBaseAddress) {
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Memory24 0x%x/%d\n",
+ res->Data.Memory24.MinBaseAddress,
+ res->Data.Memory24.RangeLength));
+ (*ops->memory)(arg->dev, arg->context,
+ res->Data.Memory24.MinBaseAddress,
+ res->Data.Memory24.RangeLength);
+ } else {
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Memory24 0x%x-0x%x/%d\n",
+ res->Data.Memory24.MinBaseAddress,
+ res->Data.Memory24.MaxBaseAddress,
+ res->Data.Memory24.RangeLength));
+ (*ops->memrange)(arg->dev, arg->context,
+ res->Data.Memory24.MinBaseAddress,
+ res->Data.Memory24.MaxBaseAddress,
+ res->Data.Memory24.RangeLength,
+ res->Data.Memory24.Alignment);
+ }
+ break;
+
+ case ACPI_RSTYPE_IRQ:
+ for (i = 0; i < res->Data.Irq.NumberOfInterrupts; i++) {
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "IRQ %d\n",
+ res->Data.Irq.Interrupts[i]));
+ (*ops->irq)(arg->dev, arg->context,
+ res->Data.Irq.Interrupts[i],
+ res->Data.Irq.EdgeLevel);
+ }
+ break;
+
+ case ACPI_RSTYPE_DMA:
+ for (i = 0; i < res->Data.Dma.NumberOfChannels; i++) {
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "DRQ %d\n",
+ res->Data.Dma.Channels[i]));
+ (*ops->drq)(arg->dev, arg->context,
+ res->Data.Dma.Channels[i]);
+ }
+ break;
+
+ case ACPI_RSTYPE_START_DPF:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Start dependant functions: %d\n",
+ res->Data.StartDpf.CompatibilityPriority));
+ (*ops->start_dep)(arg->dev, arg->context,
+ res->Data.StartDpf.CompatibilityPriority);
+ break;
+
+ case ACPI_RSTYPE_END_DPF:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "End dependant functions\n"));
+ (*ops->end_dep)(arg->dev, arg->context);
+
+ case ACPI_RSTYPE_ADDRESS32:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Address32 unimplemented\n"));
+ break;
+
+ case ACPI_RSTYPE_ADDRESS16:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Address16 unimplemented\n"));
+ break;
+
+ case ACPI_RSTYPE_EXT_IRQ:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "ExtendedIrq unimplemented\n"));
+ break;
+
+ case ACPI_RSTYPE_VENDOR:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "VendorSpecific unimplemented\n"));
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+ "Unknown resource type: %d\n", res->Id));
+ break;
+ }
+
+ return AE_OK;
+}
+
+
/*
* acpi_resource_parse:
*
* Parse a device node's resources and fill them in for the
* client.
*
+ * This API supports _CRS (current resources) and
+ * _PRS (possible resources).
+ *
* Note that it might be nice to also locate ACPI-specific resource
* items, such as GPE bits.
*/
ACPI_STATUS
-acpi_resource_parse(struct device *dev, struct acpi_devnode *ad,
+acpi_resource_parse(struct device *dev, ACPI_HANDLE handle, char *path,
void *arg, const struct acpi_resource_parse_ops *ops)
{
- ACPI_BUFFER buf;
- ACPI_RESOURCE *res;
Home |
Main Index |
Thread Index |
Old Index