Sun Oct 2 22:20:33 2011 UTC ()
_ACx is for active cooling policy, using it for envsys temp 'warn max' doesn't
make sense


(jmcneill)
diff -r1.83 -r1.84 src/sys/dev/acpi/acpi_tz.c

cvs diff -r1.83 -r1.84 src/sys/dev/acpi/acpi_tz.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_tz.c 2011/07/16 15:45:24 1.83
+++ src/sys/dev/acpi/acpi_tz.c 2011/10/02 22:20:33 1.84
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_tz.c,v 1.83 2011/07/16 15:45:24 jmcneill Exp $ */ 1/* $NetBSD: acpi_tz.c,v 1.84 2011/10/02 22:20:33 jmcneill Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2003 Jared D. McNeill <jmcneill@invisible.ca>
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 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. The name of the author may not be used to endorse or promote products 12 * 2. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission. 13 * derived from this software without specific prior written permission.
14 * 14 *
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE. 25 * SUCH DAMAGE.
26 */ 26 */
27 27
28/* 28/*
29 * ACPI Thermal Zone driver 29 * ACPI Thermal Zone driver
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.83 2011/07/16 15:45:24 jmcneill Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.84 2011/10/02 22:20:33 jmcneill Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/callout.h> 37#include <sys/callout.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/module.h> 39#include <sys/module.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kmem.h> 41#include <sys/kmem.h>
42 42
43#include <dev/acpi/acpireg.h> 43#include <dev/acpi/acpireg.h>
44#include <dev/acpi/acpivar.h> 44#include <dev/acpi/acpivar.h>
45#include <dev/acpi/acpi_power.h> 45#include <dev/acpi/acpi_power.h>
46 46
@@ -826,46 +826,37 @@ acpitz_init_envsys(device_t dv) @@ -826,46 +826,37 @@ acpitz_init_envsys(device_t dv)
826 826
827out: 827out:
828 aprint_error_dev(dv, "unable to register with sysmon\n"); 828 aprint_error_dev(dv, "unable to register with sysmon\n");
829 829
830 sysmon_envsys_destroy(sc->sc_sme); 830 sysmon_envsys_destroy(sc->sc_sme);
831 sc->sc_sme = NULL; 831 sc->sc_sme = NULL;
832} 832}
833 833
834static void 834static void
835acpitz_get_limits(struct sysmon_envsys *sme, envsys_data_t *edata, 835acpitz_get_limits(struct sysmon_envsys *sme, envsys_data_t *edata,
836 sysmon_envsys_lim_t *limits, uint32_t *props) 836 sysmon_envsys_lim_t *limits, uint32_t *props)
837{ 837{
838 struct acpitz_softc *sc = sme->sme_cookie; 838 struct acpitz_softc *sc = sme->sme_cookie;
839 int i; 
840 839
841 switch (edata->units) { 840 switch (edata->units) {
842 case ENVSYS_STEMP: 841 case ENVSYS_STEMP:
843 *props = 0; 842 *props = 0;
844 if (sc->sc_zone.hot != ATZ_TMP_INVALID) { 843 if (sc->sc_zone.hot != ATZ_TMP_INVALID) {
845 *props |= PROP_CRITMAX; 844 *props |= PROP_CRITMAX;
846 limits->sel_critmax = ATZ2UKELVIN(sc->sc_zone.hot); 845 limits->sel_critmax = ATZ2UKELVIN(sc->sc_zone.hot);
847 } else if (sc->sc_zone.crt != ATZ_TMP_INVALID) { 846 } else if (sc->sc_zone.crt != ATZ_TMP_INVALID) {
848 *props |= PROP_CRITMAX; 847 *props |= PROP_CRITMAX;
849 limits->sel_critmax = ATZ2UKELVIN(sc->sc_zone.crt); 848 limits->sel_critmax = ATZ2UKELVIN(sc->sc_zone.crt);
850 } 849 }
851 for (i = 0; i < ATZ_NLEVELS; i++) { 
852 if (sc->sc_zone.ac[i] != ATZ_TMP_INVALID) { 
853 limits->sel_warnmax = 
854 ATZ2UKELVIN(sc->sc_zone.ac[i]); 
855 *props |= PROP_WARNMAX; 
856 break; 
857 } 
858 } 
859 break; 850 break;
860 851
861 case ENVSYS_SFANRPM: 852 case ENVSYS_SFANRPM:
862 *props = 0; 853 *props = 0;
863 if (sc->sc_zone.fanmin != ATZ_TMP_INVALID) { 854 if (sc->sc_zone.fanmin != ATZ_TMP_INVALID) {
864 *props |= PROP_WARNMIN; 855 *props |= PROP_WARNMIN;
865 limits->sel_warnmin = sc->sc_zone.fanmin; 856 limits->sel_warnmin = sc->sc_zone.fanmin;
866 } 857 }
867 if (sc->sc_zone.fanmax != ATZ_TMP_INVALID) { 858 if (sc->sc_zone.fanmax != ATZ_TMP_INVALID) {
868 *props |= PROP_WARNMAX; 859 *props |= PROP_WARNMAX;
869 limits->sel_warnmax = sc->sc_zone.fanmax; 860 limits->sel_warnmax = sc->sc_zone.fanmax;
870 } 861 }
871 break; 862 break;