|
Lines 49-54
__FBSDID("$FreeBSD$");
Link Here
|
| 49 |
#include <sys/uio.h> |
49 |
#include <sys/uio.h> |
| 50 |
#include <sys/proc.h> |
50 |
#include <sys/proc.h> |
| 51 |
#include <sys/kernel.h> |
51 |
#include <sys/kernel.h> |
|
|
52 |
#include <sys/limits.h> |
| 52 |
#include <sys/bus.h> |
53 |
#include <sys/bus.h> |
| 53 |
#include <sys/sbuf.h> |
54 |
#include <sys/sbuf.h> |
| 54 |
#include <sys/module.h> |
55 |
#include <sys/module.h> |
|
Lines 116-122
struct acpi_hp_inst_seq_pair {
Link Here
|
| 116 |
|
117 |
|
| 117 |
struct acpi_hp_softc { |
118 |
struct acpi_hp_softc { |
| 118 |
device_t dev; |
119 |
device_t dev; |
| 119 |
ACPI_HANDLE handle; |
|
|
| 120 |
device_t wmi_dev; |
120 |
device_t wmi_dev; |
| 121 |
int has_notify; /* notification GUID found */ |
121 |
int has_notify; /* notification GUID found */ |
| 122 |
int has_cmi; /* CMI GUID found */ |
122 |
int has_cmi; /* CMI GUID found */ |
|
Lines 289-294
static struct {
Link Here
|
| 289 |
|
289 |
|
| 290 |
ACPI_SERIAL_DECL(hp, "HP ACPI-WMI Mapping"); |
290 |
ACPI_SERIAL_DECL(hp, "HP ACPI-WMI Mapping"); |
| 291 |
|
291 |
|
|
|
292 |
static void acpi_hp_identify(driver_t *driver, device_t parent); |
| 292 |
static int acpi_hp_probe(device_t dev); |
293 |
static int acpi_hp_probe(device_t dev); |
| 293 |
static int acpi_hp_attach(device_t dev); |
294 |
static int acpi_hp_attach(device_t dev); |
| 294 |
static int acpi_hp_detach(device_t dev); |
295 |
static int acpi_hp_detach(device_t dev); |
|
Lines 320-325
static struct cdevsw hpcmi_cdevsw = {
Link Here
|
| 320 |
}; |
321 |
}; |
| 321 |
|
322 |
|
| 322 |
static device_method_t acpi_hp_methods[] = { |
323 |
static device_method_t acpi_hp_methods[] = { |
|
|
324 |
DEVMETHOD(device_identify, acpi_hp_identify), |
| 323 |
DEVMETHOD(device_probe, acpi_hp_probe), |
325 |
DEVMETHOD(device_probe, acpi_hp_probe), |
| 324 |
DEVMETHOD(device_attach, acpi_hp_attach), |
326 |
DEVMETHOD(device_attach, acpi_hp_attach), |
| 325 |
DEVMETHOD(device_detach, acpi_hp_detach), |
327 |
DEVMETHOD(device_detach, acpi_hp_detach), |
|
Lines 405-411
acpi_hp_evaluate_auto_on_off(struct acpi_hp_softc *sc)
Link Here
|
| 405 |
"WLAN on air changed to %i " |
407 |
"WLAN on air changed to %i " |
| 406 |
"(new_wlan_status is %i)\n", |
408 |
"(new_wlan_status is %i)\n", |
| 407 |
sc->was_wlan_on_air, new_wlan_status); |
409 |
sc->was_wlan_on_air, new_wlan_status); |
| 408 |
acpi_UserNotify("HP", sc->handle, |
410 |
acpi_UserNotify("HP", ACPI_ROOT_OBJECT, |
| 409 |
0xc0+sc->was_wlan_on_air); |
411 |
0xc0+sc->was_wlan_on_air); |
| 410 |
} |
412 |
} |
| 411 |
} |
413 |
} |
|
Lines 420-426
acpi_hp_evaluate_auto_on_off(struct acpi_hp_softc *sc)
Link Here
|
| 420 |
" to %i (new_bluetooth_status is %i)\n", |
422 |
" to %i (new_bluetooth_status is %i)\n", |
| 421 |
sc->was_bluetooth_on_air, |
423 |
sc->was_bluetooth_on_air, |
| 422 |
new_bluetooth_status); |
424 |
new_bluetooth_status); |
| 423 |
acpi_UserNotify("HP", sc->handle, |
425 |
acpi_UserNotify("HP", ACPI_ROOT_OBJECT, |
| 424 |
0xd0+sc->was_bluetooth_on_air); |
426 |
0xd0+sc->was_bluetooth_on_air); |
| 425 |
} |
427 |
} |
| 426 |
} |
428 |
} |
|
Lines 433-448
acpi_hp_evaluate_auto_on_off(struct acpi_hp_softc *sc)
Link Here
|
| 433 |
"WWAN on air changed to %i" |
435 |
"WWAN on air changed to %i" |
| 434 |
" (new_wwan_status is %i)\n", |
436 |
" (new_wwan_status is %i)\n", |
| 435 |
sc->was_wwan_on_air, new_wwan_status); |
437 |
sc->was_wwan_on_air, new_wwan_status); |
| 436 |
acpi_UserNotify("HP", sc->handle, |
438 |
acpi_UserNotify("HP", ACPI_ROOT_OBJECT, |
| 437 |
0xe0+sc->was_wwan_on_air); |
439 |
0xe0+sc->was_wwan_on_air); |
| 438 |
} |
440 |
} |
| 439 |
} |
441 |
} |
| 440 |
} |
442 |
} |
| 441 |
|
443 |
|
|
|
444 |
static void |
| 445 |
acpi_hp_identify(driver_t *driver, device_t parent) |
| 446 |
{ |
| 447 |
|
| 448 |
/* Don't do anything if driver is disabled. */ |
| 449 |
if (acpi_disabled("hp")) |
| 450 |
return; |
| 451 |
|
| 452 |
/* Add only a single device instance. */ |
| 453 |
if (device_find_child(parent, "acpi_hp", -1) != NULL) |
| 454 |
return; |
| 455 |
|
| 456 |
/* Make sure acpi_wmi driver is present. */ |
| 457 |
if (devclass_find("acpi_wmi") == NULL) |
| 458 |
return; |
| 459 |
|
| 460 |
/* |
| 461 |
* Add our device with late order, so that it is hopefully |
| 462 |
* probed after acpi_wmi. |
| 463 |
* XXX User proper constant instead of UCHAR_MAX for order. |
| 464 |
*/ |
| 465 |
if (BUS_ADD_CHILD(parent, UCHAR_MAX, "acpi_hp", -1) == NULL) |
| 466 |
device_printf(parent, "add acpi_hp child failed\n"); |
| 467 |
} |
| 468 |
|
| 442 |
static int |
469 |
static int |
| 443 |
acpi_hp_probe(device_t dev) |
470 |
acpi_hp_probe(device_t dev) |
| 444 |
{ |
471 |
{ |
| 445 |
if (acpi_disabled("hp") || device_get_unit(dev) != 0) |
472 |
|
|
|
473 |
/* Skip auto-enumerated devices from ACPI namespace. */ |
| 474 |
if (acpi_get_handle(dev) != NULL) |
| 446 |
return (ENXIO); |
475 |
return (ENXIO); |
| 447 |
device_set_desc(dev, "HP ACPI-WMI Mapping"); |
476 |
device_set_desc(dev, "HP ACPI-WMI Mapping"); |
| 448 |
|
477 |
|
|
Lines 460-466
acpi_hp_attach(device_t dev)
Link Here
|
| 460 |
|
489 |
|
| 461 |
sc = device_get_softc(dev); |
490 |
sc = device_get_softc(dev); |
| 462 |
sc->dev = dev; |
491 |
sc->dev = dev; |
| 463 |
sc->handle = acpi_get_handle(dev); |
|
|
| 464 |
sc->has_notify = 0; |
492 |
sc->has_notify = 0; |
| 465 |
sc->has_cmi = 0; |
493 |
sc->has_cmi = 0; |
| 466 |
sc->bluetooth_enable_if_radio_on = 0; |
494 |
sc->bluetooth_enable_if_radio_on = 0; |
|
Lines 477-483
acpi_hp_attach(device_t dev)
Link Here
|
| 477 |
sc->verbose = 0; |
505 |
sc->verbose = 0; |
| 478 |
memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); |
506 |
memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); |
| 479 |
|
507 |
|
| 480 |
if (!(wmi_devclass = devclass_find ("acpi_wmi"))) { |
508 |
if (!(wmi_devclass = devclass_find("acpi_wmi"))) { |
| 481 |
device_printf(dev, "Couldn't find acpi_wmi devclass\n"); |
509 |
device_printf(dev, "Couldn't find acpi_wmi devclass\n"); |
| 482 |
return (EINVAL); |
510 |
return (EINVAL); |
| 483 |
} |
511 |
} |