Deleted Added
full compact
acpi_powerres.c (227293) acpi_powerres.c (238199)
1/*-
2 * Copyright (c) 2001 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_powerres.c 227293 2011-11-07 06:44:47Z ed $");
28__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_powerres.c 238199 2012-07-07 17:13:09Z eadler $");
29
30#include "opt_acpi.h"
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/malloc.h>
34#include <sys/bus.h>
35
36#include <contrib/dev/acpica/include/acpi.h>

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

309acpi_pwr_switch_consumer(ACPI_HANDLE consumer, int state)
310{
311 struct acpi_powerconsumer *pc;
312 ACPI_HANDLE method_handle, reslist_handle, pr0_handle;
313 ACPI_BUFFER reslist_buffer;
314 ACPI_OBJECT *reslist_object;
315 ACPI_STATUS status;
316 char *method_name, *reslist_name;
29
30#include "opt_acpi.h"
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/malloc.h>
34#include <sys/bus.h>
35
36#include <contrib/dev/acpica/include/acpi.h>

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

309acpi_pwr_switch_consumer(ACPI_HANDLE consumer, int state)
310{
311 struct acpi_powerconsumer *pc;
312 ACPI_HANDLE method_handle, reslist_handle, pr0_handle;
313 ACPI_BUFFER reslist_buffer;
314 ACPI_OBJECT *reslist_object;
315 ACPI_STATUS status;
316 char *method_name, *reslist_name;
317 int res_changed;
318
319 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
320
321 /* It's never ok to switch a non-existent consumer. */
322 if (consumer == NULL)
323 return_ACPI_STATUS (AE_NOT_FOUND);
324 reslist_buffer.Pointer = NULL;
325 reslist_object = NULL;

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

440 goto out;
441 }
442 }
443
444 /*
445 * Now we are ready to switch, so kill off any current power
446 * resource references.
447 */
317
318 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
319
320 /* It's never ok to switch a non-existent consumer. */
321 if (consumer == NULL)
322 return_ACPI_STATUS (AE_NOT_FOUND);
323 reslist_buffer.Pointer = NULL;
324 reslist_object = NULL;

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

439 goto out;
440 }
441 }
442
443 /*
444 * Now we are ready to switch, so kill off any current power
445 * resource references.
446 */
448 res_changed = acpi_pwr_dereference_resource(pc);
447 acpi_pwr_dereference_resource(pc);
449
450 /*
451 * Add new power resource references, if we have any. Traverse the
452 * package that we got from evaluating reslist_handle, and look up each
453 * of the resources that are referenced.
454 */
455 if (reslist_object != NULL) {
456 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "referencing %d new resources\n",
457 reslist_object->Package.Count));
458 acpi_ForeachPackageObject(reslist_object, acpi_pwr_reference_resource,
459 pc);
448
449 /*
450 * Add new power resource references, if we have any. Traverse the
451 * package that we got from evaluating reslist_handle, and look up each
452 * of the resources that are referenced.
453 */
454 if (reslist_object != NULL) {
455 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "referencing %d new resources\n",
456 reslist_object->Package.Count));
457 acpi_ForeachPackageObject(reslist_object, acpi_pwr_reference_resource,
458 pc);
460 res_changed = 1;
461 }
462
463 /*
464 * If we changed anything in the resource list, we need to run a switch
465 * pass now.
466 */
467 if (ACPI_FAILURE(status = acpi_pwr_switch_power())) {
468 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,

--- 291 unchanged lines hidden ---
459 }
460
461 /*
462 * If we changed anything in the resource list, we need to run a switch
463 * pass now.
464 */
465 if (ACPI_FAILURE(status = acpi_pwr_switch_power())) {
466 ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,

--- 291 unchanged lines hidden ---