Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/acpica/acpi.c
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | |||||
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, | ||||
int rid, u_long start, u_long count); | int rid, rman_res_t start, rman_res_t count); | ||||
static struct resource *acpi_alloc_resource(device_t bus, device_t child, | static struct resource *acpi_alloc_resource(device_t bus, device_t child, | ||||
int type, int *rid, u_long start, u_long end, | int type, int *rid, rman_res_t start, rman_res_t end, | ||||
u_long count, u_int flags); | rman_res_t count, u_int flags); | ||||
static int acpi_adjust_resource(device_t bus, device_t child, int type, | static int acpi_adjust_resource(device_t bus, device_t child, int type, | ||||
struct resource *r, u_long start, u_long end); | struct resource *r, rman_res_t start, rman_res_t end); | ||||
static int acpi_release_resource(device_t bus, device_t child, int type, | static int acpi_release_resource(device_t bus, device_t child, int type, | ||||
int rid, struct resource *r); | int rid, struct resource *r); | ||||
static void acpi_delete_resource(device_t bus, device_t child, int type, | static void acpi_delete_resource(device_t bus, device_t child, int type, | ||||
int rid); | int rid); | ||||
static uint32_t acpi_isa_get_logicalid(device_t dev); | static uint32_t acpi_isa_get_logicalid(device_t dev); | ||||
static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count); | static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count); | ||||
static char *acpi_device_id_probe(device_t bus, device_t dev, char **ids); | static char *acpi_device_id_probe(device_t bus, device_t dev, char **ids); | ||||
static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev, | static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev, | ||||
▲ Show 20 Lines • Show All 1,104 Lines • ▼ Show 20 Lines | acpi_reserve_resources(device_t dev) | ||||
} | } | ||||
} | } | ||||
free(children, M_TEMP); | free(children, M_TEMP); | ||||
sc->acpi_resources_reserved = 1; | sc->acpi_resources_reserved = 1; | ||||
} | } | ||||
static int | static int | ||||
acpi_set_resource(device_t dev, device_t child, int type, int rid, | acpi_set_resource(device_t dev, device_t child, int type, int rid, | ||||
u_long start, u_long count) | rman_res_t start, rman_res_t count) | ||||
{ | { | ||||
struct acpi_softc *sc = device_get_softc(dev); | struct acpi_softc *sc = device_get_softc(dev); | ||||
struct acpi_device *ad = device_get_ivars(child); | struct acpi_device *ad = device_get_ivars(child); | ||||
struct resource_list *rl = &ad->ad_rl; | struct resource_list *rl = &ad->ad_rl; | ||||
ACPI_DEVICE_INFO *devinfo; | ACPI_DEVICE_INFO *devinfo; | ||||
u_long end; | rman_res_t end; | ||||
/* Ignore IRQ resources for PCI link devices. */ | /* Ignore IRQ resources for PCI link devices. */ | ||||
if (type == SYS_RES_IRQ && ACPI_ID_PROBE(dev, child, pcilink_ids) != NULL) | if (type == SYS_RES_IRQ && ACPI_ID_PROBE(dev, child, pcilink_ids) != NULL) | ||||
return (0); | return (0); | ||||
/* | /* | ||||
* Ignore most resources for PCI root bridges. Some BIOSes | * Ignore most resources for PCI root bridges. Some BIOSes | ||||
* incorrectly enumerate the memory ranges they decode as plain | * incorrectly enumerate the memory ranges they decode as plain | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | return (0); | ||||
* BIOS/firmware bug? | * BIOS/firmware bug? | ||||
*/ | */ | ||||
resource_list_reserve(rl, dev, child, type, &rid, start, end, count, 0); | resource_list_reserve(rl, dev, child, type, &rid, start, end, count, 0); | ||||
return (0); | return (0); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, | acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
ACPI_RESOURCE ares; | ACPI_RESOURCE ares; | ||||
struct acpi_device *ad; | struct acpi_device *ad; | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
struct resource_list *rl; | struct resource_list *rl; | ||||
struct resource *res; | struct resource *res; | ||||
int isdefault = (start == 0UL && end == ~0UL); | int isdefault = (start == 0UL && end == ~0UL); | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/* | /* | ||||
* Attempt to allocate a specific resource range from the system | * Attempt to allocate a specific resource range from the system | ||||
* resource ranges. Note that we only handle memory and I/O port | * resource ranges. Note that we only handle memory and I/O port | ||||
* system resources. | * system resources. | ||||
*/ | */ | ||||
struct resource * | struct resource * | ||||
acpi_alloc_sysres(device_t child, int type, int *rid, u_long start, u_long end, | acpi_alloc_sysres(device_t child, int type, int *rid, rman_res_t start, | ||||
u_long count, u_int flags) | rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct rman *rm; | struct rman *rm; | ||||
struct resource *res; | struct resource *res; | ||||
switch (type) { | switch (type) { | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
rm = &acpi_rman_io; | rm = &acpi_rman_io; | ||||
break; | break; | ||||
Show All 33 Lines | return (rman_is_region_manager(r, &acpi_rman_io)); | ||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
return (rman_is_region_manager(r, &acpi_rman_mem)); | return (rman_is_region_manager(r, &acpi_rman_mem)); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
acpi_adjust_resource(device_t bus, device_t child, int type, struct resource *r, | acpi_adjust_resource(device_t bus, device_t child, int type, struct resource *r, | ||||
u_long start, u_long end) | rman_res_t start, rman_res_t end) | ||||
{ | { | ||||
if (acpi_is_resource_managed(type, r)) | if (acpi_is_resource_managed(type, r)) | ||||
return (rman_adjust_resource(r, start, end)); | return (rman_adjust_resource(r, start, end)); | ||||
return (bus_generic_adjust_resource(bus, child, type, r, start, end)); | return (bus_generic_adjust_resource(bus, child, type, r, start, end)); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 2,594 Lines • Show Last 20 Lines |