Date: Sat, 29 Jun 2013 23:51:18 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252395 - head/sys/arm/versatile Message-ID: <201306292351.r5TNpIGB061265@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306292351.r5TNpIGB061265>