Date: Fri, 11 Aug 2006 11:47:26 +0900 From: Ganbold <ganbold@micom.mng.net> To: freebsd-acpi@freebsd.org Subject: KTR support for ACPI debug messages Message-ID: <44DBEFBE.3070100@micom.mng.net>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------070402020607080007080209 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, Am I doing something wrong in attached patch? It is against latest RELENG_6. If it is correct and trivial I will try for rest of files. Is /usr/src/sys/dev/acpica correct place for ACPI? My laptop's (Dell D620) suspend/resume is not working and I really want to make it work and I thought I could help a little bit if my knowledge is enough for such things. thanks a lot, Ganbold --------------070402020607080007080209 Content-Type: text/x-patch; name="acpi.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="acpi.c.patch" --- /usr/home/tsgan/acpica/acpi.c Sat Aug 5 19:58:46 2006 +++ acpi.c Fri Aug 11 11:26:00 2006 @@ -47,6 +47,7 @@ #include <sys/power.h> #include <sys/sbuf.h> #include <sys/smp.h> +#include <sys/ktr.h> #include <machine/resource.h> #include <machine/bus.h> @@ -254,7 +255,7 @@ switch (event) { case MOD_LOAD: if (!cold) { - printf("The ACPI driver cannot be loaded after boot.\n"); + CTR0(KTR_GEN, "The ACPI driver cannot be loaded after boot.\n"); return (EPERM); } break; @@ -296,12 +297,12 @@ /* Start up the ACPI CA subsystem. */ if (ACPI_FAILURE(error = AcpiInitializeSubsystem())) { - printf("ACPI: initialisation failed: %s\n", AcpiFormatException(error)); + CTR1(KTR_GEN, "ACPI: initialisation failed: %s\n", AcpiFormatException(error)); return_VALUE (error); } if (ACPI_FAILURE(error = AcpiLoadTables())) { - printf("ACPI: table load failed: %s\n", AcpiFormatException(error)); + CTR1(KTR_GEN, "ACPI: table load failed: %s\n", AcpiFormatException(error)); AcpiTerminate(); return_VALUE (error); } @@ -314,7 +315,7 @@ if (resource_int_value("acpi", 0, "disabled", &val) == 0 && val == 0) acpi_quirks &= ~ACPI_Q_BROKEN; if (acpi_quirks & ACPI_Q_BROKEN) { - printf("ACPI disabled by blacklist. Contact your BIOS vendor.\n"); + CTR0(KTR_GEN, "ACPI disabled by blacklist. Contact your BIOS vendor.\n"); AcpiTerminate(); return_VALUE (AE_ERROR); } @@ -823,7 +824,7 @@ struct acpi_device *ad; if ((ad = device_get_ivars(child)) == NULL) { - printf("device has no ivars\n"); + CTR0(KTR_GEN, "device has no ivars\n"); return (ENOENT); } @@ -862,7 +863,7 @@ struct acpi_device *ad; if ((ad = device_get_ivars(child)) == NULL) { - printf("device has no ivars\n"); + CTR0(KTR_GEN, "device has no ivars\n"); return (ENOENT); } @@ -1648,18 +1649,18 @@ if ((howto & RB_POWEROFF) != 0) { status = AcpiEnterSleepStatePrep(ACPI_STATE_S5); if (ACPI_FAILURE(status)) { - printf("AcpiEnterSleepStatePrep failed - %s\n", + CTR1(KTR_GEN, "AcpiEnterSleepStatePrep failed - %s\n", AcpiFormatException(status)); return; } - printf("Powering system off using ACPI\n"); + CTR0(KTR_GEN, "Powering system off using ACPI\n"); ACPI_DISABLE_IRQS(); status = AcpiEnterSleepState(ACPI_STATE_S5); if (ACPI_FAILURE(status)) { - printf("ACPI power-off failed - %s\n", AcpiFormatException(status)); + CTR1(KTR_GEN, "ACPI power-off failed - %s\n", AcpiFormatException(status)); } else { DELAY(1000000); - printf("ACPI power-off failed - timeout\n"); + CTR0(KTR_GEN, "ACPI power-off failed - timeout\n"); } } else if ((howto & RB_HALT) == 0 && AcpiGbl_FADT->ResetRegSup && sc->acpi_handle_reboot) { @@ -1668,17 +1669,17 @@ AcpiGbl_FADT->ResetRegister.RegisterBitWidth, AcpiGbl_FADT->ResetValue, &AcpiGbl_FADT->ResetRegister); if (ACPI_FAILURE(status)) { - printf("ACPI reset failed - %s\n", AcpiFormatException(status)); + CTR1(KTR_GEN, "ACPI reset failed - %s\n", AcpiFormatException(status)); } else { DELAY(1000000); - printf("ACPI reset failed - timeout\n"); + CTR0(KTR_GEN, "ACPI reset failed - timeout\n"); } } else if (sc->acpi_do_disable && panicstr == NULL) { /* * Only disable ACPI if the user requested. On some systems, writing * the disable value to SMI_CMD hangs the system. */ - printf("Shutting down ACPI\n"); + CTR0(KTR_GEN, "Shutting down ACPI\n"); AcpiTerminate(); } } @@ -2132,7 +2133,7 @@ if (sc->acpi_sstate != ACPI_STATE_S0) status = AE_ERROR; ACPI_UNLOCK(acpi); - printf("acpi: suspend request ignored (not ready yet)\n"); + CTR0(KTR_GEN, "acpi: suspend request ignored (not ready yet)\n"); return (status); } sc->acpi_sleep_disabled = 1; @@ -2528,7 +2529,7 @@ /* Elements 2 to N of the _PRW object are power resources. */ power_count = res->Package.Count - 2; if (power_count > ACPI_PRW_MAX_POWERRES) { - printf("ACPI device %s has too many power resources\n", acpi_name(h)); + CTR1(KTR_GEN, "ACPI device %s has too many power resources\n", acpi_name(h)); power_count = 0; } prw->power_res_count = power_count; @@ -3041,20 +3042,20 @@ if (layer == NULL && level == NULL) return; - printf("ACPI set debug"); + CTR0(KTR_GEN, "ACPI set debug"); if (layer != NULL) { if (strcmp("NONE", layer) != 0) - printf(" layer '%s'", layer); + CTR1(KTR_GEN, " layer '%s'", layer); acpi_parse_debug(layer, &dbg_layer[0], &AcpiDbgLayer); freeenv(layer); } if (level != NULL) { if (strcmp("NONE", level) != 0) - printf(" level '%s'", level); + CTR1(KTR_GEN, " level '%s'", level); acpi_parse_debug(level, &dbg_level[0], &AcpiDbgLevel); freeenv(level); } - printf("\n"); + CTR0(KTR_GEN, "\n"); } SYSINIT(acpi_debugging, SI_SUB_TUNABLES, SI_ORDER_ANY, acpi_set_debugging, --------------070402020607080007080209--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44DBEFBE.3070100>