summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-10-12 14:13:32 +0000
committerjhb <jhb@FreeBSD.org>2011-10-12 14:13:32 +0000
commitbd75d0e5b6c6ff0c69e1dee707b3b627013ecf47 (patch)
treee3d0901cd1397b28852c9dc625b4a00beb928cb1 /sys/dev
parent0a6da59b6136e874b57c98c59fd355951f60b93d (diff)
downloadFreeBSD-src-bd75d0e5b6c6ff0c69e1dee707b3b627013ecf47.zip
FreeBSD-src-bd75d0e5b6c6ff0c69e1dee707b3b627013ecf47.tar.gz
If an allocation for a specific resource range fails because it is not in
a decoded range for an ACPI Host-PCI bridge, try to allocate it from the ACPI system resource range. If that works, permit the resource allocation regardless. MFC after: 1 week
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi.c24
-rw-r--r--sys/dev/acpica/acpi_pcib_acpi.c8
-rw-r--r--sys/dev/acpica/acpivar.h2
3 files changed, 27 insertions, 7 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 1d0cc23..5047e61 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1238,7 +1238,6 @@ acpi_alloc_resource(device_t bus, device_t child, int type, int *rid,
struct resource_list_entry *rle;
struct resource_list *rl;
struct resource *res;
- struct rman *rm;
int isdefault = (start == 0UL && end == ~0UL);
/*
@@ -1291,15 +1290,29 @@ acpi_alloc_resource(device_t bus, device_t child, int type, int *rid,
} else
res = BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, rid,
start, end, count, flags);
- if (res != NULL || start + count - 1 != end)
- return (res);
/*
* If the first attempt failed and this is an allocation of a
* specific range, try to satisfy the request via a suballocation
- * from our system resource regions. Note that we only handle
- * memory and I/O port system resources.
+ * from our system resource regions.
*/
+ if (res == NULL && start + count - 1 == end)
+ res = acpi_alloc_sysres(child, type, rid, start, end, count, flags);
+ return (res);
+}
+
+/*
+ * Attempt to allocate a specific resource range from the system
+ * resource ranges. Note that we only handle memory and I/O port
+ * system resources.
+ */
+struct resource *
+acpi_alloc_sysres(device_t child, int type, int *rid, u_long start, u_long end,
+ u_long count, u_int flags)
+{
+ struct rman *rm;
+ struct resource *res;
+
switch (type) {
case SYS_RES_IOPORT:
rm = &acpi_rman_io;
@@ -1311,6 +1324,7 @@ acpi_alloc_resource(device_t bus, device_t child, int type, int *rid,
return (NULL);
}
+ KASSERT(start + count - 1 == end, ("wildcard resource range"));
res = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE,
child);
if (res == NULL)
diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c
index b96ced5..3284fc5 100644
--- a/sys/dev/acpica/acpi_pcib_acpi.c
+++ b/sys/dev/acpica/acpi_pcib_acpi.c
@@ -501,6 +501,7 @@ acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid,
{
#ifdef NEW_PCIB
struct acpi_hpcib_softc *sc;
+ struct resource *res;
#endif
#if defined(__i386__) || defined(__amd64__)
@@ -509,8 +510,11 @@ acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid,
#ifdef NEW_PCIB
sc = device_get_softc(dev);
- return (pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end,
- count, flags));
+ res = pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end,
+ count, flags);
+ if (res == NULL && start + count - 1 == end)
+ res = acpi_alloc_sysres(child, type, rid, start, end, count, flags);
+ return (res);
#else
return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
count, flags));
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 8735776..19f8ca4 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -382,6 +382,8 @@ ACPI_STATUS acpi_lookup_irq_resource(device_t dev, int rid,
struct resource *res, ACPI_RESOURCE *acpi_res);
ACPI_STATUS acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
struct acpi_parse_resource_set *set, void *arg);
+struct resource *acpi_alloc_sysres(device_t child, int type, int *rid,
+ u_long start, u_long end, u_long count, u_int flags);
/* ACPI event handling */
UINT32 acpi_event_power_button_sleep(void *context);
OpenPOWER on IntegriCloud