Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HMMpK-00070r-Fu for qemu-devel@nongnu.org; Wed, 28 Feb 2007 06:18:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HMMpJ-00070b-Tq for qemu-devel@nongnu.org; Wed, 28 Feb 2007 06:18:30 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HMMpJ-00070Y-Ps for qemu-devel@nongnu.org; Wed, 28 Feb 2007 06:18:29 -0500 Received: from farad.aurel32.net ([82.232.2.251] helo=mail.aurel32.net) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HMMpJ-0002tV-4e for qemu-devel@nongnu.org; Wed, 28 Feb 2007 06:18:29 -0500 Received: from farad.aurel32.net ([2001:618:400:fc13:216:3eff:fe00:100c]) by mail.aurel32.net with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1HMMpH-0002IN-Le for qemu-devel@nongnu.org; Wed, 28 Feb 2007 12:18:27 +0100 Received: from aurel32 by farad.aurel32.net with local (Exim 4.63) (envelope-from ) id 1HMMpH-0003XG-Aa for qemu-devel@nongnu.org; Wed, 28 Feb 2007 12:18:27 +0100 Date: Wed, 28 Feb 2007 12:18:27 +0100 From: Aurelien Jarno Message-ID: <20070228111827.GB13567@farad.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Fix GT64120 PCI IO mapping update 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 Hi, The patch below fixes a bug when updating the GT64120 PCI IO mapping. The old addresses should be unmapped first before trying to setup a new one. Bye, Aurelien Index: hw/gt64xxx.c =================================================================== RCS file: /sources/qemu/qemu/hw/gt64xxx.c,v retrieving revision 1.4 diff -u -d -p -r1.4 gt64xxx.c --- hw/gt64xxx.c 31 Jan 2007 12:02:12 -0000 1.4 +++ hw/gt64xxx.c 28 Feb 2007 11:07:45 -0000 @@ -222,18 +222,24 @@ typedef PCIHostState GT64120PCIState; typedef struct GT64120State { GT64120PCIState *pci; uint32_t regs[GT_REGS]; + target_phys_addr_t PCI0IO_start; + target_phys_addr_t PCI0IO_length; } GT64120State; static void gt64120_pci_mapping(GT64120State *s) { - target_phys_addr_t start, length; - /* Update IO mapping */ if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD]) { - start = s->regs[GT_PCI0IOLD] << 21; - length = ((s->regs[GT_PCI0IOHD] + 1) - (s->regs[GT_PCI0IOLD] & 0x7f)) << 21; - isa_mmio_init(start, length); + /* Unmap old IO address */ + if (s->PCI0IO_length) + { + cpu_register_physical_memory(s->PCI0IO_start, s->PCI0IO_length, IO_MEM_UNASSIGNED); + } + /* Map new IO address */ + s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21; + s->PCI0IO_length = ((s->regs[GT_PCI0IOHD] + 1) - (s->regs[GT_PCI0IOLD] & 0x7f)) << 21; + isa_mmio_init(s->PCI0IO_start, s->PCI0IO_length); } } -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net