Re: pcib allocation failure

From: John Baldwin <jhb_at_freebsd.org>
Date: Thu, 9 Jun 2011 14:56:04 -0400
On Thursday, June 09, 2011 2:07:31 pm deeptech71_at_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)
_at__at_ -81,6 +81,7 _at__at_
 	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)
_at__at_ -123,6 +123,8 _at__at_
 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,
_at__at_ -193,6 +195,7 _at__at_
     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),
_at__at_ -1325,29 +1328,40 _at__at_
 }
 
 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)
_at__at_ -86,6 +86,7 _at__at_
 	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
Received on Thu Jun 09 2011 - 16:56:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:14 UTC