Atom Board ACPI API MOPNV10J failing since 9.1

David Shane Holden dpejesh at yahoo.com
Tue Jan 21 19:54:18 UTC 2014


On 01/21/14 12:15, John Baldwin wrote:
>
> Hmm, I think I see the issue, and I might have a fix for it in the
> works already.  The problem is that we haven't reserved pcib1's
> windows when agp probes, so agp0 steals a resource that is already
> in use.  The change I have that might fix this isn't trivial though,
> so I don't have a patch I can just give you to test right now. :(
> Also, this isn't a BIOS issue per se.
>

I came to the same conclusion a few days ago when I started digging into
it more.  The agp driver requests some memory and the resource manager
gives it a chunk which should be reserved for the bridge.  I couldn't
find an elegant solution; the best I could come up with was to add the
bridge devices first in pci_add_children() to ensure they got attached
before anything else.  Which worked, but seems like a hack.  Feel free
to ping me if you have something that needs testing.
-------------- next part --------------
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 4d8837f..38c102f 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -3278,7 +3278,8 @@ pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size)
 			dinfo = pci_read_device(pcib, domain, busno, s, f,
 			    dinfo_size);
 			if (dinfo != NULL) {
-				pci_add_child(dev, dinfo);
+				pci_add_child_ordered(dev,
+				(hdrtype & PCIM_HDRTYPE) == PCIM_HDRTYPE_BRIDGE ? 0 : 1, dinfo);
 			}
 		}
 	}
@@ -3288,7 +3289,13 @@ pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size)
 void
 pci_add_child(device_t bus, struct pci_devinfo *dinfo)
 {
-	dinfo->cfg.dev = device_add_child(bus, NULL, -1);
+	pci_add_child_ordered(bus, 0, dinfo);
+}
+
+void
+pci_add_child_ordered(device_t bus, u_int order, struct pci_devinfo *dinfo)
+{
+	dinfo->cfg.dev = device_add_child_ordered(bus, order, NULL, -1);
 	device_set_ivars(dinfo->cfg.dev, dinfo);
 	resource_list_init(&dinfo->resources);
 	pci_cfg_save(dinfo->cfg.dev, dinfo, 0);
diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h
index 1502288..10536fc 100644
--- a/sys/dev/pci/pci_private.h
+++ b/sys/dev/pci/pci_private.h
@@ -48,6 +48,8 @@ extern int 	pci_do_power_suspend;
 void		pci_add_children(device_t dev, int domain, int busno,
 		    size_t dinfo_size);
 void		pci_add_child(device_t bus, struct pci_devinfo *dinfo);
+void		pci_add_child_ordered(device_t bus, u_int order,
+		    struct pci_devinfo *dinfo);
 void		pci_add_resources(device_t bus, device_t dev, int force,
 		    uint32_t prefetchmask);
 int		pci_attach_common(device_t dev);


More information about the freebsd-hackers mailing list