[Spice-devel] [RFCv2 02/21] partially replace outb with ioport_write

Alon Levy alevy at redhat.com
Fri Apr 29 02:49:40 PDT 2011


replace everywhere it is needed for xspice - places left out are ifdefed
out later based on the same define mentioned in qxl.h, XSPICE.

note: leave spaces between function name and open paren?
---
 src/qxl.h         |    2 ++
 src/qxl_driver.c  |   10 +++++-----
 src/qxl_ring.c    |    5 +++--
 src/qxl_surface.c |    4 ++--
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/qxl.h b/src/qxl.h
index 594dd5b..de3bed7 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -336,4 +336,6 @@ void *            qxl_allocnf          (qxl_screen_t           *qxl,
 					unsigned long           size);
 int		   qxl_garbage_collect (qxl_screen_t *qxl);
 
+static inline void ioport_write(qxl_screen_t *qxl, int port, int val)
+
 #endif // QXL_H
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index ce50a2a..38c5de6 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -130,7 +130,7 @@ qxl_usleep (int useconds)
 int
 qxl_handle_oom (qxl_screen_t *qxl)
 {
-    outb (qxl->io_base + QXL_IO_NOTIFY_OOM, 0);
+    ioport_write(qxl, QXL_IO_NOTIFY_OOM, 0);
     
 #if 0
     ErrorF (".");
@@ -168,7 +168,7 @@ qxl_allocnf (qxl_screen_t *qxl, unsigned long size)
 	ram_header->update_area.right = qxl->virtual_x;
 	ram_header->update_surface = 0;		/* Only primary for now */
 	
-	outb (qxl->io_base + QXL_IO_UPDATE_AREA, 0);
+	ioport_write(qxl, QXL_IO_UPDATE_AREA, 0);
 	
 #if 0
  	ErrorF ("eliminated memory (%d)\n", nth_oom++);
@@ -342,7 +342,7 @@ qxl_reset (qxl_screen_t *qxl)
     uint64_t high_bits;
     struct QXLRam *ram_header;
 
-    outb(qxl->io_base + QXL_IO_RESET, 0);
+    ioport_write(qxl, QXL_IO_RESET, 0);
 
     ram_header = (void *)((unsigned long)qxl->ram + (unsigned long)qxl->rom->ram_header_offset);
     
@@ -370,7 +370,7 @@ qxl_reset (qxl_screen_t *qxl)
     ram_header->mem_slot.mem_start = slot->start_phys_addr;
     ram_header->mem_slot.mem_end = slot->end_phys_addr;
     
-    outb (qxl->io_base + QXL_IO_MEMSLOT_ADD, qxl->main_mem_slot);
+    ioport_write(qxl, QXL_IO_MEMSLOT_ADD, qxl->main_mem_slot);
 
     slot->generation = qxl->rom->slot_generation;
     
@@ -390,7 +390,7 @@ qxl_reset (qxl_screen_t *qxl)
     ram_header->mem_slot.mem_start = slot->start_phys_addr;
     ram_header->mem_slot.mem_end = slot->end_phys_addr;
 
-    outb (qxl->io_base + QXL_IO_MEMSLOT_ADD, qxl->vram_mem_slot);
+    ioport_write(qxl, QXL_IO_MEMSLOT_ADD, qxl->vram_mem_slot);
 
     slot->generation = qxl->rom->slot_generation;
     
diff --git a/src/qxl_ring.c b/src/qxl_ring.c
index 22d98ea..0870ef1 100644
--- a/src/qxl_ring.c
+++ b/src/qxl_ring.c
@@ -88,8 +88,9 @@ qxl_ring_push (struct qxl_ring *ring,
 
     mem_barrier();
 
-    if (header->prod == header->notify_on_prod)
-	outb (ring->qxl->io_base + ring->io_port_prod_notify, 0);
+    if (header->prod == header->notify_on_prod) {
+        ioport_write (ring->qxl, ring->io_port_prod_notify, 0);
+    }
 }
 
 Bool
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index bf91483..6056555 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -378,7 +378,7 @@ qxl_surface_cache_create_primary (surface_cache_t	*cache,
     create->type = QXL_SURF_TYPE_PRIMARY;
     create->mem = physical_address (cache->qxl, cache->qxl->ram, cache->qxl->main_mem_slot);
 
-    outb (qxl->io_base + QXL_IO_CREATE_PRIMARY, 0);
+    ioport_write(qxl, QXL_IO_CREATE_PRIMARY, 0);
 
     dev_addr = (uint8_t *)qxl->ram + mode->stride * (mode->y_res - 1);
 
@@ -920,7 +920,7 @@ download_box (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
     ErrorF ("Issuing update command for %d\n", surface->id);
 #endif
 
-    outb (surface->cache->qxl->io_base + QXL_IO_UPDATE_AREA, 0);
+    ioport_write(surface->cache->qxl, QXL_IO_UPDATE_AREA, 0);
 
     pixman_image_composite (PIXMAN_OP_SRC,
      			    surface->dev_image,
-- 
1.7.4.4



More information about the Spice-devel mailing list