From owner-cvs-src-old@FreeBSD.ORG Tue May 3 17:37:49 2011 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 566271065678 for ; Tue, 3 May 2011 17:37:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 269288FC29 for ; Tue, 3 May 2011 17:37:49 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id p43HbnrQ005075 for ; Tue, 3 May 2011 17:37:49 GMT (envelope-from jhb@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id p43HbnUe005074 for cvs-src-old@freebsd.org; Tue, 3 May 2011 17:37:49 GMT (envelope-from jhb@repoman.freebsd.org) Message-Id: <201105031737.p43HbnUe005074@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to jhb@repoman.freebsd.org using -f From: John Baldwin Date: Tue, 3 May 2011 17:37:24 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/amd64/pci pci_bus.c src/sys/conf options src/sys/dev/acpica acpi_pcib_acpi.c acpi_pcib_pci.c src/sys/dev/pci pci.c pci_pci.c pcib_private.h src/sys/i386/pci pci_bus.c src/sys/sparc64/pci apb.c ofw_pcib.c src/sys/x86/pci ... X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2011 17:37:49 -0000 jhb 2011-05-03 17:37:24 UTC FreeBSD src repository Modified files: sys/amd64/pci pci_bus.c sys/conf options sys/dev/acpica acpi_pcib_acpi.c acpi_pcib_pci.c sys/dev/pci pci.c pci_pci.c pcib_private.h sys/i386/pci pci_bus.c sys/sparc64/pci apb.c ofw_pcib.c sys/x86/pci qpi.c sys/x86/x86 mptable_pci.c Log: SVN rev 221393 on 2011-05-03 17:37:24Z by jhb Reimplement how PCI-PCI bridges manage their I/O windows. Previously the driver would verify that requests for child devices were confined to any existing I/O windows, but the driver relied on the firmware to initialize the windows and would never grow the windows for new requests. Now the driver actively manages the I/O windows. This is implemented by allocating a bus resource for each I/O window from the parent PCI bus and suballocating that resource to child devices. The suballocations are managed by creating an rman for each I/O window. The suballocated resources are mapped by passing the bus_activate_resource() call up to the parent PCI bus. Windows are grown when needed by using bus_adjust_resource() to adjust the resource allocated from the parent PCI bus. If the adjust request succeeds, the window is adjusted and the suballocation request for the child device is retried. When growing a window, the rman_first_free_region() and rman_last_free_region() routines are used to determine if the front or end of the existing I/O window is free. From using that, the smallest ranges that need to be added to either the front or back of the window are computed. The driver will first try to grow the window in whichever direction requires the smallest growth first followed by the other direction if that fails. Subtractive bridges will first attempt to satisfy requests for child resources from I/O windows (including attempts to grow the windows). If that fails, the request is passed up to the parent PCI bus directly however. The PCI-PCI bridge driver will try to use firmware-assigned ranges for child BARs first and only allocate a "fresh" range if that specific range cannot be accommodated in the I/O window. This allows systems where the firmware assigns resources during boot but later wipes the I/O windows (some ACPI BIOSen are known to do this) to "rediscover" the original I/O window ranges. The ACPI Host-PCI bridge driver has been adjusted to correctly honor hw.acpi.host_mem_start and the I/O port equivalent when a PCI-PCI bridge makes a wildcard request for an I/O window range. The new PCI-PCI bridge driver is only enabled if the NEW_PCIB kernel option is enabled. This is a transition aide to allow platforms that do not yet support bus_activate_resource() and bus_adjust_resource() in their Host-PCI bridge drivers (and possibly other drivers as needed) to use the old driver for now. Once all platforms support the new driver, the kernel option and old driver will be removed. PR: kern/143874 kern/149306 Tested by: mav Revision Changes Path 1.126 +1 -0 src/sys/amd64/pci/pci_bus.c 1.730 +1 -0 src/sys/conf/options 1.65 +10 -3 src/sys/dev/acpica/acpi_pcib_acpi.c 1.21 +1 -0 src/sys/dev/acpica/acpi_pcib_pci.c 1.420 +20 -0 src/sys/dev/pci/pci.c 1.67 +645 -5 src/sys/dev/pci/pci_pci.c 1.17 +30 -0 src/sys/dev/pci/pcib_private.h 1.134 +1 -0 src/sys/i386/pci/pci_bus.c 1.22 +1 -0 src/sys/sparc64/pci/apb.c 1.16 +1 -0 src/sys/sparc64/pci/ofw_pcib.c 1.4 +1 -0 src/sys/x86/pci/qpi.c 1.4 +1 -0 src/sys/x86/x86/mptable_pci.c