Skip to contentSkip to conversation

ne2000: mark I/O as LITTLE_ENDIAN

PATCH Applied Aurelien Jarno 3 participants 3 messages Sep 2, 2013 – Sep 6, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ne2000: mark I/O as LITTLE_ENDIAN

Now that the memory subsystem is propagating the endianness correctly, the ne2000 device should have its I/O ports marked as LITTLE_ENDIAN, as PCI devices are little endian.

This makes the ne2000 NIC to work again on PowerPC.

---
 hw/net/ne2000.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/ne2000.c +1 -1
index 31afd28..c961258 100644
@@ -693,7 +693,7 @@ static void ne2000_write(void *opaque, hwaddr addr,
 static const MemoryRegionOps ne2000_ops = {
     .read = ne2000_read,
     .write = ne2000_write,
-    .endianness = DEVICE_NATIVE_ENDIAN,
+    .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
 /***********************************************************/
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 18 lines · Aurelien Jarno

Now that the memory subsystem is propagating the endianness correctly, the ne2000 device should have its I/O ports marked as LITTLE_ENDIAN, as PCI devices are little endian.

This makes the ne2000 NIC to work again on PowerPC.

---
 hw/net/ne2000.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/ne2000.c +0 -0
index 31afd28..c961258 100644

hw/net/ne2000.c static void ne2000_write(void *opaque, hwaddr addr, · line 697

Quoted 6 lines
hw/net/ne2000.c +1 -1
@@ -693,7 +693,7 @@ static void ne2000_write(void *opaque, hwaddr addr,
 static const MemoryRegionOps ne2000_ops = {
     .read = ne2000_read,
     .write = ne2000_write,
-    .endianness = DEVICE_NATIVE_ENDIAN,
+    .endianness = DEVICE_LITTLE_ENDIAN,
 };

This is also used by hw/net/ne2000-isa.c:isa_ne2000_realizefn(). Is it correct to explicitly say little-endian there?

#2 lore raw
Quoted 14 lines · Stefan Hajnoczi
Quoted 13 lines · Aurelien Jarno

Now that the memory subsystem is propagating the endianness correctly, the ne2000 device should have its I/O ports marked as LITTLE_ENDIAN, as PCI devices are little endian.

This makes the ne2000 NIC to work again on PowerPC.

---
 hw/net/ne2000.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

hw/net/ne2000.c static void ne2000_write(void *opaque, hwaddr addr, · line 697

Quoted 11 lines
hw/net/ne2000.c +1 -1
index 31afd28..c961258 100644
@@ -693,7 +693,7 @@ static void ne2000_write(void *opaque, hwaddr addr,
 static const MemoryRegionOps ne2000_ops = {
     .read = ne2000_read,
     .write = ne2000_write,
-    .endianness = DEVICE_NATIVE_ENDIAN,
+    .endianness = DEVICE_LITTLE_ENDIAN,
 };

This is also used by hw/net/ne2000-isa.c:isa_ne2000_realizefn(). Is it correct to explicitly say little-endian there?

Paolo has confirmed that ISA devices should be little-endian anyway.

Thanks, applied to my net tree.

Stefan