qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Fix GT64120 PCI IO mapping update


From: Aurelien Jarno
Subject: [Qemu-devel] [PATCH] Fix GT64120 PCI IO mapping update
Date: Wed, 28 Feb 2007 12:18:27 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

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
 `. `'   address@hidden         | address@hidden
   `-    people.debian.org/~aurel32 | www.aurel32.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]