diff mbox

vga: Declare as little endian

Message ID AANLkTinEOy_hvp7icbG7x9o-3YK0wj0hocQ0wNKMw_FE@mail.gmail.com
State New
Headers show

Commit Message

Blue Swirl Dec. 11, 2010, 10:33 p.m. UTC
This patch replaces explicit bswaps with endianness hints to the
mmio layer.

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/vga.c |   26 +-------------------------
 1 files changed, 1 insertions(+), 25 deletions(-)


@@ -931,28 +919,16 @@ void vga_mem_writeb(void *opaque,
target_phys_addr_t addr, uint32_t val)

 static void vga_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
 {
-#ifdef TARGET_WORDS_BIGENDIAN
-    vga_mem_writeb(opaque, addr, (val >> 8) & 0xff);
-    vga_mem_writeb(opaque, addr + 1, val & 0xff);
-#else
     vga_mem_writeb(opaque, addr, val & 0xff);
     vga_mem_writeb(opaque, addr + 1, (val >> 8) & 0xff);
-#endif
 }

 static void vga_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
 {
-#ifdef TARGET_WORDS_BIGENDIAN
-    vga_mem_writeb(opaque, addr, (val >> 24) & 0xff);
-    vga_mem_writeb(opaque, addr + 1, (val >> 16) & 0xff);
-    vga_mem_writeb(opaque, addr + 2, (val >> 8) & 0xff);
-    vga_mem_writeb(opaque, addr + 3, val & 0xff);
-#else
     vga_mem_writeb(opaque, addr, val & 0xff);
     vga_mem_writeb(opaque, addr + 1, (val >> 8) & 0xff);
     vga_mem_writeb(opaque, addr + 2, (val >> 16) & 0xff);
     vga_mem_writeb(opaque, addr + 3, (val >> 24) & 0xff);
-#endif
 }

 typedef void vga_draw_glyph8_func(uint8_t *d, int linesize,
@@ -2321,7 +2297,7 @@ void vga_init(VGACommonState *s)
 #endif /* CONFIG_BOCHS_VBE */

     vga_io_memory = cpu_register_io_memory(vga_mem_read, vga_mem_write, s,
-                                           DEVICE_NATIVE_ENDIAN);
+                                           DEVICE_LITTLE_ENDIAN);
     cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000,
                                  vga_io_memory);
     qemu_register_coalesced_mmio(isa_mem_base + 0x000a0000, 0x20000);

Comments

Alexander Graf Dec. 13, 2010, 8 a.m. UTC | #1
On 11.12.2010, at 23:33, Blue Swirl wrote:

> This patch replaces explicit bswaps with endianness hints to the
> mmio layer.
> 
> CC: Alexander Graf <agraf@suse.de>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

Acked-by: Alexander Graf <agraf@suse.de>


Alex
Blue Swirl Dec. 19, 2010, 10:48 a.m. UTC | #2
Thanks for the ack, applied.

On Mon, Dec 13, 2010 at 8:00 AM, Alexander Graf <agraf@suse.de> wrote:
>
> On 11.12.2010, at 23:33, Blue Swirl wrote:
>
>> This patch replaces explicit bswaps with endianness hints to the
>> mmio layer.
>>
>> CC: Alexander Graf <agraf@suse.de>
>> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
>
> Acked-by: Alexander Graf <agraf@suse.de>
>
>
> Alex
>
>
diff mbox

Patch

diff --git a/hw/vga.c b/hw/vga.c
index b5c8741..c632fd7 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -767,30 +767,18 @@  uint32_t vga_mem_readb(void *opaque,
target_phys_addr_t addr)
 static uint32_t vga_mem_readw(void *opaque, target_phys_addr_t addr)
 {
     uint32_t v;
-#ifdef TARGET_WORDS_BIGENDIAN
-    v = vga_mem_readb(opaque, addr) << 8;
-    v |= vga_mem_readb(opaque, addr + 1);
-#else
     v = vga_mem_readb(opaque, addr);
     v |= vga_mem_readb(opaque, addr + 1) << 8;
-#endif
     return v;
 }

 static uint32_t vga_mem_readl(void *opaque, target_phys_addr_t addr)
 {
     uint32_t v;
-#ifdef TARGET_WORDS_BIGENDIAN
-    v = vga_mem_readb(opaque, addr) << 24;
-    v |= vga_mem_readb(opaque, addr + 1) << 16;
-    v |= vga_mem_readb(opaque, addr + 2) << 8;
-    v |= vga_mem_readb(opaque, addr + 3);
-#else
     v = vga_mem_readb(opaque, addr);
     v |= vga_mem_readb(opaque, addr + 1) << 8;
     v |= vga_mem_readb(opaque, addr + 2) << 16;
     v |= vga_mem_readb(opaque, addr + 3) << 24;
-#endif
     return v;
 }