qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix GT64120 PCI IO mapping update
@ 2007-02-28 11:18 Aurelien Jarno
  2007-04-15 13:07 ` Stefan Weil
  0 siblings, 1 reply; 5+ messages in thread
From: Aurelien Jarno @ 2007-02-28 11:18 UTC (permalink / raw)
  To: qemu-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-18 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-28 11:18 [Qemu-devel] [PATCH] Fix GT64120 PCI IO mapping update Aurelien Jarno
2007-04-15 13:07 ` Stefan Weil
2007-04-15 14:46   ` Aurelien Jarno
2007-04-15 15:36     ` Stefan Weil
2007-04-18 17:38     ` Stefan Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).