qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] Split region allocation code from pci_bios_init_device()
@ 2010-08-15 19:57 Eduard - Gabriel Munteanu
  2010-08-15 19:57 ` [Qemu-devel] [PATCH 2/2] AMD IOMMU support Eduard - Gabriel Munteanu
  0 siblings, 1 reply; 3+ messages in thread
From: Eduard - Gabriel Munteanu @ 2010-08-15 19:57 UTC (permalink / raw)
  To: joro
  Cc: kvm, seabios, qemu-devel, blauwirbel, paul,
	Eduard - Gabriel Munteanu, avi

pci_bios_alloc() can be used to allocate space in the PCI region for
other purposes. This is needed by the AMD IOMMU support code.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
---
 src/pciinit.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/pciinit.c b/src/pciinit.c
index 0556ee2..bfc669f 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -75,6 +75,16 @@ static void pci_bios_init_bridges(u16 bdf)
     }
 }
 
+static inline u32 pci_bios_alloc(u32 *region, u32 size)
+{
+    u32 ret;
+
+    ret = ALIGN(*region, size);
+    *region = ret + size;
+
+    return ret;
+}
+
 static void pci_bios_init_device(u16 bdf)
 {
     int class;
@@ -146,14 +156,13 @@ static void pci_bios_init_device(u16 bdf)
             pci_config_writel(bdf, ofs, old);
 
             if (val != 0) {
-                u32 size = (~(val & mask)) + 1;
+                u32 base, size = (~(val & mask)) + 1;
                 if (val & PCI_BASE_ADDRESS_SPACE_IO)
                     paddr = &pci_bios_io_addr;
                 else
                     paddr = &pci_bios_mem_addr;
-                *paddr = ALIGN(*paddr, size);
-                pci_set_io_region_addr(bdf, i, *paddr);
-                *paddr += size;
+                base = pci_bios_alloc(paddr, size);
+                pci_set_io_region_addr(bdf, i, base);
             }
         }
         break;
-- 
1.7.1

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

end of thread, other threads:[~2010-08-18  0:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-15 19:57 [Qemu-devel] [PATCH 1/2] Split region allocation code from pci_bios_init_device() Eduard - Gabriel Munteanu
2010-08-15 19:57 ` [Qemu-devel] [PATCH 2/2] AMD IOMMU support Eduard - Gabriel Munteanu
2010-08-18  0:05   ` [Qemu-devel] " Kevin O'Connor

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).