Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jun 2011 14:56:04 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        "deeptech71@gmail.com" <deeptech71@gmail.com>
Subject:   Re: pcib allocation failure
Message-ID:  <201106091456.04528.jhb@freebsd.org>
In-Reply-To: <BANLkTi=1JkJyvd=e%2B4WCpdvRNyLXGb2X=A@mail.gmail.com>
References:  <BANLkTikTHFTHff5iuPDMxR6zhezEcTaZSA@mail.gmail.com> <201106090922.45150.jhb@freebsd.org> <BANLkTi=1JkJyvd=e%2B4WCpdvRNyLXGb2X=A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, June 09, 2011 2:07:31 pm deeptech71@gmail.com wrote:
> pcib1: attempting to grow prefetch window for (0xe0000000-0xefffffff,0x10000000)
> 	back candidate range: 0xe0000000-0xefffffff
> pcib1: failed to grow prefetch window to 0xd0000000-0xefffffff: 6

Hmm, ENXIO is an odd error.  rman_adjust_resource() can't fail with that.

Oh, I missed adding bus_adjust_resource() to the x86 "nexus" drivers. :(

Try this patch in addition to the patch to pci_pci.c that you are already using:

Index: amd64/amd64/legacy.c
===================================================================
--- amd64/amd64/legacy.c	(revision 222897)
+++ amd64/amd64/legacy.c	(working copy)
@@ -81,6 +81,7 @@
 	DEVMETHOD(bus_read_ivar,	legacy_read_ivar),
 	DEVMETHOD(bus_write_ivar,	legacy_write_ivar),
 	DEVMETHOD(bus_alloc_resource,	bus_generic_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),
Index: dev/acpica/acpi.c
===================================================================
--- dev/acpica/acpi.c	(revision 222897)
+++ dev/acpica/acpi.c	(working copy)
@@ -123,6 +123,8 @@
 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,
@@ -193,6 +195,7 @@
     DEVMETHOD(bus_set_resource,		acpi_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),
@@ -1325,29 +1328,40 @@
 }
 
 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;
+
     /*
      * If this resource belongs to one of our internal managers,
      * deactivate it and release it to the local pool.
      */
-    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)
Index: i386/i386/legacy.c
===================================================================
--- i386/i386/legacy.c	(revision 222897)
+++ i386/i386/legacy.c	(working copy)
@@ -86,6 +86,7 @@
 	DEVMETHOD(bus_read_ivar,	legacy_read_ivar),
 	DEVMETHOD(bus_write_ivar,	legacy_write_ivar),
 	DEVMETHOD(bus_alloc_resource,	bus_generic_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),

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106091456.04528.jhb>