Deleted Added
full compact
acpi_thermal.c (82043) acpi_thermal.c (82372)
1/*-
2 * Copyright (c) 2000, 2001 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, 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 *
1/*-
2 * Copyright (c) 2000, 2001 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, 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 * $FreeBSD: head/sys/dev/acpica/acpi_thermal.c 82043 2001-08-21 09:06:02Z msmith $
27 * $FreeBSD: head/sys/dev/acpica/acpi_thermal.c 82372 2001-08-26 22:50:15Z msmith $
28 */
29
30#include "opt_acpi.h"
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/bus.h>
34#include <sys/reboot.h>
35#include <sys/sysctl.h>

--- 305 unchanged lines hidden (view full) ---

341 /*
342 * Get the current temperature.
343 */
344 if ((acpi_EvaluateInteger(sc->tz_handle, "_TMP", &temp)) != AE_OK) {
345 device_printf(sc->tz_dev, "error fetching current temperature\n");
346 /* XXX disable zone? go to max cooling? */
347 return_VOID;
348 }
28 */
29
30#include "opt_acpi.h"
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/bus.h>
34#include <sys/reboot.h>
35#include <sys/sysctl.h>

--- 305 unchanged lines hidden (view full) ---

341 /*
342 * Get the current temperature.
343 */
344 if ((acpi_EvaluateInteger(sc->tz_handle, "_TMP", &temp)) != AE_OK) {
345 device_printf(sc->tz_dev, "error fetching current temperature\n");
346 /* XXX disable zone? go to max cooling? */
347 return_VOID;
348 }
349 DEBUG_PRINT(TRACE_VALUES, ("got %d.%dC\n", TZ_KELVTOC(temp)));
349 ACPI_DEBUG_PRINT((ACPI_DB_VALUES, "got %d.%dC\n", TZ_KELVTOC(temp)));
350 sc->tz_temperature = temp;
351
352 /*
353 * Work out what we ought to be doing right now.
354 *
355 * Note that the _ACx levels sort from hot to cold.
356 */
357 newactive = TZ_ACTIVE_NONE;

--- 98 unchanged lines hidden (view full) ---

456 ACPI_HANDLE cooler;
457
458 FUNCTION_TRACE(__func__);
459
460 ACPI_ASSERTLOCK;
461
462 switch(obj->Type) {
463 case ACPI_TYPE_STRING:
350 sc->tz_temperature = temp;
351
352 /*
353 * Work out what we ought to be doing right now.
354 *
355 * Note that the _ACx levels sort from hot to cold.
356 */
357 newactive = TZ_ACTIVE_NONE;

--- 98 unchanged lines hidden (view full) ---

456 ACPI_HANDLE cooler;
457
458 FUNCTION_TRACE(__func__);
459
460 ACPI_ASSERTLOCK;
461
462 switch(obj->Type) {
463 case ACPI_TYPE_STRING:
464 DEBUG_PRINT(TRACE_OBJECTS, ("called to turn %s off\n", obj->String.Pointer));
464 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n", obj->String.Pointer));
465
466 /*
467 * Find the handle for the device and turn it off.
468 * The String object here seems to contain a fully-qualified path, so we
469 * don't have to search for it in our parents.
470 *
471 * XXX This may not always be the case.
472 */
473 if (AcpiGetHandle(NULL, obj->String.Pointer, &cooler) == AE_OK)
474 acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3);
475 break;
476
477 default:
465
466 /*
467 * Find the handle for the device and turn it off.
468 * The String object here seems to contain a fully-qualified path, so we
469 * don't have to search for it in our parents.
470 *
471 * XXX This may not always be the case.
472 */
473 if (AcpiGetHandle(NULL, obj->String.Pointer, &cooler) == AE_OK)
474 acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3);
475 break;
476
477 default:
478 DEBUG_PRINT(TRACE_OBJECTS, ("called to handle unsupported object type %d\n",
479 obj->Type));
478 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to handle unsupported object type %d\n",
479 obj->Type));
480 break;
481 }
482 return_VOID;
483}
484
485/*
486 * Given an object, verify that it's a reference to a device of some sort,
487 * and try to switch it on.

--- 8 unchanged lines hidden (view full) ---

496 ACPI_STATUS status;
497
498 FUNCTION_TRACE(__func__);
499
500 ACPI_ASSERTLOCK;
501
502 switch(obj->Type) {
503 case ACPI_TYPE_STRING:
480 break;
481 }
482 return_VOID;
483}
484
485/*
486 * Given an object, verify that it's a reference to a device of some sort,
487 * and try to switch it on.

--- 8 unchanged lines hidden (view full) ---

496 ACPI_STATUS status;
497
498 FUNCTION_TRACE(__func__);
499
500 ACPI_ASSERTLOCK;
501
502 switch(obj->Type) {
503 case ACPI_TYPE_STRING:
504 DEBUG_PRINT(TRACE_OBJECTS, ("called to turn %s on\n", obj->String.Pointer));
504 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n", obj->String.Pointer));
505
506 /*
507 * Find the handle for the device and turn it off.
508 * The String object here seems to contain a fully-qualified path, so we
509 * don't have to search for it in our parents.
510 *
511 * XXX This may not always be the case.
512 */
513 if (AcpiGetHandle(NULL, obj->String.Pointer, &cooler) == AE_OK) {
514 if (ACPI_FAILURE(status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0))) {
515 device_printf(sc->tz_dev, "failed to activate %s - %s\n",
516 obj->String.Pointer, AcpiFormatException(status));
517 }
518 } else {
519 device_printf(sc->tz_dev, "couldn't find %s\n", obj->String.Pointer);
520 }
521 break;
522
523 default:
505
506 /*
507 * Find the handle for the device and turn it off.
508 * The String object here seems to contain a fully-qualified path, so we
509 * don't have to search for it in our parents.
510 *
511 * XXX This may not always be the case.
512 */
513 if (AcpiGetHandle(NULL, obj->String.Pointer, &cooler) == AE_OK) {
514 if (ACPI_FAILURE(status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0))) {
515 device_printf(sc->tz_dev, "failed to activate %s - %s\n",
516 obj->String.Pointer, AcpiFormatException(status));
517 }
518 } else {
519 device_printf(sc->tz_dev, "couldn't find %s\n", obj->String.Pointer);
520 }
521 break;
522
523 default:
524 DEBUG_PRINT(TRACE_OBJECTS, ("called to handle unsupported object type %d\n",
525 obj->Type));
524 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to handle unsupported object type %d\n",
525 obj->Type));
526 break;
527 }
528 return_VOID;
529}
530
531/*
532 * Read/debug-print a parameter, default it to -1.
533 */
534static void
535acpi_tz_getparam(struct acpi_tz_softc *sc, char *node, int *data)
536{
537
538 FUNCTION_TRACE(__func__);
539
540 ACPI_ASSERTLOCK;
541
542 if (acpi_EvaluateInteger(sc->tz_handle, node, data) != AE_OK) {
543 *data = -1;
544 } else {
526 break;
527 }
528 return_VOID;
529}
530
531/*
532 * Read/debug-print a parameter, default it to -1.
533 */
534static void
535acpi_tz_getparam(struct acpi_tz_softc *sc, char *node, int *data)
536{
537
538 FUNCTION_TRACE(__func__);
539
540 ACPI_ASSERTLOCK;
541
542 if (acpi_EvaluateInteger(sc->tz_handle, node, data) != AE_OK) {
543 *data = -1;
544 } else {
545 DEBUG_PRINT(TRACE_VALUES, ("%s.%s = %d\n", acpi_name(sc->tz_handle),
546 node, *data));
545 ACPI_DEBUG_PRINT((ACPI_DB_VALUES, "%s.%s = %d\n", acpi_name(sc->tz_handle),
546 node, *data));
547 }
548 return_VOID;
549}
550
551/*
552 * Sanity-check a temperature value. Assume that setpoints
553 * should be between 0C and 150C.
554 */

--- 139 unchanged lines hidden ---
547 }
548 return_VOID;
549}
550
551/*
552 * Sanity-check a temperature value. Assume that setpoints
553 * should be between 0C and 150C.
554 */

--- 139 unchanged lines hidden ---