Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/acpica/acpi.c
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | |||||
static int acpi_suspend(device_t dev); | static int acpi_suspend(device_t dev); | ||||
static int acpi_resume(device_t dev); | static int acpi_resume(device_t dev); | ||||
static int acpi_shutdown(device_t dev); | static int acpi_shutdown(device_t dev); | ||||
static device_t acpi_add_child(device_t bus, u_int order, const char *name, | static device_t acpi_add_child(device_t bus, u_int order, const char *name, | ||||
int unit); | int unit); | ||||
static int acpi_print_child(device_t bus, device_t child); | static int acpi_print_child(device_t bus, device_t child); | ||||
static void acpi_probe_nomatch(device_t bus, device_t child); | static void acpi_probe_nomatch(device_t bus, device_t child); | ||||
static void acpi_driver_added(device_t dev, driver_t *driver); | static void acpi_driver_added(device_t dev, driver_t *driver); | ||||
static void acpi_child_deleted(device_t dev, device_t child); | |||||
static int acpi_read_ivar(device_t dev, device_t child, int index, | static int acpi_read_ivar(device_t dev, device_t child, int index, | ||||
uintptr_t *result); | uintptr_t *result); | ||||
static int acpi_write_ivar(device_t dev, device_t child, int index, | static int acpi_write_ivar(device_t dev, device_t child, int index, | ||||
uintptr_t value); | uintptr_t value); | ||||
static struct resource_list *acpi_get_rlist(device_t dev, device_t child); | static struct resource_list *acpi_get_rlist(device_t dev, device_t child); | ||||
static void acpi_reserve_resources(device_t dev); | static void acpi_reserve_resources(device_t dev); | ||||
static int acpi_sysres_alloc(device_t dev); | static int acpi_sysres_alloc(device_t dev); | ||||
static int acpi_set_resource(device_t dev, device_t child, int type, | static int acpi_set_resource(device_t dev, device_t child, int type, | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | static device_method_t acpi_methods[] = { | ||||
DEVMETHOD(device_suspend, acpi_suspend), | DEVMETHOD(device_suspend, acpi_suspend), | ||||
DEVMETHOD(device_resume, acpi_resume), | DEVMETHOD(device_resume, acpi_resume), | ||||
/* Bus interface */ | /* Bus interface */ | ||||
DEVMETHOD(bus_add_child, acpi_add_child), | DEVMETHOD(bus_add_child, acpi_add_child), | ||||
DEVMETHOD(bus_print_child, acpi_print_child), | DEVMETHOD(bus_print_child, acpi_print_child), | ||||
DEVMETHOD(bus_probe_nomatch, acpi_probe_nomatch), | DEVMETHOD(bus_probe_nomatch, acpi_probe_nomatch), | ||||
DEVMETHOD(bus_driver_added, acpi_driver_added), | DEVMETHOD(bus_driver_added, acpi_driver_added), | ||||
DEVMETHOD(bus_child_deleted, acpi_child_deleted), | |||||
DEVMETHOD(bus_read_ivar, acpi_read_ivar), | DEVMETHOD(bus_read_ivar, acpi_read_ivar), | ||||
DEVMETHOD(bus_write_ivar, acpi_write_ivar), | DEVMETHOD(bus_write_ivar, acpi_write_ivar), | ||||
DEVMETHOD(bus_get_resource_list, acpi_get_rlist), | DEVMETHOD(bus_get_resource_list, acpi_get_rlist), | ||||
DEVMETHOD(bus_set_resource, acpi_set_resource), | DEVMETHOD(bus_set_resource, acpi_set_resource), | ||||
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), | DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), | ||||
DEVMETHOD(bus_alloc_resource, acpi_alloc_resource), | DEVMETHOD(bus_alloc_resource, acpi_alloc_resource), | ||||
DEVMETHOD(bus_adjust_resource, acpi_adjust_resource), | DEVMETHOD(bus_adjust_resource, acpi_adjust_resource), | ||||
DEVMETHOD(bus_release_resource, acpi_release_resource), | DEVMETHOD(bus_release_resource, acpi_release_resource), | ||||
▲ Show 20 Lines • Show All 692 Lines • ▼ Show 20 Lines | acpi_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf, | ||||
adinfo->CompatibleIdList.Count > 0) ? | adinfo->CompatibleIdList.Count > 0) ? | ||||
adinfo->CompatibleIdList.Ids[0].String : "none"); | adinfo->CompatibleIdList.Ids[0].String : "none"); | ||||
AcpiOsFree(adinfo); | AcpiOsFree(adinfo); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Handle device deletion. | |||||
*/ | |||||
static void | |||||
acpi_child_deleted(device_t dev, device_t child) | |||||
{ | |||||
struct acpi_device *dinfo = device_get_ivars(child); | |||||
if (acpi_get_device(dinfo->ad_handle) == child) | |||||
AcpiDetachData(dinfo->ad_handle, acpi_fake_objhandler); | |||||
} | |||||
/* | |||||
* Handle per-device ivars | * Handle per-device ivars | ||||
*/ | */ | ||||
static int | static int | ||||
acpi_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) | acpi_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) | ||||
{ | { | ||||
struct acpi_device *ad; | struct acpi_device *ad; | ||||
if ((ad = device_get_ivars(child)) == NULL) { | if ((ad = device_get_ivars(child)) == NULL) { | ||||
▲ Show 20 Lines • Show All 868 Lines • ▼ Show 20 Lines | return (AE_OK); | ||||
*/ | */ | ||||
old_dev = acpi_get_device(h); | old_dev = acpi_get_device(h); | ||||
dev = old_dev; | dev = old_dev; | ||||
status = ctx->user_fn(h, &dev, level, ctx->arg); | status = ctx->user_fn(h, &dev, level, ctx->arg); | ||||
if (ACPI_FAILURE(status) || old_dev == dev) | if (ACPI_FAILURE(status) || old_dev == dev) | ||||
return (status); | return (status); | ||||
/* Remove the old child and its connection to the handle. */ | /* Remove the old child and its connection to the handle. */ | ||||
if (old_dev != NULL) { | if (old_dev != NULL) | ||||
device_delete_child(device_get_parent(old_dev), old_dev); | device_delete_child(device_get_parent(old_dev), old_dev); | ||||
AcpiDetachData(h, acpi_fake_objhandler); | |||||
} | |||||
/* Recreate the handle association if the user created a device. */ | /* Recreate the handle association if the user created a device. */ | ||||
if (dev != NULL) | if (dev != NULL) | ||||
AcpiAttachData(h, acpi_fake_objhandler, dev); | AcpiAttachData(h, acpi_fake_objhandler, dev); | ||||
return (AE_OK); | return (AE_OK); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,506 Lines • Show Last 20 Lines |