From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LLOMH-0002mc-GA for qemu-devel@nongnu.org; Fri, 09 Jan 2009 15:53:33 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLOMG-0002mQ-3h for qemu-devel@nongnu.org; Fri, 09 Jan 2009 15:53:32 -0500 Received: from [199.232.76.173] (port=37439 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLOMF-0002mN-Va for qemu-devel@nongnu.org; Fri, 09 Jan 2009 15:53:31 -0500 Received: from savannah.gnu.org ([199.232.41.3]:53693 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LLOMF-0003wL-K0 for qemu-devel@nongnu.org; Fri, 09 Jan 2009 15:53:31 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LLOMF-00019K-2T for qemu-devel@nongnu.org; Fri, 09 Jan 2009 20:53:31 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LLOME-00019F-PR for qemu-devel@nongnu.org; Fri, 09 Jan 2009 20:53:30 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Fri, 09 Jan 2009 20:53:30 +0000 Subject: [Qemu-devel] [6265] Fix APB Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6265 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6265 Author: blueswir1 Date: 2009-01-09 20:53:30 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Fix APB Modified Paths: -------------- trunk/hw/apb_pci.c trunk/hw/sun4u.c Modified: trunk/hw/apb_pci.c =================================================================== --- trunk/hw/apb_pci.c 2009-01-09 20:06:44 UTC (rev 6264) +++ trunk/hw/apb_pci.c 2009-01-09 20:53:30 UTC (rev 6265) @@ -22,12 +22,23 @@ * THE SOFTWARE. */ -/* XXX This file and most of its contests are somewhat misnamed. The +/* XXX This file and most of its contents are somewhat misnamed. The Ultrasparc PCI host is called the PCI Bus Module (PBM). The APB is the secondary PCI bridge. */ #include "hw.h" #include "pci.h" + +/* debug APB */ +//#define DEBUG_APB + +#ifdef DEBUG_APB +#define APB_DPRINTF(fmt, args...) \ +do { printf("APB: " fmt , ##args); } while (0) +#else +#define APB_DPRINTF(fmt, args...) +#endif + typedef target_phys_addr_t pci_addr_t; #include "pci_host.h" @@ -37,13 +48,13 @@ uint32_t val) { APBState *s = opaque; - int i; - for (i = 11; i < 32; i++) { - if ((val & (1 << i)) != 0) - break; - } - s->config_reg = (1 << 16) | (val & 0x7FC) | (i << 11); +#ifdef TARGET_WORDS_BIGENDIAN + val = bswap32(val); +#endif + APB_DPRINTF("config_writel addr " TARGET_FMT_plx " val %x\n", addr, + val); + s->config_reg = val; } static uint32_t pci_apb_config_readl (void *opaque, @@ -51,10 +62,13 @@ { APBState *s = opaque; uint32_t val; - int devfn; - devfn = (s->config_reg >> 8) & 0xFF; - val = (1 << (devfn >> 3)) | ((devfn & 0x07) << 8) | (s->config_reg & 0xFC); + val = s->config_reg; +#ifdef TARGET_WORDS_BIGENDIAN + val = bswap32(val); +#endif + APB_DPRINTF("config_readl addr " TARGET_FMT_plx " val %x\n", addr, + val); return val; } @@ -259,5 +273,5 @@ "Advanced PCI Bus secondary bridge 1"); pci_bridge_init(s->bus, 9, 0x108e5000, pci_apb_map_irq, "Advanced PCI Bus secondary bridge 2"); - return secondary; + return s->bus; } Modified: trunk/hw/sun4u.c =================================================================== --- trunk/hw/sun4u.c 2009-01-09 20:06:44 UTC (rev 6264) +++ trunk/hw/sun4u.c 2009-01-09 20:53:30 UTC (rev 6265) @@ -465,8 +465,9 @@ pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, NULL); isa_mem_base = VGA_BASE; vga_ram_offset = qemu_ram_alloc(vga_ram_size); - pci_cirrus_vga_init(pci_bus, ds, phys_ram_base + vga_ram_offset, - vga_ram_offset, vga_ram_size); + pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_offset, + vga_ram_offset, vga_ram_size, + 0, 0); i = 0; if (hwdef->console_serial_base) {