Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jan 2014 14:54:08 -0500
From:      David Shane Holden <dpejesh@yahoo.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Atom Board ACPI API MOPNV10J failing since 9.1
Message-ID:  <52DED060.4070800@yahoo.com>
In-Reply-To: <201401211215.22021.jhb@freebsd.org>
References:  <52CF850A.9060906@erdgeist.org> <201401140823.00259.jhb@freebsd.org> <lb518g$i3h$1@ger.gmane.org> <201401211215.22021.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------070503030404060103050504
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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.

--------------070503030404060103050504
Content-Type: text/plain; charset=us-ascii;
 name="pci.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="pci.patch"

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);

--------------070503030404060103050504--



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