From owner-svn-src-head@FreeBSD.ORG Sat Jun 29 23:51:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4DE97CA6; Sat, 29 Jun 2013 23:51:18 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 312DC1A1B; Sat, 29 Jun 2013 23:51:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5TNpIKU061266; Sat, 29 Jun 2013 23:51:18 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5TNpIGB061265; Sat, 29 Jun 2013 23:51:18 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201306292351.r5TNpIGB061265@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sat, 29 Jun 2013 23:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252395 - head/sys/arm/versatile X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2013 23:51:18 -0000 Author: gonzo Date: Sat Jun 29 23:51:17 2013 New Revision: 252395 URL: http://svnweb.freebsd.org/changeset/base/252395 Log: - Fix IMAPx registers values calculation - Initialize SMAPx registers too although they're unused in QEMU - Do not pass IO/MEM resources to upper bus for activation, handle them locally. Previously ACTIVATE method of upper bus was no-op so nothing bad happened. But now FDT maps physaddr to vaddr and it causes troubles: fdtbus_activate_resource resource assumes that bustag/bushandle are already set which in this case is wrong. Modified: head/sys/arm/versatile/versatile_pci.c Modified: head/sys/arm/versatile/versatile_pci.c ============================================================================== --- head/sys/arm/versatile/versatile_pci.c Sat Jun 29 23:48:08 2013 (r252394) +++ head/sys/arm/versatile/versatile_pci.c Sat Jun 29 23:51:17 2013 (r252395) @@ -173,16 +173,17 @@ versatile_pci_attach(device_t dev) /* * Setup memory windows */ - versatile_pci_core_write_4(PCI_CORE_IMAP0, (PCI_IO_WINDOW >> 11)); - versatile_pci_core_write_4(PCI_CORE_IMAP1, (PCI_NPREFETCH_WINDOW >> 11)); - versatile_pci_core_write_4(PCI_CORE_IMAP2, (PCI_PREFETCH_WINDOW >> 11)); + versatile_pci_core_write_4(PCI_CORE_IMAP0, (PCI_IO_WINDOW >> 28)); + versatile_pci_core_write_4(PCI_CORE_IMAP1, (PCI_NPREFETCH_WINDOW >> 28)); + versatile_pci_core_write_4(PCI_CORE_IMAP2, (PCI_PREFETCH_WINDOW >> 28)); /* * XXX: this is SDRAM offset >> 28 + * Unused as of QEMU 1.5 */ - versatile_pci_core_write_4(PCI_CORE_SMAP0, 0); - versatile_pci_core_write_4(PCI_CORE_SMAP1, 0); - versatile_pci_core_write_4(PCI_CORE_SMAP2, 0); + versatile_pci_core_write_4(PCI_CORE_SMAP0, (PCI_IO_WINDOW >> 28)); + versatile_pci_core_write_4(PCI_CORE_SMAP1, (PCI_NPREFETCH_WINDOW >> 28)); + versatile_pci_core_write_4(PCI_CORE_SMAP2, (PCI_NPREFETCH_WINDOW >> 28)); versatile_pci_sys_write_4(SYS_PCICTL, 1); @@ -307,7 +308,7 @@ versatile_pci_alloc_resource(device_t bu struct resource *rv; struct rman *rm; - printf("Alloc resources %d, %08lx..%08lx, %ld\n", type, start, end, count); + dprintf("Alloc resources %d, %08lx..%08lx, %ld\n", type, start, end, count); switch (type) { case SYS_RES_IOPORT: @@ -344,20 +345,23 @@ versatile_pci_activate_resource(device_t struct resource *r) { vm_offset_t vaddr; - int res = (BUS_ACTIVATE_RESOURCE(device_get_parent(bus), - child, type, rid, r)); + int res; - if (!res) { - switch(type) { - case SYS_RES_MEMORY: - case SYS_RES_IOPORT: - vaddr = (vm_offset_t)pmap_mapdev(rman_get_start(r), - rman_get_size(r)); - rman_set_bushandle(r, vaddr); - rman_set_bustag(r, versatile_bus_space_pcimem); - break; - } + switch(type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + vaddr = (vm_offset_t)pmap_mapdev(rman_get_start(r), + rman_get_size(r)); + rman_set_bushandle(r, vaddr); + rman_set_bustag(r, versatile_bus_space_pcimem); + res = rman_activate_resource(r); + break; + case SYS_RES_IRQ: + res = (BUS_ACTIVATE_RESOURCE(device_get_parent(bus), + child, type, rid, r)); + break; } + return (res); }