acpi_button.c (91123) | acpi_button.c (96926) |
---|---|
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 91123 2002-02-23 05:26:45Z msmith $ | 28 * $FreeBSD: head/sys/dev/acpica/acpi_button.c 96926 2002-05-19 06:16:47Z peter $ |
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" --- 61 unchanged lines hidden (view full) --- 98} 99 100static int 101acpi_button_attach(device_t dev) 102{ 103 struct acpi_button_softc *sc; 104 ACPI_STATUS status; 105 | 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" --- 61 unchanged lines hidden (view full) --- 98} 99 100static int 101acpi_button_attach(device_t dev) 102{ 103 struct acpi_button_softc *sc; 104 ACPI_STATUS status; 105 |
106 ACPI_FUNCTION_TRACE(__func__); | 106 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); |
107 108 sc = device_get_softc(dev); 109 sc->button_dev = dev; 110 sc->button_handle = acpi_get_handle(dev); 111 112 if (ACPI_FAILURE(status = AcpiInstallNotifyHandler(sc->button_handle, ACPI_DEVICE_NOTIFY, 113 acpi_button_notify_handler, sc))) { 114 device_printf(sc->button_dev, "couldn't install Notify handler - %s\n", AcpiFormatException(status)); 115 return_VALUE(ENXIO); 116 } 117 return_VALUE(0); 118} 119 120static void 121acpi_button_notify_pressed_for_sleep(void *arg) 122{ 123 struct acpi_button_softc *sc; 124 struct acpi_softc *acpi_sc; 125 | 107 108 sc = device_get_softc(dev); 109 sc->button_dev = dev; 110 sc->button_handle = acpi_get_handle(dev); 111 112 if (ACPI_FAILURE(status = AcpiInstallNotifyHandler(sc->button_handle, ACPI_DEVICE_NOTIFY, 113 acpi_button_notify_handler, sc))) { 114 device_printf(sc->button_dev, "couldn't install Notify handler - %s\n", AcpiFormatException(status)); 115 return_VALUE(ENXIO); 116 } 117 return_VALUE(0); 118} 119 120static void 121acpi_button_notify_pressed_for_sleep(void *arg) 122{ 123 struct acpi_button_softc *sc; 124 struct acpi_softc *acpi_sc; 125 |
126 ACPI_FUNCTION_TRACE(__func__); | 126 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); |
127 128 sc = (struct acpi_button_softc *)arg; 129 acpi_sc = acpi_device_get_parent_softc(sc->button_dev); 130 if (acpi_sc == NULL) { 131 return_VOID; 132 } 133 134 switch (sc->button_type) { --- 14 unchanged lines hidden (view full) --- 149} 150 151static void 152acpi_button_notify_pressed_for_wakeup(void *arg) 153{ 154 struct acpi_button_softc *sc; 155 struct acpi_softc *acpi_sc; 156 | 127 128 sc = (struct acpi_button_softc *)arg; 129 acpi_sc = acpi_device_get_parent_softc(sc->button_dev); 130 if (acpi_sc == NULL) { 131 return_VOID; 132 } 133 134 switch (sc->button_type) { --- 14 unchanged lines hidden (view full) --- 149} 150 151static void 152acpi_button_notify_pressed_for_wakeup(void *arg) 153{ 154 struct acpi_button_softc *sc; 155 struct acpi_softc *acpi_sc; 156 |
157 ACPI_FUNCTION_TRACE(__func__); | 157 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); |
158 159 sc = (struct acpi_button_softc *)arg; 160 acpi_sc = acpi_device_get_parent_softc(sc->button_dev); 161 if (acpi_sc == NULL) { 162 return_VOID; 163 } 164 165 switch (sc->button_type) { --- 17 unchanged lines hidden (view full) --- 183#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP 0x80 184#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP 0x02 185 186static void 187acpi_button_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) 188{ 189 struct acpi_button_softc *sc = (struct acpi_button_softc *)context; 190 | 158 159 sc = (struct acpi_button_softc *)arg; 160 acpi_sc = acpi_device_get_parent_softc(sc->button_dev); 161 if (acpi_sc == NULL) { 162 return_VOID; 163 } 164 165 switch (sc->button_type) { --- 17 unchanged lines hidden (view full) --- 183#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP 0x80 184#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP 0x02 185 186static void 187acpi_button_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) 188{ 189 struct acpi_button_softc *sc = (struct acpi_button_softc *)context; 190 |
191 ACPI_FUNCTION_TRACE_U32(__func__, notify); | 191 ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, notify); |
192 193 switch (notify) { 194 case ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP: 195 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_sleep, sc); 196 break; 197 case ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP: 198 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_wakeup, sc); 199 break; 200 default: 201 break; /* unknown notification value */ 202 } 203 return_VOID; 204} 205 206 | 192 193 switch (notify) { 194 case ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP: 195 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_sleep, sc); 196 break; 197 case ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP: 198 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_wakeup, sc); 199 break; 200 default: 201 break; /* unknown notification value */ 202 } 203 return_VOID; 204} 205 206 |