From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 21 19:54:18 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D23BE1E0 for ; Tue, 21 Jan 2014 19:54:18 +0000 (UTC) Received: from nm48-vm10.bullet.mail.bf1.yahoo.com (nm48-vm10.bullet.mail.bf1.yahoo.com [216.109.114.235]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 827631290 for ; Tue, 21 Jan 2014 19:54:18 +0000 (UTC) Received: from [66.196.81.171] by nm48.bullet.mail.bf1.yahoo.com with NNFMP; 21 Jan 2014 19:54:11 -0000 Received: from [98.139.213.13] by tm17.bullet.mail.bf1.yahoo.com with NNFMP; 21 Jan 2014 19:54:11 -0000 Received: from [127.0.0.1] by smtp113.mail.bf1.yahoo.com with NNFMP; 21 Jan 2014 19:54:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1390334051; bh=tR503NmCSRHH1uJnl/q9s5lAAAmldCtvdGnL3ADveDk=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type; b=wVHmoqmwaxlO1cb13TOvkJ4Jr+VYrM5S0LQeeRwx4Vfzj7E2dPdC7M1KHYNaeHtCq9xroBnJhWGki+luIIVP/Qf2AHm5uC+8qrc3xNo9MGa2Ig2UwuJlQrz8OKDnbePOihUdrhW/guEWVEhkcHweOTf1qBfIGf0OI9I5P02uH2M= X-Yahoo-Newman-Id: 651190.26307.bm@smtp113.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 66AA2rIVM1kg.OdYrlWfMDghBq8iGWhA8Ig_MIwMiannOqH l_cB1u_0vBLhoGj9kKB6g2nJX1_qP1f4ygB0g3tTw_KybNL_siPQuXXTJA9d sQ8_yFgjB4J4UzsWx77VwPr9PAsOAXlwJT6Bwx.Y5sCOaTAbgY2cT5FvorUp 1.D84zeWeF7_OCo41MTFl5mtnbgWnD5tuj3I5RIPEXQGeB5o6d5iJRRHLcHp V64lQbi9ogYi1rcfz1rO4G09sgENaapYHa_rldiIpAbe_EcR4k33bP1.MJXx BHezGbusZPbPnXzJdk2Fj3z1DJOC9Dg6bdOkcimOxOOFzcFczlQefxdUXCzD g.4yqGaKVYOmSWfdvIMgLBrGxO.5b5S_JTRm_n.uxHWr5v7c6mBOi2NTK... kUPQEAVD72STO5tyLQfNKJZ5cp.MRFIMe2fNGKCES4dVSEFegp3hsNTU.2yC eeTmOhuh.Qb.9yfqd13.SoV7i8xxA7FJxUf_c06Rj7MaMwuTblw9cm1CVpDc eqvoYfOaH4cVmwVopsp3CRw_SV4qR9IxI6j.Eiov0CYm6glE- X-Yahoo-SMTP: 4VhmBaWswBBKhhYsa0wE5OAFfRI- X-Rocket-Received: from i7x.pr1.dpejesh.net (dpejesh@97.96.39.205 with plain [63.250.193.228]) by smtp113.mail.bf1.yahoo.com with SMTP; 21 Jan 2014 11:54:11 -0800 PST Message-ID: <52DED060.4070800@yahoo.com> Date: Tue, 21 Jan 2014 14:54:08 -0500 From: David Shane Holden User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: Re: Atom Board ACPI API MOPNV10J failing since 9.1 References: <52CF850A.9060906@erdgeist.org> <201401140823.00259.jhb@freebsd.org> <201401211215.22021.jhb@freebsd.org> In-Reply-To: <201401211215.22021.jhb@freebsd.org> Content-Type: multipart/mixed; boundary="------------070503030404060103050504" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jan 2014 19:54:18 -0000 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--