From owner-freebsd-acpi@FreeBSD.ORG Fri Aug 11 02:47:34 2006 Return-Path: X-Original-To: freebsd-acpi@freebsd.org Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 592BA16A4DF for ; Fri, 11 Aug 2006 02:47:34 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D47243D64 for ; Fri, 11 Aug 2006 02:47:30 +0000 (GMT) (envelope-from ganbold@micom.mng.net) Received: from [202.179.0.164] (helo=[192.168.0.18]) by publicd.ub.mng.net with esmtpa (Exim 4.61 (FreeBSD)) (envelope-from ) id 1GBN3X-000Djg-2q; Fri, 11 Aug 2006 11:47:27 +0900 Message-ID: <44DBEFBE.3070100@micom.mng.net> Date: Fri, 11 Aug 2006 11:47:26 +0900 From: Ganbold User-Agent: Thunderbird 1.5.0.4 (X11/20060612) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org Content-Type: multipart/mixed; boundary="------------070402020607080007080209" Cc: Subject: KTR support for ACPI debug messages X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2006 02:47:34 -0000 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 #include #include +#include #include #include @@ -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--