Deleted Added
full compact
acpi_button.c (125986) acpi_button.c (126014)
1/*-
2 * Copyright (c) 2000 Mitsaru IWASAKI <iwasaki@jp.freebsd.org>
3 * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000 BSDi
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

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

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 2000 Mitsaru IWASAKI <iwasaki@jp.freebsd.org>
3 * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000 BSDi
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

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

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/dev/acpica/acpi_button.c 125986 2004-02-19 05:35:20Z njl $
28 * $FreeBSD: head/sys/dev/acpica/acpi_button.c 126014 2004-02-19 18:16:34Z njl $
29 */
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/bus.h>
35
36#include "acpi.h"

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

125 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
126
127 sc = device_get_softc(dev);
128 sc->button_dev = dev;
129 sc->button_handle = acpi_get_handle(dev);
130 event = (sc->button_type == ACPI_SLEEP_BUTTON) ?
131 ACPI_EVENT_SLEEP_BUTTON : ACPI_EVENT_POWER_BUTTON;
132
29 */
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/bus.h>
35
36#include "acpi.h"

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

125 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
126
127 sc = device_get_softc(dev);
128 sc->button_dev = dev;
129 sc->button_handle = acpi_get_handle(dev);
130 event = (sc->button_type == ACPI_SLEEP_BUTTON) ?
131 ACPI_EVENT_SLEEP_BUTTON : ACPI_EVENT_POWER_BUTTON;
132
133 /* Install the appropriate new handler. */
133 /*
134 * Install the new handler. We could remove any fixed handlers added
135 * from the FADT once we have a duplicate from the AML but some systems
136 * only return events on one or the other so we have to keep both.
137 */
134 if (sc->fixed) {
135 AcpiClearEvent(event);
136 status = AcpiInstallFixedEventHandler(event,
137 acpi_button_fixed_handler, sc);
138 } else {
139 status = AcpiInstallNotifyHandler(sc->button_handle,
140 ACPI_DEVICE_NOTIFY, acpi_button_notify_handler, sc);
141 }
142 if (ACPI_FAILURE(status)) {
143 device_printf(sc->button_dev, "couldn't install notify handler - %s\n",
144 AcpiFormatException(status));
145 return_VALUE (ENXIO);
146 }
147 acpi_device_enable_wake_capability(sc->button_handle, 1);
148
138 if (sc->fixed) {
139 AcpiClearEvent(event);
140 status = AcpiInstallFixedEventHandler(event,
141 acpi_button_fixed_handler, sc);
142 } else {
143 status = AcpiInstallNotifyHandler(sc->button_handle,
144 ACPI_DEVICE_NOTIFY, acpi_button_notify_handler, sc);
145 }
146 if (ACPI_FAILURE(status)) {
147 device_printf(sc->button_dev, "couldn't install notify handler - %s\n",
148 AcpiFormatException(status));
149 return_VALUE (ENXIO);
150 }
151 acpi_device_enable_wake_capability(sc->button_handle, 1);
152
149 /*
150 * If we have fixed buttons defined in the FADT, remove them now that
151 * we have found one in the AML. Some systems define buttons both ways
152 * but only deliver events to the AML object.
153 */
154 if (event == ACPI_EVENT_POWER_BUTTON && AcpiGbl_FADT->PwrButton == 0)
155 AcpiRemoveFixedEventHandler(event, acpi_event_power_button_sleep);
156 if (event == ACPI_EVENT_SLEEP_BUTTON && AcpiGbl_FADT->SleepButton == 0)
157 AcpiRemoveFixedEventHandler(event, acpi_event_sleep_button_sleep);
158
159 return_VALUE (0);
160}
161
162static int
163acpi_button_suspend(device_t dev)
164{
165 struct acpi_button_softc *sc;
166

--- 104 unchanged lines hidden ---
153 return_VALUE (0);
154}
155
156static int
157acpi_button_suspend(device_t dev)
158{
159 struct acpi_button_softc *sc;
160

--- 104 unchanged lines hidden ---