Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Apr 2011 17:21:52 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Alexander Motin <mav@freebsd.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: Changing how PCI-PCI bridges do resource allocation
Message-ID:  <201104251721.53027.jhb@freebsd.org>
In-Reply-To: <201104251509.47482.jhb@freebsd.org>
References:  <mailpost.1303239057.1899175.75529.mailing.freebsd.arch@FreeBSD.cs.nctu.edu.tw> <4DAE9B86.8040106@FreeBSD.org> <201104251509.47482.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, April 25, 2011 3:09:47 pm John Baldwin wrote:
> On Wednesday, April 20, 2011 4:38:30 am Alexander Motin wrote:
> > Hi.
> > 
> > On 19.04.2011 21:50, John Baldwin wrote:
> > > I've already had at least one testing report that this fixes the issues with
> > > some machines' BIOS clearing the I/O windows on some PCI-PCI bridges when ACPI
> > > is enabled as this code re-discovers the original windows and programs them
> > > correctly.  More testing would be good however.
> > 
> > I would like this helped my Acer TM6292 which also has alike problems 
> > with missing PCIe bridge resources, but unluckily it doesn't.
> > 
> > Here is verbose dmesg when my system uses this dirty hack:
> > http://people.freebsd.org/~mav/tm6292_pcie.patch
> >   to restore bridges resources to the pre-ACPI state:
> > http://people.freebsd.org/~mav/dmesg.boot.hacks
> > 
> > Here is respective `pciconf -lvcb` output:
> > http://people.freebsd.org/~mav/pciconf.hacks
> > 
> > Here is dmesg with patches, but without NEW_PCIB:
> > http://people.freebsd.org/~mav/dmesg.boot.olbpcib
> > 
> > Here is dmesg with patches with NEW_PCIB:
> > http://people.freebsd.org/~mav/dmesg.boot.newpcib
> 
> Ah, your problem is we pick bad ranges when we alloc fresh resources for your
> bridges.  I am working on making that better for ACPI, but for now you can try
> setting hw.acpi.host_mem_start to a value like '0xf0000000' in loader.conf.
> 
> Although, it looks like it is not being honored currently.  Try adding a printf
> in acpi_pcib_alloc_resource() in sys/dev/acpica/acpi_pcib_acpi.c to log the
> type, start, and end of each resource range.

Actually, try this patch.  Then I think you can use the host_mem_start tunable:

--- //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c	2011-04-16 21:33:25.000000000 0000
+++ /home/jhb/work/p4/pci/sys/dev/acpica/acpi_pcib_acpi.c	2011-04-16 21:33:25.000000000 0000
@@ -551,10 +551,16 @@
      * found to do it.  This is typically only used on older laptops
      * that don't have pci busses behind pci bridge, so assuming > 32MB
      * is likely OK.
+     *
+     * PCI-PCI bridges may not allocate smaller ranges for their windows,
+     * but the heuristics here should apply to those, so we allow several
+     * different end addresses.
      */
-    if (type == SYS_RES_MEMORY && start == 0UL && end == ~0UL)
+    if (type == SYS_RES_MEMORY && start == 0UL && (end == ~0UL ||
+	end == 0xffffffff))
 	start = acpi_host_mem_start;
-    if (type == SYS_RES_IOPORT && start == 0UL && end == ~0UL)
+    if (type == SYS_RES_IOPORT && start == 0UL && (end == ~0UL ||
+	end == 0xffff || end == 0xffffffff))
 	start = 0x1000;
     return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
 	count, flags));

-- 
John Baldwin



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