From owner-freebsd-current@FreeBSD.ORG Sun Jul 10 00:04:08 2011 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA897106564A for ; Sun, 10 Jul 2011 00:04:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8A2A58FC14 for ; Sun, 10 Jul 2011 00:04:08 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 0AFE846B2A for ; Sat, 9 Jul 2011 20:04:08 -0400 (EDT) Received: from [192.168.1.55] (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7C94F8A02C for ; Sat, 9 Jul 2011 20:04:07 -0400 (EDT) From: John Baldwin Date: Sat, 9 Jul 2011 20:04:07 -0400 Message-Id: <4CE54A1B-B0EF-4907-88BE-124FC4FF236D@FreeBSD.org> To: current@FreeBSD.org Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Sat, 09 Jul 2011 20:04:07 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: [PATCH] Make x86 Host-PCI bridge drivers honor decoded ranges X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2011 00:04:08 -0000 This patch adds a new API (pcib_host_res_*) that Host-PCI bridge drivers = can=20 use to restrict allocations for child devices to a known subset of = address=20 ranges that the bridge decodes. Originally I tried to allocate the full=20= ranges and use rmans just as we now do for PCI-PCI bridge windows. = However,=20 this broke due to the fact that all of our ACPI LPC/ISA devices attach = at the=20 "wrong" place in the tree (they aren't behind the host-PCI bridges) and = a=20 typical ACPI BIOS will allocate the full I/O port range to the host-PCI=20= bridge. We could perhaps fix this later if we relocate all the ACPI = devices=20 that are actually ISA devices down onto an ACPI-aware ISA bus (i.e. an = ISA bus=20 that uses ACPI to enumerate devices). Anyway, I punted on that for now. = =20 Instead, the current API works by using a resource_list to keep track of = all=20 the valid address ranges. When an allocation request is made, it simply = tries=20 all the address ranges in turn. I still made it honor = hw.pci.host_mem_start=20 since the ACPI BIOSes I have seen will optionally include option ROM = space=20 below 1MB if any ROMs are active, but we don't want to allocate that = space for=20 a wildcard BAR operation. I've changed the ACPI and MPTable Host-PCI bridge drivers to use this = helper=20 API. For ACPI we claim that bridges decode any "producer" address = ranges in=20 the bridges _CRS. For the MPTable I had to add logic to walk the = extended=20 MPTable entries and use those extended entries to find the list of = decoded=20 ranges. I'd like to get this into 9.0 and would appreciate folks = testing it out. http://www.FreeBSD.org/~jhb/patches/pci_host_res.patch --=20 John Baldwin