Fri Jan 7 14:08:29 2011 UTC ()
use aprint_error_dev


(cegger)
diff -r1.67 -r1.68 src/sys/dev/acpi/acpi_ec.c

cvs diff -r1.67 -r1.68 src/sys/dev/acpi/acpi_ec.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_ec.c 2010/06/06 18:56:10 1.67
+++ src/sys/dev/acpi/acpi_ec.c 2011/01/07 14:08:29 1.68
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_ec.c,v 1.67 2010/06/06 18:56:10 jruoho Exp $ */ 1/* $NetBSD: acpi_ec.c,v 1.68 2011/01/07 14:08:29 cegger Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. 4 * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in 14 * notice, this list of conditions and the following disclaimer in
@@ -49,27 +49,27 @@ @@ -49,27 +49,27 @@
49 * working and the handlers just busy loop. 49 * working and the handlers just busy loop.
50 * 50 *
51 * A callout is scheduled to compensate for missing interrupts on some 51 * A callout is scheduled to compensate for missing interrupts on some
52 * hardware. If the EC doesn't process a request for 5s, it is most likely 52 * hardware. If the EC doesn't process a request for 5s, it is most likely
53 * in a wedged state. No method to reset the EC is currently known. 53 * in a wedged state. No method to reset the EC is currently known.
54 * 54 *
55 * Special care has to be taken to not poll the EC in a busy loop without 55 * Special care has to be taken to not poll the EC in a busy loop without
56 * delay. This can prevent processing of Power Button events. At least some 56 * delay. This can prevent processing of Power Button events. At least some
57 * Lenovo Thinkpads seem to be implement the Power Button Override in the EC 57 * Lenovo Thinkpads seem to be implement the Power Button Override in the EC
58 * and the only option to recover on those models is to cut off all power. 58 * and the only option to recover on those models is to cut off all power.
59 */ 59 */
60 60
61#include <sys/cdefs.h> 61#include <sys/cdefs.h>
62__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.67 2010/06/06 18:56:10 jruoho Exp $"); 62__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.68 2011/01/07 14:08:29 cegger Exp $");
63 63
64#include <sys/param.h> 64#include <sys/param.h>
65#include <sys/callout.h> 65#include <sys/callout.h>
66#include <sys/condvar.h> 66#include <sys/condvar.h>
67#include <sys/device.h> 67#include <sys/device.h>
68#include <sys/kernel.h> 68#include <sys/kernel.h>
69#include <sys/kthread.h> 69#include <sys/kthread.h>
70#include <sys/mutex.h> 70#include <sys/mutex.h>
71#include <sys/systm.h> 71#include <sys/systm.h>
72 72
73#include <dev/acpi/acpireg.h> 73#include <dev/acpi/acpireg.h>
74#include <dev/acpi/acpivar.h> 74#include <dev/acpi/acpivar.h>
75#include <dev/acpi/acpi_ecvar.h> 75#include <dev/acpi/acpi_ecvar.h>
@@ -725,28 +725,28 @@ done: @@ -725,28 +725,28 @@ done:
725 725
726 mutex_exit(&sc->sc_mtx); 726 mutex_exit(&sc->sc_mtx);
727 acpiec_unlock(dv); 727 acpiec_unlock(dv);
728 728
729 if (reg == 0) 729 if (reg == 0)
730 goto loop; /* Spurious query result */ 730 goto loop; /* Spurious query result */
731 731
732 /* 732 /*
733 * Evaluate _Qxx to respond to the controller. 733 * Evaluate _Qxx to respond to the controller.
734 */ 734 */
735 snprintf(qxx, sizeof(qxx), "_Q%02X", (unsigned int)reg); 735 snprintf(qxx, sizeof(qxx), "_Q%02X", (unsigned int)reg);
736 rv = AcpiEvaluateObject(sc->sc_ech, qxx, NULL, NULL); 736 rv = AcpiEvaluateObject(sc->sc_ech, qxx, NULL, NULL);
737 if (rv != AE_OK && rv != AE_NOT_FOUND) { 737 if (rv != AE_OK && rv != AE_NOT_FOUND) {
738 aprint_error("%s: GPE query method %s failed: %s", 738 aprint_error_dev(dv, "GPE query method %s failed: %s",
739 device_xname(dv), qxx, AcpiFormatException(rv)); 739 qxx, AcpiFormatException(rv));
740 } 740 }
741 741
742 goto loop; 742 goto loop;
743} 743}
744 744
745static void 745static void
746acpiec_gpe_state_machine(device_t dv) 746acpiec_gpe_state_machine(device_t dv)
747{ 747{
748 struct acpiec_softc *sc = device_private(dv); 748 struct acpiec_softc *sc = device_private(dv);
749 uint8_t reg; 749 uint8_t reg;
750 750
751 reg = acpiec_read_status(sc); 751 reg = acpiec_read_status(sc);
752 752