acpi_tz.c revision 1.13 1 /* $NetBSD: acpi_tz.c,v 1.13 2004/05/26 17:15:17 kochi Exp $ */
2
3 /*
4 * Copyright (c) 2003 Jared D. McNeill <jmcneill (at) invisible.ca>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
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
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
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
25 * SUCH DAMAGE.
26 */
27
28 /*
29 * ACPI Thermal Zone driver
30 */
31
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.13 2004/05/26 17:15:17 kochi Exp $");
34
35 #include <sys/param.h>
36 #include <sys/systm.h>
37 #include <sys/kernel.h>
38 #include <sys/errno.h>
39 #include <sys/ioctl.h>
40 #include <sys/syslog.h>
41 #include <sys/device.h>
42 #include <sys/callout.h>
43 #include <sys/proc.h>
44 #include <sys/lock.h>
45 #include <dev/sysmon/sysmonvar.h>
46
47 #include <dev/acpi/acpica.h>
48 #include <dev/acpi/acpireg.h>
49 #include <dev/acpi/acpivar.h>
50
51 /* flags */
52 #define ATZ_F_VERBOSE 0x01 /* show events to console */
53 #define ATZ_F_CRITICAL 0x02 /* zone critical */
54 #define ATZ_F_HOT 0x04 /* zone hot */
55 #define ATZ_F_PASSIVE 0x08 /* zone passive cooling */
56 #define ATZ_F_PASSIVEONLY 0x10 /* zone is passive cooling only */
57
58 /* no active cooling level */
59 #define ATZ_ACTIVE_NONE -1
60
61 /* constants */
62 #define ATZ_TZP_RATE 300 /* default if no _TZP CM present (30 secs) */
63 #define ATZ_NLEVELS 10 /* number of cooling levels, from ACPI spec */
64 #define ATZ_ZEROC 2732 /* 0C in tenths degrees Kelvin */
65 #define ATZ_TMP_INVALID 0xffffffff /* invalid temperature */
66 #define ATZ_ZONE_EXPIRE 9000 /* zone info refetch interval (15min) */
67
68 /* sensor indexes */
69 #define ATZ_SENSOR_TEMP 0 /* thermal zone temperature */
70 #define ATZ_NUMSENSORS 1 /* number of sensors */
71
72 static const struct envsys_range acpitz_ranges[] = {
73 { 0, 1, ATZ_SENSOR_TEMP },
74 };
75
76 static int acpitz_match(struct device *, struct cfdata *, void *);
77 static void acpitz_attach(struct device *, struct device *, void *);
78
79 /*
80 * ACPI Temperature Zone information. Note all temperatures are reported
81 * in tenths of degrees Kelvin
82 */
83 struct acpitz_zone {
84 /* Active cooling temperature threshold */
85 UINT32 ac[ATZ_NLEVELS];
86 /* Package of references to all active cooling devices for a level */
87 ACPI_BUFFER al[ATZ_NLEVELS];
88 /* Critical temperature threshold for system shutdown */
89 UINT32 crt;
90 /* Critical temperature threshold for S4 sleep */
91 UINT32 hot;
92 /* Package of references to processor objects for passive cooling */
93 ACPI_BUFFER psl;
94 /* Passive cooling temperature threshold */
95 UINT32 psv;
96 /* Thermal constants for use in passive cooling formulas */
97 UINT32 tc1, tc2;
98 /* Current temperature of the thermal zone */
99 UINT32 tmp;
100 /* Thermal sampling period for passive cooling, in tenths of seconds */
101 UINT32 tsp;
102 /* Package of references to devices in this TZ (optional) */
103 ACPI_BUFFER tzd;
104 /* Recommended TZ polling frequency, in tenths of seconds */
105 UINT32 tzp;
106 };
107
108 struct acpitz_softc {
109 struct device sc_dev;
110 struct acpi_devnode *sc_devnode;
111 struct acpitz_zone sc_zone;
112 struct callout sc_callout;
113 struct envsys_tre_data sc_data[ATZ_NUMSENSORS];
114 struct envsys_basic_info sc_info[ATZ_NUMSENSORS];
115 struct sysmon_envsys sc_sysmon;
116 struct simplelock sc_slock;
117 int sc_active; /* active cooling level */
118 int sc_flags;
119 int sc_rate; /* tz poll rate */
120 int sc_zone_expire;
121 };
122
123 static void acpitz_get_status(void *);
124 static void acpitz_get_zone(void *);
125 static char* acpitz_celcius_string(int);
126 static void acpitz_print_status(struct acpitz_softc *);
127 static void acpitz_power_off(struct acpitz_softc *);
128 static void acpitz_power_zone(struct acpitz_softc *, int, int);
129 static void acpitz_sane_temp(UINT32 *tmp);
130 static ACPI_STATUS
131 acpitz_switch_cooler(ACPI_OBJECT *, void *);
132 static void acpitz_notify_handler(ACPI_HANDLE, UINT32, void *);
133 static int acpitz_get_integer(struct acpitz_softc *, char *, UINT32 *);
134 static void acpitz_tick(void *);
135 static void acpitz_init_envsys(struct acpitz_softc *);
136 static int acpitz_gtredata(struct sysmon_envsys *,
137 struct envsys_tre_data *);
138 static int acpitz_streinfo(struct sysmon_envsys *,
139 struct envsys_basic_info *);
140
141 CFATTACH_DECL(acpitz, sizeof(struct acpitz_softc), acpitz_match,
142 acpitz_attach, NULL, NULL);
143
144 /*
145 * acpitz_match: autoconf(9) match routine
146 */
147 static int
148 acpitz_match(struct device *parent, struct cfdata *match, void *aux)
149 {
150 struct acpi_attach_args *aa = aux;
151
152 if (aa->aa_node->ad_type != ACPI_TYPE_THERMAL)
153 return 0;
154
155 return 1;
156 }
157
158 /*
159 * acpitz_attach: autoconf(9) attach routine
160 */
161 static void
162 acpitz_attach(struct device *parent, struct device *self, void *aux)
163 {
164 struct acpitz_softc *sc = (struct acpitz_softc *)self;
165 struct acpi_attach_args *aa = aux;
166 ACPI_STATUS rv;
167 ACPI_INTEGER v;
168
169 #if 0
170 sc->sc_flags = ATZ_F_VERBOSE;
171 #endif
172 sc->sc_devnode = aa->aa_node;
173
174 printf(": ACPI Thermal Zone\n");
175
176 rv = acpi_eval_integer(sc->sc_devnode->ad_handle, "_TZP", &v);
177 if (ACPI_FAILURE(rv)) {
178 printf("%s: unable to get polling interval; using default of",
179 sc->sc_dev.dv_xname);
180 sc->sc_zone.tzp = ATZ_TZP_RATE;
181 } else {
182 sc->sc_zone.tzp = v;
183 printf("%s: polling interval is", sc->sc_dev.dv_xname);
184 }
185 printf(" %d.%ds\n", sc->sc_zone.tzp / 10, sc->sc_zone.tzp % 10);
186
187 /* XXX a value of 0 means "polling is not necessary" */
188 if (sc->sc_zone.tzp == 0)
189 sc->sc_zone.tzp = ATZ_TZP_RATE;
190
191 sc->sc_zone_expire = ATZ_ZONE_EXPIRE / sc->sc_zone.tzp;
192
193 acpitz_get_zone(sc);
194 acpitz_get_status(sc);
195
196 rv = AcpiInstallNotifyHandler(sc->sc_devnode->ad_handle,
197 ACPI_SYSTEM_NOTIFY, acpitz_notify_handler, sc);
198 if (ACPI_FAILURE(rv)) {
199 printf("%s: unable to install SYSTEM NOTIFY handler: %s\n",
200 sc->sc_dev.dv_xname, AcpiFormatException(rv));
201 return;
202 }
203
204 callout_init(&sc->sc_callout);
205 callout_reset(&sc->sc_callout, sc->sc_zone.tzp * hz / 10,
206 acpitz_tick, sc);
207
208 acpitz_init_envsys(sc);
209 }
210
211 static void
212 acpitz_get_status(void *opaque)
213 {
214 struct acpitz_softc *sc = opaque;
215 UINT32 tmp, active;
216 int i, flags;
217
218 sc->sc_zone_expire--;
219 if (sc->sc_zone_expire <= 0) {
220 sc->sc_zone_expire = ATZ_ZONE_EXPIRE / sc->sc_zone.tzp;
221 if (sc->sc_flags & ATZ_F_VERBOSE)
222 printf("%s: force refetch zone\n", sc->sc_dev.dv_xname);
223 acpitz_get_zone(sc);
224 }
225
226 if (acpitz_get_integer(sc, "_TMP", &tmp)) {
227 printf("%s: failed to evaluate _TMP\n", sc->sc_dev.dv_xname);
228 return;
229 }
230 sc->sc_zone.tmp = tmp;
231 /* XXX sanity check for tmp here? */
232
233 /*
234 * The temperature unit for envsys(4) is microKelvin, so convert to
235 * that from ACPI's microKelvin. Also, the ACPI specification assumes
236 * that K = C + 273.2 rather than the nominal 273.15 used by envsys(4),
237 * so we correct for that too.
238 */
239 sc->sc_data[ATZ_SENSOR_TEMP].cur.data_us =
240 sc->sc_zone.tmp * 100000 - 50000;
241 sc->sc_data[ATZ_SENSOR_TEMP].validflags |= ENVSYS_FCURVALID;
242
243 if (sc->sc_flags & ATZ_F_VERBOSE)
244 acpitz_print_status(sc);
245
246 if (sc->sc_flags & ATZ_F_PASSIVEONLY) {
247 /* Passive Cooling: XXX not yet */
248
249 } else {
250 /* Active Cooling */
251
252 /* temperature threshold: _AC0 > ... > _AC9 */
253 active = ATZ_ACTIVE_NONE;
254 for (i = ATZ_NLEVELS - 1; i >= 0; i--) {
255 if (sc->sc_zone.ac[i] == ATZ_TMP_INVALID)
256 continue;
257
258 /* we want to keep highest cooling mode in 'active' */
259 if (sc->sc_zone.ac[i] <= tmp)
260 active = i;
261 }
262
263 flags = sc->sc_flags & ~(ATZ_F_CRITICAL|ATZ_F_HOT|ATZ_F_PASSIVE);
264 if (sc->sc_zone.psv != ATZ_TMP_INVALID &&
265 tmp >= sc->sc_zone.psv)
266 flags |= ATZ_F_PASSIVE;
267 if (sc->sc_zone.hot != ATZ_TMP_INVALID &&
268 tmp >= sc->sc_zone.hot)
269 flags |= ATZ_F_HOT;
270 if (sc->sc_zone.crt != ATZ_TMP_INVALID &&
271 tmp >= sc->sc_zone.crt)
272 flags |= ATZ_F_CRITICAL;
273
274 if (flags != sc->sc_flags) {
275 int changed = (sc->sc_flags ^ flags) & flags;
276 sc->sc_flags = flags;
277 if (changed & ATZ_F_CRITICAL)
278 printf("%s: zone went critical at temp %sC\n",
279 sc->sc_dev.dv_xname,
280 acpitz_celcius_string(tmp));
281 else if (changed & ATZ_F_HOT)
282 printf("%s: zone went hot at temp %sC\n",
283 sc->sc_dev.dv_xname,
284 acpitz_celcius_string(tmp));
285 }
286
287 /* power on fans */
288 if (sc->sc_active != active) {
289 if (sc->sc_active != ATZ_ACTIVE_NONE)
290 acpitz_power_zone(sc, sc->sc_active, 0);
291
292 if (active != ATZ_ACTIVE_NONE) {
293 if (sc->sc_flags & ATZ_F_VERBOSE)
294 printf("%s: active cooling level %u\n",
295 sc->sc_dev.dv_xname, active);
296 acpitz_power_zone(sc, active, 1);
297 }
298
299 sc->sc_active = active;
300 }
301 }
302
303 return;
304 }
305
306 static char *
307 acpitz_celcius_string(int dk)
308 {
309 static char buf[10];
310
311 snprintf(buf, sizeof(buf), "%d.%d", (dk - ATZ_ZEROC) / 10,
312 (dk - ATZ_ZEROC) % 10);
313
314 return buf;
315 }
316
317 static void
318 acpitz_print_status(struct acpitz_softc *sc)
319 {
320
321 printf("%s: zone temperature is now %sC\n", sc->sc_dev.dv_xname,
322 acpitz_celcius_string(sc->sc_zone.tmp));
323
324 return;
325 }
326
327 static ACPI_STATUS
328 acpitz_switch_cooler(ACPI_OBJECT *obj, void *arg)
329 {
330 ACPI_HANDLE cooler;
331 ACPI_STATUS rv;
332 int pwr_state, flag;
333
334 flag = *(int *)arg;
335
336 if (flag)
337 pwr_state = ACPI_STATE_D0;
338 else
339 pwr_state = ACPI_STATE_D3;
340
341 switch(obj->Type) {
342 case ACPI_TYPE_ANY:
343 cooler = obj->Reference.Handle;
344 break;
345 case ACPI_TYPE_STRING:
346 rv = AcpiGetHandle(NULL, obj->String.Pointer, &cooler);
347 if (ACPI_FAILURE(rv)) {
348 printf("failed to get handler from %s\n",
349 obj->String.Pointer);
350 return rv;
351 }
352 break;
353 default:
354 printf("unknown power type: %d\n", obj->Type);
355 return AE_OK;
356 }
357
358 rv = acpi_pwr_switch_consumer(cooler, pwr_state);
359 if (rv != AE_BAD_PARAMETER && ACPI_FAILURE(rv)) {
360 printf("failed to change state for %s: %s\n",
361 acpi_name(obj->Reference.Handle),
362 AcpiFormatException(rv));
363 }
364
365 return AE_OK;
366 }
367
368 /*
369 * acpitz_power_zone:
370 * power on or off the i:th part of the zone zone
371 */
372 static void
373 acpitz_power_zone(struct acpitz_softc *sc, int i, int on)
374 {
375 KASSERT(i >= 0 && i < ATZ_NLEVELS);
376
377 acpi_foreach_package_object(sc->sc_zone.al[i].Pointer,
378 acpitz_switch_cooler, &on);
379 }
380
381
382 /*
383 * acpitz_power_off:
384 * power off parts of the zone
385 */
386 static void
387 acpitz_power_off(struct acpitz_softc *sc)
388 {
389 int i;
390
391 for (i = 0 ; i < ATZ_NLEVELS; i++) {
392 if (sc->sc_zone.al[i].Pointer == NULL)
393 continue;
394 acpitz_power_zone(sc, i, 0);
395 }
396 sc->sc_active = ATZ_ACTIVE_NONE;
397 sc->sc_flags &= ~(ATZ_F_CRITICAL|ATZ_F_HOT|ATZ_F_PASSIVE);
398 }
399
400 static void
401 acpitz_get_zone(void *opaque)
402 {
403 struct acpitz_softc *sc = opaque;
404 ACPI_STATUS rv;
405 char buf[8];
406 int i, valid_levels;
407 static int first = 1;
408
409 if (!first) {
410 acpitz_power_off(sc);
411
412 for (i = 0; i < ATZ_NLEVELS; i++) {
413 if (sc->sc_zone.al[i].Pointer != NULL)
414 AcpiOsFree(sc->sc_zone.al[i].Pointer);
415 sc->sc_zone.al[i].Pointer = NULL;
416 }
417 }
418
419 valid_levels = 0;
420
421 for (i = 0; i < ATZ_NLEVELS; i++) {
422 ACPI_OBJECT *obj;
423
424 snprintf(buf, sizeof(buf), "_AC%d", i);
425 if (acpitz_get_integer(sc, buf, &sc->sc_zone.ac[i]))
426 continue;
427
428 snprintf(buf, sizeof(buf), "_AL%d", i);
429 rv = acpi_eval_struct(sc->sc_devnode->ad_handle, buf,
430 &sc->sc_zone.al[i]);
431 if (ACPI_FAILURE(rv)) {
432 printf("failed getting _AL%d", i);
433 sc->sc_zone.al[i].Pointer = NULL;
434 continue;
435 }
436
437 obj = sc->sc_zone.al[i].Pointer;
438 if (obj != NULL) {
439 if (obj->Type != ACPI_TYPE_PACKAGE) {
440 printf("%s: ac%d not package\n",
441 sc->sc_dev.dv_xname, i);
442 AcpiOsFree(obj);
443 sc->sc_zone.al[i].Pointer = NULL;
444 continue;
445 }
446 }
447
448 if (first)
449 printf("%s: active cooling level %d: %sC\n",
450 sc->sc_dev.dv_xname, i,
451 acpitz_celcius_string(sc->sc_zone.ac[i]));
452
453 valid_levels++;
454 }
455
456 if (valid_levels == 0) {
457 sc->sc_flags |= ATZ_F_PASSIVEONLY;
458 if (first)
459 printf("%s: passive cooling mode only\n",
460 sc->sc_dev.dv_xname);
461 }
462
463 acpitz_get_integer(sc, "_TMP", &sc->sc_zone.tmp);
464 acpitz_get_integer(sc, "_CRT", &sc->sc_zone.crt);
465 acpitz_get_integer(sc, "_HOT", &sc->sc_zone.hot);
466 sc->sc_zone.psl.Length = ACPI_ALLOCATE_BUFFER;
467 sc->sc_zone.psl.Pointer = NULL;
468 AcpiEvaluateObject(sc, "_PSL", NULL, &sc->sc_zone.psl);
469 acpitz_get_integer(sc, "_PSV", &sc->sc_zone.psv);
470 acpitz_get_integer(sc, "_TC1", &sc->sc_zone.tc1);
471 acpitz_get_integer(sc, "_TC2", &sc->sc_zone.tc2);
472
473 acpitz_sane_temp(&sc->sc_zone.tmp);
474 acpitz_sane_temp(&sc->sc_zone.crt);
475 acpitz_sane_temp(&sc->sc_zone.hot);
476 acpitz_sane_temp(&sc->sc_zone.psv);
477
478 printf("%s:", sc->sc_dev.dv_xname);
479 if (sc->sc_zone.crt != ATZ_TMP_INVALID)
480 printf(" critical %sC",
481 acpitz_celcius_string(sc->sc_zone.crt));
482 if (sc->sc_zone.hot != ATZ_TMP_INVALID)
483 printf(" hot %sC",
484 acpitz_celcius_string(sc->sc_zone.hot));
485 if (sc->sc_zone.psv != ATZ_TMP_INVALID)
486 printf(" passive %sC",
487 acpitz_celcius_string(sc->sc_zone.tmp));
488 printf("\n");
489
490 for (i = 0; i < ATZ_NLEVELS; i++)
491 acpitz_sane_temp(&sc->sc_zone.ac[i]);
492
493 acpitz_power_off(sc);
494 first = 0;
495 }
496
497
498 static void
499 acpitz_notify_handler(ACPI_HANDLE hdl, UINT32 notify, void *opaque)
500 {
501 struct acpitz_softc *sc = opaque;
502 OSD_EXECUTION_CALLBACK func = NULL;
503 const char *name;
504 int rv;
505
506 switch (notify) {
507 case ACPI_NOTIFY_ThermalZoneStatusChanged:
508 func = acpitz_get_status;
509 name = "status check";
510 break;
511 case ACPI_NOTIFY_ThermalZoneTripPointsChanged:
512 case ACPI_NOTIFY_DeviceListsChanged:
513 func = acpitz_get_zone;
514 name = "get zone";
515 break;
516 default:
517 printf("%s: received unhandled notify message 0x%x\n",
518 sc->sc_dev.dv_xname, notify);
519 return;
520 }
521
522 KASSERT(func != NULL);
523
524 rv = AcpiOsQueueForExecution(OSD_PRIORITY_LO, func, sc);
525 if (rv != AE_OK)
526 printf("%s: unable to queue %s\n", sc->sc_dev.dv_xname, name);
527
528 return;
529 }
530
531 static void
532 acpitz_sane_temp(UINT32 *tmp)
533 {
534 /* Sane temperatures are beteen 0 and 150 C */
535 if (*tmp < ATZ_ZEROC || *tmp > ATZ_ZEROC + 1500)
536 *tmp = ATZ_TMP_INVALID;
537 }
538
539 static int
540 acpitz_get_integer(struct acpitz_softc *sc, char *cm, UINT32 *val)
541 {
542 ACPI_STATUS rv;
543 ACPI_INTEGER tmp;
544
545 rv = acpi_eval_integer(sc->sc_devnode->ad_handle, cm, &tmp);
546 if (ACPI_FAILURE(rv)) {
547 #ifdef ACPI_DEBUG
548 printf("%s: failed to evaluate %s: %s\n", sc->sc_dev.dv_xname,
549 cm, AcpiFormatException(rv));
550 #endif
551 *val = ATZ_TMP_INVALID;
552 return 1;
553 }
554
555 *val = tmp;
556
557 return 0;
558 }
559
560 static void
561 acpitz_tick(void *opaque)
562 {
563 struct acpitz_softc *sc = opaque;
564
565 callout_reset(&sc->sc_callout, sc->sc_zone.tzp * hz / 10,
566 acpitz_tick, opaque);
567 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpitz_get_status, sc);
568
569 return;
570 }
571
572 static void
573 acpitz_init_envsys(struct acpitz_softc *sc)
574 {
575 int i;
576
577 simple_lock_init(&sc->sc_slock);
578
579 for (i = 0; i < ATZ_NUMSENSORS; i++) {
580 sc->sc_data[i].sensor = sc->sc_info[i].sensor = i;
581 sc->sc_data[i].validflags = ENVSYS_FVALID;
582 sc->sc_info[i].validflags = ENVSYS_FVALID;
583 sc->sc_data[i].warnflags = ENVSYS_WARN_OK;
584 }
585 #define INITDATA(index, unit, string) \
586 sc->sc_data[index].units = unit; \
587 sc->sc_info[index].units = unit; \
588 snprintf(sc->sc_info[index].desc, sizeof(sc->sc_info[index].desc), \
589 "%s %s", sc->sc_dev.dv_xname, string);
590
591 INITDATA(ATZ_SENSOR_TEMP, ENVSYS_STEMP, "temperature");
592
593 /* hook into sysmon */
594 sc->sc_sysmon.sme_ranges = acpitz_ranges;
595 sc->sc_sysmon.sme_sensor_info = sc->sc_info;
596 sc->sc_sysmon.sme_sensor_data = sc->sc_data;
597 sc->sc_sysmon.sme_cookie = sc;
598 sc->sc_sysmon.sme_gtredata = acpitz_gtredata;
599 sc->sc_sysmon.sme_streinfo = acpitz_streinfo;
600 sc->sc_sysmon.sme_nsensors = ATZ_NUMSENSORS;
601 sc->sc_sysmon.sme_envsys_version = 1000;
602
603 if (sysmon_envsys_register(&sc->sc_sysmon))
604 printf("%s: unable to register with sysmon\n",
605 sc->sc_dev.dv_xname);
606 }
607
608 int
609 acpitz_gtredata(struct sysmon_envsys *sme, struct envsys_tre_data *tred)
610 {
611 struct acpitz_softc *sc = sme->sme_cookie;
612
613 simple_lock(&sc->sc_slock);
614
615 *tred = sc->sc_data[tred->sensor];
616
617 simple_unlock(&sc->sc_slock);
618
619 return 0;
620 }
621
622 static int
623 acpitz_streinfo(struct sysmon_envsys *sme, struct envsys_basic_info *binfo)
624 {
625
626 /* XXX not implemented */
627 binfo->validflags = 0;
628
629 return 0;
630 }
631