Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/acpica/acpi.c
Show First 20 Lines • Show All 1,352 Lines • ▼ Show 20 Lines | return (0); | ||||
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, | ||||
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
#ifndef INTRNG | |||||
ACPI_RESOURCE ares; | ACPI_RESOURCE ares; | ||||
#endif | |||||
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 = RMAN_IS_DEFAULT_RANGE(start, end); | int isdefault = RMAN_IS_DEFAULT_RANGE(start, end); | ||||
/* | /* | ||||
* First attempt at allocating the resource. For direct children, | * First attempt at allocating the resource. For direct children, | ||||
Show All 10 Lines | #endif | ||||
* a resource that doesn't exist, use bus_set_resource() to | * a resource that doesn't exist, use bus_set_resource() to | ||||
* add the resource before allocating it. Note that these | * add the resource before allocating it. Note that these | ||||
* resources will not be reserved. | * resources will not be reserved. | ||||
*/ | */ | ||||
if (!isdefault && resource_list_find(rl, type, *rid) == NULL) | if (!isdefault && resource_list_find(rl, type, *rid) == NULL) | ||||
resource_list_add(rl, type, *rid, start, end, count); | resource_list_add(rl, type, *rid, start, end, count); | ||||
res = resource_list_alloc(rl, bus, child, type, rid, start, end, count, | res = resource_list_alloc(rl, bus, child, type, rid, start, end, count, | ||||
flags); | flags); | ||||
#ifndef INTRNG | |||||
if (res != NULL && type == SYS_RES_IRQ) { | if (res != NULL && type == SYS_RES_IRQ) { | ||||
/* | /* | ||||
* Since bus_config_intr() takes immediate effect, we cannot | * Since bus_config_intr() takes immediate effect, we cannot | ||||
* configure the interrupt associated with a device when we | * configure the interrupt associated with a device when we | ||||
* parse the resources but have to defer it until a driver | * parse the resources but have to defer it until a driver | ||||
* actually allocates the interrupt via bus_alloc_resource(). | * actually allocates the interrupt via bus_alloc_resource(). | ||||
* | * | ||||
* XXX: Should we handle the lookup failing? | * XXX: Should we handle the lookup failing? | ||||
*/ | */ | ||||
if (ACPI_SUCCESS(acpi_lookup_irq_resource(child, *rid, res, &ares))) | if (ACPI_SUCCESS(acpi_lookup_irq_resource(child, *rid, res, &ares))) | ||||
acpi_config_intr(child, &ares); | acpi_config_intr(child, &ares); | ||||
} | } | ||||
#endif | |||||
/* | /* | ||||
* If this is an allocation of the "default" range for a given | * If this is an allocation of the "default" range for a given | ||||
* RID, fetch the exact bounds for this resource from the | * RID, fetch the exact bounds for this resource from the | ||||
* resource list entry to try to allocate the range from the | * resource list entry to try to allocate the range from the | ||||
* system resource regions. | * system resource regions. | ||||
*/ | */ | ||||
if (res == NULL && isdefault) { | if (res == NULL && isdefault) { | ||||
▲ Show 20 Lines • Show All 2,743 Lines • Show Last 20 Lines |