| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: acpi.c,v 1.276 2018/10/16 10:25:33 jmcneill Exp $ */ | | 1 | /* $NetBSD: acpi.c,v 1.277 2018/10/16 22:29:43 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Charles M. Hannum of By Noon Software, Inc. | | 8 | * by Charles M. Hannum of By Noon Software, Inc. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -90,27 +90,27 @@ | | | @@ -90,27 +90,27 @@ |
90 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 90 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
91 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 91 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
92 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | | 92 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC |
93 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 93 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
94 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 94 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
95 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 95 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
96 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 96 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
97 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 97 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
98 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 98 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
99 | * POSSIBILITY OF SUCH DAMAGE. | | 99 | * POSSIBILITY OF SUCH DAMAGE. |
100 | */ | | 100 | */ |
101 | | | 101 | |
102 | #include <sys/cdefs.h> | | 102 | #include <sys/cdefs.h> |
103 | __KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.276 2018/10/16 10:25:33 jmcneill Exp $"); | | 103 | __KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.277 2018/10/16 22:29:43 jmcneill Exp $"); |
104 | | | 104 | |
105 | #include "pci.h" | | 105 | #include "pci.h" |
106 | #include "opt_acpi.h" | | 106 | #include "opt_acpi.h" |
107 | #include "opt_pcifixup.h" | | 107 | #include "opt_pcifixup.h" |
108 | | | 108 | |
109 | #include <sys/param.h> | | 109 | #include <sys/param.h> |
110 | #include <sys/device.h> | | 110 | #include <sys/device.h> |
111 | #include <sys/kernel.h> | | 111 | #include <sys/kernel.h> |
112 | #include <sys/kmem.h> | | 112 | #include <sys/kmem.h> |
113 | #include <sys/malloc.h> | | 113 | #include <sys/malloc.h> |
114 | #include <sys/module.h> | | 114 | #include <sys/module.h> |
115 | #include <sys/mutex.h> | | 115 | #include <sys/mutex.h> |
116 | #include <sys/sysctl.h> | | 116 | #include <sys/sysctl.h> |
| @@ -514,36 +514,37 @@ acpi_attach(device_t parent, device_t se | | | @@ -514,36 +514,37 @@ acpi_attach(device_t parent, device_t se |
514 | ACPI_SYSTEM_NOTIFY, acpi_notify_handler, NULL); | | 514 | ACPI_SYSTEM_NOTIFY, acpi_notify_handler, NULL); |
515 | | | 515 | |
516 | if (ACPI_FAILURE(rv)) | | 516 | if (ACPI_FAILURE(rv)) |
517 | goto fail; | | 517 | goto fail; |
518 | | | 518 | |
519 | rv = AcpiInstallNotifyHandler(ACPI_ROOT_OBJECT, | | 519 | rv = AcpiInstallNotifyHandler(ACPI_ROOT_OBJECT, |
520 | ACPI_DEVICE_NOTIFY, acpi_notify_handler, NULL); | | 520 | ACPI_DEVICE_NOTIFY, acpi_notify_handler, NULL); |
521 | | | 521 | |
522 | if (ACPI_FAILURE(rv)) | | 522 | if (ACPI_FAILURE(rv)) |
523 | goto fail; | | 523 | goto fail; |
524 | | | 524 | |
525 | acpi_active = 1; | | 525 | acpi_active = 1; |
526 | | | 526 | |
527 | /* Show SCI interrupt. */ | | 527 | if (!AcpiGbl_ReducedHardware) { |
528 | if (AcpiGbl_FADT.SciInterrupt != 0) | | 528 | /* Show SCI interrupt. */ |
529 | aprint_verbose_dev(self, "SCI interrupting at int %u\n", | | 529 | aprint_verbose_dev(self, "SCI interrupting at int %u\n", |
530 | AcpiGbl_FADT.SciInterrupt); | | 530 | AcpiGbl_FADT.SciInterrupt); |
531 | | | 531 | |
532 | /* | | 532 | /* |
533 | * Install fixed-event handlers. | | 533 | * Install fixed-event handlers. |
534 | */ | | 534 | */ |
535 | acpi_register_fixed_button(sc, ACPI_EVENT_POWER_BUTTON); | | 535 | acpi_register_fixed_button(sc, ACPI_EVENT_POWER_BUTTON); |
536 | acpi_register_fixed_button(sc, ACPI_EVENT_SLEEP_BUTTON); | | 536 | acpi_register_fixed_button(sc, ACPI_EVENT_SLEEP_BUTTON); |
| | | 537 | } |
537 | | | 538 | |
538 | acpitimer_init(sc); | | 539 | acpitimer_init(sc); |
539 | acpi_config_tree(sc); | | 540 | acpi_config_tree(sc); |
540 | acpi_sleep_init(sc); | | 541 | acpi_sleep_init(sc); |
541 | | | 542 | |
542 | #ifdef ACPI_DEBUG | | 543 | #ifdef ACPI_DEBUG |
543 | acpi_debug_init(); | | 544 | acpi_debug_init(); |
544 | #endif | | 545 | #endif |
545 | | | 546 | |
546 | /* | | 547 | /* |
547 | * Print debug information. | | 548 | * Print debug information. |
548 | */ | | 549 | */ |
549 | acpi_print_verbose(sc); | | 550 | acpi_print_verbose(sc); |
| @@ -573,28 +574,30 @@ acpi_detach(device_t self, int flags) | | | @@ -573,28 +574,30 @@ acpi_detach(device_t self, int flags) |
573 | | | 574 | |
574 | rv = AcpiRemoveNotifyHandler(ACPI_ROOT_OBJECT, | | 575 | rv = AcpiRemoveNotifyHandler(ACPI_ROOT_OBJECT, |
575 | ACPI_DEVICE_NOTIFY, acpi_notify_handler); | | 576 | ACPI_DEVICE_NOTIFY, acpi_notify_handler); |
576 | | | 577 | |
577 | if (ACPI_FAILURE(rv)) | | 578 | if (ACPI_FAILURE(rv)) |
578 | return EBUSY; | | 579 | return EBUSY; |
579 | | | 580 | |
580 | if ((rc = config_detach_children(self, flags)) != 0) | | 581 | if ((rc = config_detach_children(self, flags)) != 0) |
581 | return rc; | | 582 | return rc; |
582 | | | 583 | |
583 | if ((rc = acpitimer_detach()) != 0) | | 584 | if ((rc = acpitimer_detach()) != 0) |
584 | return rc; | | 585 | return rc; |
585 | | | 586 | |
586 | acpi_deregister_fixed_button(sc, ACPI_EVENT_POWER_BUTTON); | | 587 | if (!AcpiGbl_ReducedHardware) { |
587 | acpi_deregister_fixed_button(sc, ACPI_EVENT_SLEEP_BUTTON); | | 588 | acpi_deregister_fixed_button(sc, ACPI_EVENT_POWER_BUTTON); |
| | | 589 | acpi_deregister_fixed_button(sc, ACPI_EVENT_SLEEP_BUTTON); |
| | | 590 | } |
588 | | | 591 | |
589 | pmf_device_deregister(self); | | 592 | pmf_device_deregister(self); |
590 | | | 593 | |
591 | acpi_softc = NULL; | | 594 | acpi_softc = NULL; |
592 | | | 595 | |
593 | return 0; | | 596 | return 0; |
594 | } | | 597 | } |
595 | | | 598 | |
596 | static void | | 599 | static void |
597 | acpi_childdet(device_t self, device_t child) | | 600 | acpi_childdet(device_t self, device_t child) |
598 | { | | 601 | { |
599 | struct acpi_softc *sc = device_private(self); | | 602 | struct acpi_softc *sc = device_private(self); |
600 | struct acpi_devnode *ad; | | 603 | struct acpi_devnode *ad; |