summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_resource.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-12-08 09:16:20 +0000
committermsmith <msmith@FreeBSD.org>2000-12-08 09:16:20 +0000
commit3d96e58d420f86cc9ab2fab8c58a17921833e586 (patch)
tree13559703e4a964e10c5a092763cd63d3b6d8de56 /sys/dev/acpica/acpi_resource.c
parent601ec8e1853accdb6afea835eff3e1a5d42b2390 (diff)
downloadFreeBSD-src-3d96e58d420f86cc9ab2fab8c58a17921833e586.zip
FreeBSD-src-3d96e58d420f86cc9ab2fab8c58a17921833e586.tar.gz
- Convert a lot of homebrew debugging output to use the ACPI CA debugging
infrastructure. It's not perfect, but it's a lot better than what we've been using so far. The following rules apply to this: o BSD component names should be capitalised o Layer names should be taken from the non-CA set for now. We may elect to add some new BSD-specific layers later. - Make it possible to turn off selective debugging flags or layers by listing them in debug.acpi.layer or debug.acpi.level prefixed with !. - Fully implement support for avoiding nodes in the ACPI namespace. Nodes may be listed in the debug.acpi.avoid environment variable; these nodes and all their children will be ignored (although still scanned over) by ACPI functions which scan the namespace. Multiple nodes can be specified, separated by whitespace. - Implement support for selectively disabling ACPI subsystem components via the debug.acpi.disable environment variable. The following components can be disabled: o bus creation/scanning of the ACPI 'bus' o children attachment of children to the ACPI 'bus' o button the acpi_button control-method button driver o ec the acpi_ec embedded-controller driver o isa acpi replacement of PnP BIOS for ISA device discovery o lid the control-method lid switch driver o pci pci root-bus discovery o processor CPU power/speed management o thermal system temperature detection and control o timer ACPI timecounter Multiple components may be disabled by specifying their name(s) separated by whitespace. - Add support for ioctl registration. ACPI subsystem components may register ioctl handlers with the /dev/acpi generic ioctl handler, allowing us to avoid the need for a multitude of /dev/acpi* control devices, etc.
Diffstat (limited to 'sys/dev/acpica/acpi_resource.c')
-rw-r--r--sys/dev/acpica/acpi_resource.c89
1 files changed, 34 insertions, 55 deletions
diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c
index 3581ff7..6b848bc 100644
--- a/sys/dev/acpica/acpi_resource.c
+++ b/sys/dev/acpica/acpi_resource.c
@@ -39,6 +39,12 @@
#include <dev/acpica/acpivar.h>
/*
+ * Hooks for the ACPI CA debugging infrastructure
+ */
+#define _COMPONENT BUS_MANAGER
+MODULE_NAME("RESOURCE")
+
+/*
* Fetch a device's resources and associate them with the device.
*
* Note that it might be nice to also locate ACPI-specific resource items, such
@@ -54,18 +60,17 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resourc
int i;
void *context;
+ FUNCTION_TRACE(__FUNCTION__);
+
/*
* Fetch the device resources
*/
if (((status = acpi_GetIntoBuffer(handle, AcpiGetPossibleResources, &buf)) != AE_OK) &&
((status = acpi_GetIntoBuffer(handle, AcpiGetCurrentResources, &buf)) != AE_OK)) {
device_printf(dev, "can't fetch ACPI resources - %s\n", acpi_strerror(status));
- return(status);
+ return_ACPI_STATUS(status);
}
-
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "got %d bytes of resources\n", buf.Length);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("got %d bytes of resources\n", buf.Length));
set->set_init(dev, &context);
/*
@@ -82,56 +87,42 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resourc
*/
switch(res->Id) {
case EndTag:
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "EndTag\n");
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("EndTag\n"));
curr = last;
break;
case FixedIo:
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "FixedIo 0x%x/%d\n", res->Data.FixedIo.BaseAddress, res->Data.FixedIo.RangeLength);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("FixedIo 0x%x/%d\n", res->Data.FixedIo.BaseAddress, res->Data.FixedIo.RangeLength));
set->set_ioport(dev, context, res->Data.FixedIo.BaseAddress, res->Data.FixedIo.RangeLength);
break;
case Io:
if (res->Data.Io.MinBaseAddress == res->Data.Io.MaxBaseAddress) {
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "Io 0x%x/%d\n", res->Data.Io.MinBaseAddress, res->Data.Io.RangeLength);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("Io 0x%x/%d\n", res->Data.Io.MinBaseAddress, res->Data.Io.RangeLength));
set->set_ioport(dev, context, res->Data.Io.MinBaseAddress, res->Data.Io.RangeLength);
} else {
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "Io 0x%x-0x%x/%d\n", res->Data.Io.MinBaseAddress, res->Data.Io.MaxBaseAddress,
- res->Data.Io.RangeLength);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("Io 0x%x-0x%x/%d\n", res->Data.Io.MinBaseAddress, res->Data.Io.MaxBaseAddress,
+ res->Data.Io.RangeLength));
set->set_iorange(dev, context, res->Data.Io.MinBaseAddress, res->Data.Io.MaxBaseAddress,
res->Data.Io.RangeLength, res->Data.Io.Alignment);
}
break;
case FixedMemory32:
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "FixedMemory32 0x%x/%d\n", res->Data.FixedMemory32.RangeBaseAddress,
- res->Data.FixedMemory32.RangeLength);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("FixedMemory32 0x%x/%d\n", res->Data.FixedMemory32.RangeBaseAddress,
+ res->Data.FixedMemory32.RangeLength));
set->set_memory(dev, context, res->Data.FixedMemory32.RangeBaseAddress,
res->Data.FixedMemory32.RangeLength);
break;
case Memory32:
if (res->Data.Memory32.MinBaseAddress == res->Data.Memory32.MaxBaseAddress) {
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "Memory32 0x%x/%d\n", res->Data.Memory32.MinBaseAddress,
- res->Data.Memory32.RangeLength);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("Memory32 0x%x/%d\n", res->Data.Memory32.MinBaseAddress,
+ res->Data.Memory32.RangeLength));
set->set_memory(dev, context, res->Data.Memory32.MinBaseAddress, res->Data.Memory32.RangeLength);
} else {
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "Memory32 0x%x-0x%x/%d\n", res->Data.Memory32.MinBaseAddress,
- res->Data.Memory32.MaxBaseAddress, res->Data.Memory32.RangeLength);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("Memory32 0x%x-0x%x/%d\n", res->Data.Memory32.MinBaseAddress,
+ res->Data.Memory32.MaxBaseAddress, res->Data.Memory32.RangeLength));
set->set_memoryrange(dev, context, res->Data.Memory32.MinBaseAddress, res->Data.Memory32.MaxBaseAddress,
res->Data.Memory32.RangeLength, res->Data.Memory32.Alignment);
}
@@ -139,16 +130,12 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resourc
case Memory24:
if (res->Data.Memory24.MinBaseAddress == res->Data.Memory24.MaxBaseAddress) {
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "Memory24 0x%x/%d\n", res->Data.Memory24.MinBaseAddress,
- res->Data.Memory24.RangeLength);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("Memory24 0x%x/%d\n", res->Data.Memory24.MinBaseAddress,
+ res->Data.Memory24.RangeLength));
set->set_memory(dev, context, res->Data.Memory24.MinBaseAddress, res->Data.Memory24.RangeLength);
} else {
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "Memory24 0x%x-0x%x/%d\n", res->Data.Memory24.MinBaseAddress,
- res->Data.Memory24.MaxBaseAddress, res->Data.Memory24.RangeLength);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("Memory24 0x%x-0x%x/%d\n", res->Data.Memory24.MinBaseAddress,
+ res->Data.Memory24.MaxBaseAddress, res->Data.Memory24.RangeLength));
set->set_memoryrange(dev, context, res->Data.Memory24.MinBaseAddress, res->Data.Memory24.MaxBaseAddress,
res->Data.Memory24.RangeLength, res->Data.Memory24.Alignment);
}
@@ -156,50 +143,42 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resourc
case Irq:
for (i = 0; i < res->Data.Irq.NumberOfInterrupts; i++) {
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "Irq %d\n", res->Data.Irq.Interrupts[i]);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("Irq %d\n", res->Data.Irq.Interrupts[i]));
set->set_irq(dev, context, res->Data.Irq.Interrupts[i]);
}
break;
case Dma:
for (i = 0; i < res->Data.Dma.NumberOfChannels; i++) {
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "Drq %d\n", res->Data.Dma.Channels[i]);
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("Drq %d\n", res->Data.Dma.Channels[i]));
set->set_drq(dev, context, res->Data.Dma.Channels[i]);
}
break;
case StartDependentFunctions:
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "start dependant functions");
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("start dependant functions"));
set->set_start_dependant(dev, context, res->Data.StartDependentFunctions.CompatibilityPriority);
break;
case EndDependentFunctions:
-#ifdef ACPI_RES_DEBUG
- device_printf(dev, "end dependant functions");
-#endif
+ DEBUG_PRINT(TRACE_RESOURCES, ("end dependant functions"));
set->set_end_dependant(dev, context);
break;
case Address32:
- device_printf(dev, "unimplemented Address32 resource\n");
+ DEBUG_PRINT(TRACE_RESOURCES, ("unimplemented Address32 resource\n"));
break;
case Address16:
- device_printf(dev, "unimplemented Address16 resource\n");
+ DEBUG_PRINT(TRACE_RESOURCES, ("unimplemented Address16 resource\n"));
break;
case ExtendedIrq:
- device_printf(dev, "unimplemented ExtendedIrq resource\n");
+ DEBUG_PRINT(TRACE_RESOURCES, ("unimplemented ExtendedIrq resource\n"));
break;
case VendorSpecific:
- device_printf(dev, "unimplemented VendorSpecific resource\n");
+ DEBUG_PRINT(TRACE_RESOURCES, ("unimplemented VendorSpecific resource\n"));
break;
default:
break;
@@ -207,7 +186,7 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resourc
}
AcpiOsFree(buf.Pointer);
set->set_done(dev, context);
- return(AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
static void acpi_res_set_init(device_t dev, void **context);
OpenPOWER on IntegriCloud