acpi_thermal.c (126662) | acpi_thermal.c (128047) |
---|---|
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: --- 12 unchanged lines hidden (view full) --- 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 28#include <sys/cdefs.h> | 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: --- 12 unchanged lines hidden (view full) --- 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 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_thermal.c 126662 2004-03-05 18:06:31Z njl $"); | 29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_thermal.c 128047 2004-04-09 06:55:50Z njl $"); |
30 31#include "opt_acpi.h" 32#include <sys/param.h> 33#include <sys/kernel.h> 34#include <sys/kthread.h> 35#include <sys/bus.h> 36#include <sys/proc.h> 37#include <sys/reboot.h> --- 507 unchanged lines hidden (view full) --- 545 546/* 547 * Given an object, verify that it's a reference to a device of some sort, 548 * and try to switch it off. 549 */ 550static void 551acpi_tz_switch_cooler_off(ACPI_OBJECT *obj, void *arg) 552{ | 30 31#include "opt_acpi.h" 32#include <sys/param.h> 33#include <sys/kernel.h> 34#include <sys/kthread.h> 35#include <sys/bus.h> 36#include <sys/proc.h> 37#include <sys/reboot.h> --- 507 unchanged lines hidden (view full) --- 545 546/* 547 * Given an object, verify that it's a reference to a device of some sort, 548 * and try to switch it off. 549 */ 550static void 551acpi_tz_switch_cooler_off(ACPI_OBJECT *obj, void *arg) 552{ |
553 ACPI_HANDLE cooler; | 553 struct acpi_tz_softc *sc = (struct acpi_tz_softc *)arg; 554 ACPI_HANDLE cooler; 555 ACPI_STATUS status; |
554 555 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); 556 557 ACPI_ASSERTLOCK; 558 | 556 557 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); 558 559 ACPI_ASSERTLOCK; 560 |
559 switch(obj->Type) { 560 case ACPI_TYPE_ANY: 561 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n", 562 acpi_name(obj->Reference.Handle))); | 561 cooler = acpi_GetReference(NULL, obj); 562 if (cooler == NULL) { 563 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get handle\n")); 564 return_VOID; 565 } |
563 | 566 |
564 acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D3); 565 break; 566 case ACPI_TYPE_STRING: 567 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n", 568 obj->String.Pointer)); 569 570 /* 571 * Find the handle for the device and turn it off. 572 * The String object here seems to contain a fully-qualified path, so we 573 * don't have to search for it in our parents. 574 * 575 * XXX This may not always be the case. 576 */ 577 if (ACPI_SUCCESS(AcpiGetHandle(NULL, obj->String.Pointer, &cooler))) 578 acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3); 579 break; 580 default: 581 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, 582 "called to handle unsupported object type %d\n", 583 obj->Type)); 584 break; | 567 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n", 568 acpi_name(cooler))); 569 status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3); 570 if (ACPI_FAILURE(status)) { 571 ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev), 572 "failed to deactivate %s - %s\n", acpi_name(cooler), 573 AcpiFormatException(status)); |
585 } 586 587 return_VOID; 588} 589 590/* 591 * Given an object, verify that it's a reference to a device of some sort, 592 * and try to switch it on. 593 * | 574 } 575 576 return_VOID; 577} 578 579/* 580 * Given an object, verify that it's a reference to a device of some sort, 581 * and try to switch it on. 582 * |
594 * XXX replication of off/on function code is bad, mmmkay? | 583 * XXX replication of off/on function code is bad. |
595 */ 596static void 597acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg) 598{ 599 struct acpi_tz_softc *sc = (struct acpi_tz_softc *)arg; 600 ACPI_HANDLE cooler; 601 ACPI_STATUS status; 602 603 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); 604 605 ACPI_ASSERTLOCK; 606 | 584 */ 585static void 586acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg) 587{ 588 struct acpi_tz_softc *sc = (struct acpi_tz_softc *)arg; 589 ACPI_HANDLE cooler; 590 ACPI_STATUS status; 591 592 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); 593 594 ACPI_ASSERTLOCK; 595 |
607 switch(obj->Type) { 608 case ACPI_TYPE_ANY: 609 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n", 610 acpi_name(obj->Reference.Handle))); | 596 cooler = acpi_GetReference(NULL, obj); 597 if (cooler == NULL) { 598 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get handle\n")); 599 return_VOID; 600 } |
611 | 601 |
612 status = acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D0); 613 if (ACPI_FAILURE(status)) { 614 ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev), 615 "failed to activate %s - %s\n", 616 acpi_name(obj->Reference.Handle), 617 AcpiFormatException(status)); 618 } 619 break; 620 case ACPI_TYPE_STRING: 621 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n", 622 obj->String.Pointer)); 623 624 /* 625 * Find the handle for the device and turn it off. 626 * The String object here seems to contain a fully-qualified path, so we 627 * don't have to search for it in our parents. 628 * 629 * XXX This may not always be the case. 630 */ 631 if (ACPI_SUCCESS(AcpiGetHandle(NULL, obj->String.Pointer, &cooler))) { 632 status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0); 633 if (ACPI_FAILURE(status)) { 634 ACPI_VPRINT(sc->tz_dev, 635 acpi_device_get_parent_softc(sc->tz_dev), 636 "failed to activate %s - %s\n", 637 obj->String.Pointer, AcpiFormatException(status)); 638 } 639 } else { 640 ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev), 641 "couldn't find %s\n", obj->String.Pointer); 642 } 643 break; 644 default: 645 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "unsupported object type %d\n", 646 obj->Type)); 647 break; | 602 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n", 603 acpi_name(cooler))); 604 status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0); 605 if (ACPI_FAILURE(status)) { 606 ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev), 607 "failed to activate %s - %s\n", acpi_name(cooler), 608 AcpiFormatException(status)); |
648 } 649 650 return_VOID; 651} 652 653/* 654 * Read/debug-print a parameter, default it to -1. 655 */ --- 201 unchanged lines hidden --- | 609 } 610 611 return_VOID; 612} 613 614/* 615 * Read/debug-print a parameter, default it to -1. 616 */ --- 201 unchanged lines hidden --- |