aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2011-06-24 17:29:41 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2011-06-24 17:29:41 +0000
commit96a28bd684fcef82f10f7b10f0ac86d1d8644d50 (patch)
tree4f6e5c95bf3d6dafeaf9eaf89c2f04894a808934 /sys/dev
parent1a3e3b32d8fbf5a8cc1da7bffeebf6d3d470abfb (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi.c36
-rw-r--r--sys/dev/acpica/acpi_pcib_acpi.c1
-rw-r--r--sys/dev/pci/pci.c1
-rw-r--r--sys/dev/pci/pci_pci.c1
4 files changed, 28 insertions, 11 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 0deaf397056d..a2e52e4c179a 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -124,6 +124,8 @@ static int acpi_sysres_alloc(device_t dev);
static struct resource *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);
+static int acpi_adjust_resource(device_t bus, device_t child, int type,
+ struct resource *r, u_long start, u_long end);
static int acpi_release_resource(device_t bus, device_t child, int type,
int rid, struct resource *r);
static void acpi_delete_resource(device_t bus, device_t child, int type,
@@ -197,6 +199,7 @@ static device_method_t acpi_methods[] = {
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
DEVMETHOD(bus_alloc_resource, acpi_alloc_resource),
+ DEVMETHOD(bus_adjust_resource, acpi_adjust_resource),
DEVMETHOD(bus_release_resource, acpi_release_resource),
DEVMETHOD(bus_delete_resource, acpi_delete_resource),
DEVMETHOD(bus_child_pnpinfo_str, acpi_child_pnpinfo_str_method),
@@ -1231,23 +1234,34 @@ out:
}
static int
-acpi_release_resource(device_t bus, device_t child, int type, int rid,
- struct resource *r)
+acpi_is_resource_managed(int type, struct resource *r)
{
- struct rman *rm;
- int ret;
/* We only handle memory and IO resources through rman. */
switch (type) {
case SYS_RES_IOPORT:
- rm = &acpi_rman_io;
- break;
+ return (rman_is_region_manager(r, &acpi_rman_io));
case SYS_RES_MEMORY:
- rm = &acpi_rman_mem;
- break;
- default:
- rm = NULL;
+ return (rman_is_region_manager(r, &acpi_rman_mem));
}
+ return (0);
+}
+
+static int
+acpi_adjust_resource(device_t bus, device_t child, int type, struct resource *r,
+ u_long start, u_long end)
+{
+
+ if (acpi_is_resource_managed(type, r))
+ return (rman_adjust_resource(r, start, end));
+ return (bus_generic_adjust_resource(bus, child, type, r, start, end));
+}
+
+static int
+acpi_release_resource(device_t bus, device_t child, int type, int rid,
+ struct resource *r)
+{
+ int ret;
ACPI_SERIAL_BEGIN(acpi);
@@ -1256,7 +1270,7 @@ acpi_release_resource(device_t bus, device_t child, int type, int rid,
* deactivate it and release it to the local pool. If it doesn't,
* pass this request up to the parent.
*/
- if (rm != NULL && rman_is_region_manager(r, rm)) {
+ if (acpi_is_resource_managed(type, r)) {
if (rman_get_flags(r) & RF_ACTIVE) {
ret = bus_deactivate_resource(child, type, rid, r);
if (ret != 0)
diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c
index 72753303cc13..d1b517efdf9b 100644
--- a/sys/dev/acpica/acpi_pcib_acpi.c
+++ b/sys/dev/acpica/acpi_pcib_acpi.c
@@ -100,6 +100,7 @@ static device_method_t acpi_pcib_acpi_methods[] = {
DEVMETHOD(bus_read_ivar, acpi_pcib_read_ivar),
DEVMETHOD(bus_write_ivar, acpi_pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, acpi_pcib_acpi_alloc_resource),
+ DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 1b1e4caf3484..c8e196b0ffe1 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -142,6 +142,7 @@ static device_method_t pci_methods[] = {
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
DEVMETHOD(bus_delete_resource, pci_delete_resource),
DEVMETHOD(bus_alloc_resource, pci_alloc_resource),
+ DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource),
DEVMETHOD(bus_activate_resource, pci_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 3d664baf9b78..cb8136c47c4b 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -68,6 +68,7 @@ static device_method_t pcib_methods[] = {
DEVMETHOD(bus_read_ivar, pcib_read_ivar),
DEVMETHOD(bus_write_ivar, pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, pcib_alloc_resource),
+ DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),