From 11e32a567a0e92a26d2226c8ca28478ca8f1135b Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Mon, 4 May 2009 15:10:03 +0400 Subject: [PATCH] ACPI perf: provide debugging statements to diagnose attachment problems Signed-off-by: Eygene Ryabinkin --- sys/dev/acpica/acpi.c | 1 + sys/dev/acpica/acpi_cpu.c | 2 ++ sys/dev/acpica/acpi_perf.c | 28 ++++++++++++++++++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index d79b413..669de02 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1742,6 +1742,7 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status) * At least \_SB and \_TZ are detected as devices (ACPI-CA bug?) */ handle_str = acpi_name(handle); + device_printf(bus, "Working with child '%s'\n", handle_str); for (search = scopes; *search != NULL; search++) { if (strcmp(handle_str, *search) == 0) break; diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index a65faee..283a8bb 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -214,6 +214,7 @@ acpi_cpu_probe(device_t dev) return (ENXIO); handle = acpi_get_handle(dev); + device_printf(dev, "Going to probe CPU %s\n", acpi_name(handle)); if (cpu_softc == NULL) cpu_softc = malloc(sizeof(struct acpi_cpu_softc *) * (mp_maxid + 1), M_TEMP /* XXX */, M_WAITOK | M_ZERO); @@ -240,6 +241,7 @@ acpi_cpu_probe(device_t dev) * in their Processor object as the ProcId values in the MADT. */ acpi_id = obj->Processor.ProcId; + device_printf(dev, "ACPI ProcId = %d\n", acpi_id); AcpiOsFree(obj); if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0) return (ENXIO); diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c index e517ad3..87860a8 100644 --- a/sys/dev/acpica/acpi_perf.c +++ b/sys/dev/acpica/acpi_perf.c @@ -139,6 +139,7 @@ MALLOC_DEFINE(M_ACPIPERF, "acpi_perf", "ACPI Performance states"); static void acpi_perf_identify(driver_t *driver, device_t parent) { + ACPI_STATUS status; ACPI_HANDLE handle; device_t dev; @@ -150,8 +151,14 @@ acpi_perf_identify(driver_t *driver, device_t parent) handle = acpi_get_handle(parent); if (handle == NULL) return; - if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_PSS", NULL, NULL))) + if (ACPI_FAILURE(status = + AcpiEvaluateObject(handle, "_PSS", NULL, NULL))) { + device_printf(parent, + "%s: ACPI_FAILURE(evaluate _PSS for %s): %s\n", + __func__, acpi_name(handle), AcpiFormatException(status)); + return; + } /* * Add a child to every CPU that has the right methods. In future @@ -168,6 +175,7 @@ acpi_perf_identify(driver_t *driver, device_t parent) static int acpi_perf_probe(device_t dev) { + ACPI_STATUS status; ACPI_HANDLE handle; ACPI_OBJECT *pkg; struct resource *res; @@ -186,8 +194,12 @@ acpi_perf_probe(device_t dev) handle = acpi_get_handle(dev); buf.Pointer = NULL; buf.Length = ACPI_ALLOCATE_BUFFER; - if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_PCT", NULL, &buf))) + if (ACPI_FAILURE(status = + AcpiEvaluateObject(handle, "_PCT", NULL, &buf))) { + device_printf(dev, "%s: failed to evaluate _PCT: %s\n", + __func__, AcpiFormatException(status)); return (error); + } pkg = (ACPI_OBJECT *)buf.Pointer; if (ACPI_PKG_VALID(pkg, 2)) { rid = 0; @@ -253,8 +265,11 @@ acpi_perf_evaluate(device_t dev) buf.Pointer = NULL; buf.Length = ACPI_ALLOCATE_BUFFER; status = AcpiEvaluateObject(sc->handle, "_PSS", NULL, &buf); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)) { + device_printf(dev, "%s: failed to evaluate _PSS: %s\n", + __func__, AcpiFormatException(status)); return (ENXIO); + } pkg = (ACPI_OBJECT *)buf.Pointer; if (!ACPI_PKG_VALID(pkg, 1)) { @@ -429,14 +444,19 @@ acpi_px_available(struct acpi_perf_softc *sc) /* If the old state is too high, set current state to the new max. */ if (ACPI_SUCCESS(status)) { + device_printf(sc->dev, "Max P-state is %d\n", + sc->px_max_avail); if (sc->px_curr_state != CPUFREQ_VAL_UNKNOWN && sc->px_curr_state > sc->px_max_avail) { acpi_px_to_set(sc->dev, &sc->px_states[sc->px_max_avail], &set); acpi_px_set(sc->dev, &set); } - } else + } else { + device_printf(sc->dev, "Failed to get max P-state (_PPC): %s\n", + AcpiFormatException(status)); sc->px_max_avail = 0; + } } static int -- 1.6.2.4