MMIO endianness cleanup
Subsystems (2)
cover MMIO endianness cleanup
The way mmio endianness is currently implemented is horrifying.
In the real world, CPUs have an endianness and write out data to the memory bus. Instead of RAM, a receiving side here can be a device. This device gets a byte stream again and needs to make sense of it.
Since big endian systems write big endian numbers into memory while little endian systems write little endian numbers there, the device and software on the CPU need to be aware of this.
In practice, most devices these days (ISA, PCI) assume that the data is little endian. So to communicate with such a device from the CPU's side, the OS byte swaps all MMIO.
In qemu however, we simply pass the register value we find on to the device. So any byte mangling the guest does to compensate for the transfer screw us up by exposing byte swapped MMIO on the device's side.
The way this has been fixed historically is by constructs like this one:
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap32(val);#endif
With the move to get device code only compiled once, this has become harder and harder to justify though, since we don't know the target endianness during compile time.
It's especially bad since it doesn't make any sense at all to clutter all the device code with endianness workarounds, aside from the fact that about 80% of the device code currently does the wrong thing :).
So my solution to the issue is to make every device define if it's a little, big or native (target) endianness device. This basically tells the layers below what endianness the device expects mmio to occur in. Little endian devices on little endian hosts don't swap. On big endian hosts they do. Same the other way around.
The only reason I added "native" endianness is that we have some PV devices like the fw_cfg that expect qemu's broken behavior. These devices are the minority though. In the long run I'd expect to see most code be committed with either of the two endianness choices.
The patch set also includes a bunch of conversions for devices that were already aware of endianness.
This is an RFC, so please comment as much as you can :).
Alexander Graf (15):
exec: introduce endianness swapped mmio
Add endianness as io mem parameter
Make simple io mem handler endian aware
dbdma: Make little endian
pci-host: Delegate bswap to mmio layer
uninorth: Get rid of bswap
e1000: Make little endian
prep: Declare as little endian
versatile_pci: Declare as little endian
ppc4xx_pci: Declare as little endian
openpic: Replace explicit byte swap with endian hints
rtl8139: Declare as little endian
heathrow_pic: Declare as little endian
isa_mmio: Always use little endian
usb_ohci: Always use little endian
Makefile.objs | 3 + Makefile.target | 7 -- cpu-common.h | 6 ++- exec.c | 145 +++++++++++++++++++++++++++++++++++++++++--- hw/apb_pci.c | 9 ++- hw/apic.c | 3 +- hw/arm_gic.c | 3 +- hw/arm_sysctl.c | 3 +- hw/arm_timer.c | 5 +- hw/armv7m.c | 2 +- hw/axis_dev88.c | 6 +- hw/bonito.c | 19 ++++-- hw/cirrus_vga.c | 12 +++- hw/cs4231.c | 3 +- hw/cuda.c | 3 +- hw/dec_pci.c | 6 +- hw/dp8393x.c | 3 +- hw/ds1225y.c | 6 +- hw/e1000.c | 11 +--- hw/eccmemctl.c | 6 +- hw/eepro100.c | 3 +- hw/empty_slot.c | 3 +- hw/escc.c | 3 +- hw/esp.c | 3 +- hw/etraxfs_dma.c | 2 +- hw/etraxfs_eth.c | 3 +- hw/etraxfs_pic.c | 3 +- hw/etraxfs_ser.c | 3 +- hw/etraxfs_timer.c | 3 +- hw/fdc.c | 6 +- hw/fw_cfg.c | 6 +- hw/g364fb.c | 3 +- hw/grackle_pci.c | 6 +- hw/gt64xxx.c | 9 +-- hw/heathrow_pic.c | 5 +- hw/hpet.c | 3 +- hw/ide/macio.c | 3 +- hw/ide/mmio.c | 6 +- hw/integratorcp.c | 9 ++- hw/intel-hda.c | 3 +- hw/ioapic.c | 3 +- hw/isa.h | 2 +- hw/isa_mmio.c | 100 ++++++------------------------ hw/ivshmem.c | 2 +- hw/jazz_led.c | 3 +- hw/lan9118.c | 3 +- hw/lance.c | 3 +- hw/lsi53c895a.c | 6 +- hw/m48t59.c | 3 +- hw/mac_dbdma.c | 6 +- hw/mac_nvram.c | 3 +- hw/marvell_88w8618_audio.c | 3 +- hw/mcf5206.c | 3 +- hw/mcf5208.c | 6 +- hw/mcf_fec.c | 3 +- hw/mcf_intc.c | 3 +- hw/mcf_uart.c | 3 +- hw/mips_jazz.c | 13 ++--- hw/mips_malta.c | 3 +- hw/mips_mipssim.c | 6 +-- hw/mips_r4k.c | 9 +-- hw/mpcore.c | 3 +- hw/msix.c | 3 +- hw/mst_fpga.c | 2 +- hw/musicpal.c | 24 +++++--- hw/omap.h | 3 +- hw/omap1.c | 42 +++++++------ hw/omap2.c | 4 +- hw/omap_dma.c | 4 +- hw/omap_dss.c | 2 +- hw/omap_gpio.c | 2 +- hw/omap_gpmc.c | 2 +- hw/omap_i2c.c | 2 +- hw/omap_intc.c | 4 +- hw/omap_l4.c | 5 +- hw/omap_lcdc.c | 2 +- hw/omap_mmc.c | 2 +- hw/omap_sdrc.c | 2 +- hw/omap_sx1.c | 15 +++-- hw/omap_uart.c | 2 +- hw/onenand.c | 2 +- hw/openpic.c | 29 ++------- hw/palm.c | 12 +++- hw/parallel.c | 3 +- hw/pci_host.c | 101 ++++++------------------------ hw/pci_host.h | 6 +- hw/pcie_host.c | 3 +- hw/pckbd.c | 3 +- hw/pcnet.c | 3 +- hw/pflash_cfi01.c | 6 +- hw/pflash_cfi02.c | 4 +- hw/pl011.c | 3 +- hw/pl022.c | 3 +- hw/pl031.c | 3 +- hw/pl050.c | 3 +- hw/pl061.c | 3 +- hw/pl080.c | 3 +- hw/pl110.c | 3 +- hw/pl181.c | 4 +- hw/pl190.c | 3 +- hw/ppc405_boards.c | 6 +- hw/ppc405_uc.c | 11 ++- hw/ppc440.c | 2 +- hw/ppc4xx_pci.c | 19 +----- hw/ppc_newworld.c | 5 +- hw/ppc_oldworld.c | 2 +- hw/ppc_prep.c | 40 ++----------- hw/ppce500_mpc8544ds.c | 2 +- hw/ppce500_pci.c | 9 ++- hw/prep_pci.c | 3 +- hw/pxa2xx.c | 25 ++++---- hw/pxa2xx_dma.c | 2 +- hw/pxa2xx_gpio.c | 2 +- hw/pxa2xx_keypad.c | 2 +- hw/pxa2xx_lcd.c | 2 +- hw/pxa2xx_mmci.c | 2 +- hw/pxa2xx_pcmcia.c | 6 +- hw/pxa2xx_pic.c | 2 +- hw/pxa2xx_timer.c | 2 +- hw/r2d.c | 3 +- hw/rc4030.c | 6 +- hw/realview.c | 3 +- hw/realview_gic.c | 3 +- hw/rtl8139.c | 15 +---- hw/sbi.c | 3 +- hw/serial.c | 6 +- hw/sh7750.c | 6 +- hw/sh_intc.c | 3 +- hw/sh_pci.c | 7 +- hw/sh_serial.c | 3 +- hw/sh_timer.c | 3 +- hw/slavio_intctl.c | 3 +- hw/slavio_misc.c | 24 +++++--- hw/slavio_timer.c | 3 +- hw/sm501.c | 9 ++- hw/smc91c111.c | 3 +- hw/sparc32_dma.c | 3 +- hw/spitz.c | 2 +- hw/stellaris.c | 12 +++- hw/stellaris_enet.c | 3 +- hw/sun4c_intctl.c | 3 +- hw/sun4m_iommu.c | 3 +- hw/sun4u.c | 4 +- hw/syborg_fb.c | 3 +- hw/syborg_interrupt.c | 3 +- hw/syborg_keyboard.c | 3 +- hw/syborg_pointer.c | 3 +- hw/syborg_rtc.c | 3 +- hw/syborg_serial.c | 3 +- hw/syborg_timer.c | 3 +- hw/syborg_virtio.c | 3 +- hw/tc6393xb.c | 2 +- hw/tcx.c | 5 +- hw/tusb6010.c | 2 +- hw/unin_pci.c | 26 +++++--- hw/usb-ohci.c | 10 +--- hw/versatile_pci.c | 21 +------ hw/versatilepb.c | 3 +- hw/vga-isa-mm.c | 6 +- hw/vga.c | 3 +- hw/vmware_vga.c | 2 +- hw/wdt_i6300esb.c | 3 +- hw/xilinx_ethlite.c | 2 +- hw/xilinx_intc.c | 2 +- hw/xilinx_timer.c | 3 +- hw/xilinx_uartlite.c | 3 +- hw/zaurus.c | 2 +- rwhandler.c | 4 +- rwhandler.h | 2 +- 169 files changed, 662 insertions(+), 597 deletions(-)
PATCH 1/15 exec: introduce endianness swapped mmio
The way we're currently modeling mmio is too simplified. We assume that every device has the same endianness as the target CPU. In reality, most devices are little endian (all PCI and ISA ones I'm aware of). Some are big endian (special system devices) and a very little fraction is target native endian (fw_cfg).
So instead of assuming every device to be native endianness, let's move to a model where the device tells us which endianness it's in.
That way we can compile the devices only once and get rid of all the ugly swap will be done by the underlying layer.
For the same of readability, this patch only introduces the helper framework but doesn't allow the registering code to set its endianness yet.
--- cpu-common.h | 4 ++ exec.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 0 deletions(-)
cpu-common.h +4 -0
@@ -20,6 +20,10 @@#if !defined(CONFIG_USER_ONLY ) +#define DEVICE_NATIVE_ENDIAN 0 +#define DEVICE_BIG_ENDIAN 1 +#define DEVICE_LITTLE_ENDIAN 2 +/* address in the RAM (different from a physical address) */ typedef unsigned long ram_addr_t ;
exec.c +122 -0
146 lines not on this page · raw message
Signature · 1 line
1.6.0.2
Re: [Qemu-devel] [PATCH 01/15] exec: introduce endianness swapped mmio
Am 25.11.2010 um 08:35 schrieb Alexander Graf:
Quoted 28 lines
The way we're currently modeling mmio is too simplified. We assume that every device has the same endianness as the target CPU. In reality, most devices are little endian (all PCI and ISA ones I'm aware of). Some are big endian (special system devices) and a very little fraction is target native endian (
fw_cfg).So instead of assuming every device to be native endianness, let's move to a model where the device tells us which endianness it's in.
That way we can compile the devices only once and get rid of all the ugly swap will be done by the underlying layer.
For the same of readability, this patch only introduces the helper framework but doesn't allow the registering code to set its endianness yet.
Signed-off-by Alexander Graf <[email protected]>---
cpu-common.h| 4 ++exec.c| 122 +++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++2 files changed, 126 insertions(+), 0 deletions(-)cpu-common.h +0
-0
cpu-common.h line 25
Quoted 6 lines
cpu-common.h +3
-0@@ -20,6 +20,10 @@#if !defined(CONFIG_USER_ONLY ) +#define DEVICE_NATIVE_ENDIAN 0 +#define DEVICE_BIG_ENDIAN 1 +#define DEVICE_LITTLE_ENDIAN 2
I believe some people around here voiced a preference for enums, to aid with gdb debugging?
Quoted 6 lines
exec.c +0
-0
exec.c static int cpu_register_io_memory_fixed(int · line 3483
Quoted 10 lines
exec.c +6
-0@@ -3370,6 +3474,22 @@ static int cpu_register_io_memory_fixed(int io_index, } io_mem_opaque[io_index] = opaque; +switch (endian) { +case DEVICE_BIG_ENDIAN : +#ifndef TARGET_WORDS_BIGENDIAN +swapendian_init (io_index); +#endif +break ;
So basically, you just moved the #ifdefs to another place. :) Shouldn't this be dependent on the CPU state and determined at runtime? Thinking of MSR LE bit on ppc. I guess QEMU doesn't support bi-endian ppc today, as does the 970, but it would be nice to keep it in mind.
Andreas
Re: [Qemu-devel] [PATCH 01/15] exec: introduce endianness swapped mmio
Quoted 30 lines · Andreas Färber
Am 25.11.2010 um 08:35 schrieb Alexander Graf:
Quoted 28 lines
The way we're currently modeling mmio is too simplified. We assume that every device has the same endianness as the target CPU. In reality, most devices are little endian (all PCI and ISA ones I'm aware of). Some are big endian (special system devices) and a very little fraction is target native endian (
fw_cfg).So instead of assuming every device to be native endianness, let's move to a model where the device tells us which endianness it's in.
That way we can compile the devices only once and get rid of all the ugly swap will be done by the underlying layer.
For the same of readability, this patch only introduces the helper framework but doesn't allow the registering code to set its endianness yet.
Signed-off-by Alexander Graf <[email protected]>---
cpu-common.h| 4 ++exec.c| 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++2 files changed, 126 insertions(+), 0 deletions(-)cpu-common.h +0
-0@@ -20,6 +20,10 @@
Quoted 7 lines
cpu-common.h line 25
Quoted 5 lines
cpu-common.h +3
-0#if !defined(CONFIG_USER_ONLY ) +#define DEVICE_NATIVE_ENDIAN 0 +#define DEVICE_BIG_ENDIAN 1 +#define DEVICE_LITTLE_ENDIAN 2I believe some people around here voiced a preference for enums, to aid with gdb debugging?
Yeah, I actually like enums better too :). Good point!
Quoted 10 lines
Quoted 10 lines
exec.c +0
-0@@ -3370,6 +3474,22 @@ static int cpu_register_io_memory_fixed(int io_index, } io_mem_opaque[io_index] = opaque;
Quoted 8 lines
exec.c static int cpu_register_io_memory_fixed(int io_index, · line 3482
Quoted 6 lines
exec.c +6
-0+switch (endian) { +case DEVICE_BIG_ENDIAN : +#ifndef TARGET_WORDS_BIGENDIAN +swapendian_init (io_index); +#endif +break ;So basically, you just moved the #ifdefs to another place. :) Shouldn't this be dependent on the CPU state and determined at runtime? Thinking of MSR LE bit on ppc. I guess QEMU doesn't support bi-endian ppc today, as does the 970, but it would be nice to keep it in mind.
MSR_LE is the only case where runtime determination really makes sense. I'm not sure how that should be handled in the end. MSR_LE swizzles every memory access. Maybe it makes sense to just swap things inside of TCG code there.
Either way, I don't want to add any performance penalty to LE-on-LE (the default use case) and runtime checks on every MMIO are just too heavy :(.
Alex
Re: [Qemu-devel] [PATCH 01/15] exec: introduce endianness swapped mmio
In reply to Andreas FärberQuoted 12 lines · Andreas Färber
Am 25.11.2010 um 08:35 schrieb Alexander Graf:
exec.c static int cpu_register_io_memory_fixed(int io_index, · line 3482
Quoted 6 lines
+ switch (endian) {
+ caseDEVICE_BIG_ENDIAN:exec.c +4
-0+#ifndef TARGET_WORDS_BIGENDIAN + swapendian_init(io_index); +#endif + break;So basically, you just moved the #ifdefs to another place. :) Shouldn't this be dependent on the CPU state and determined at runtime? Thinking of MSR LE bit on ppc. I guess QEMU doesn't support bi-endian ppc today, as does the 970, but it would be nice to keep it in mind.
I was wondering about that (ARM actually has two different 'big endian' modes, one of which is byte-invariant and one of which is word-invariant, and which are runtime selectable on at least some cores...) But I think I agree with Paul Brook that endianness as we're considering it here is really kind of a bus level property, and TARGET_WORDS_BIGENDIAN is defining a sort of "system bus endianness". Runtime flippable cores do the swapping in generated code before they get out to this bit, which corresponds to how the hardware does it (things get swapped before they get out to the signals external to the core).
That does mean that in some cases you end up doing a double byteswap, but my guess would be that the slowdown on doing that for device access is completely buried by the slowdown on having to do that for RAM access, so it's not worth worrying about.
-- PMM
Re: [Qemu-devel] [PATCH 01/15] exec: introduce endianness swapped mmio
In reply to Andreas FärberQuoted 11 lines
Quoted 11 lines
exec.c +0
-0@@ -3370,6 +3474,22 @@ static int cpu_register_io_memory_fixed(int io_index, } io_mem_opaque[io_index] = opaque;
Quoted 8 lines
exec.c static int cpu_register_io_memory_fixed(int io_index, · line 3482
Quoted 6 lines
exec.c +6
-0+switch (endian) { +case DEVICE_BIG_ENDIAN : +#ifndef TARGET_WORDS_BIGENDIAN +swapendian_init (io_index); +#endif +break ;So basically, you just moved the #ifdefs to another place. :)
Many #ifdefs inconsistently scattered through all the device code have been replaced by a single #ifdef.
Quoted 4 lines
Shouldn't this be dependent on the CPU state and determined at runtime? Thinking of MSR LE bit on ppc. I guess QEMU doesn't support bi-endian ppc today, as does the 970, but it would be nice to keep it in mind.
Switching endianness of a CPU generally does not effect the endianness of the CPU/peripheral busses. It makes the CPU byteswap accesses before they are seen by either memory or devices.
In theory it might be possible to avoid redundant byteswaps if you're really clever. In practice you still have to handle the fact that your devices are a different endianness to RAM, so it probably doesn't gain you a whole lot.
Paul
Re: [Qemu-devel] [PATCH 01/15] exec: introduce endianness swapped mmio
Quoted 28 lines · Paul Brook
Quoted 11 lines
Quoted 11 lines
exec.c +0
-0@@ -3370,6 +3474,22 @@ static int cpu_register_io_memory_fixed(int io_index, } io_mem_opaque[io_index] = opaque;Quoted 8 lines
exec.c static int cpu_register_io_memory_fixed(int io_index, · line 3482
Quoted 6 lines
exec.c +6
-0+ switch (endian) { + case DEVICE_BIG_ENDIAN: +#ifndef TARGET_WORDS_BIGENDIAN + swapendian_init(io_index); +#endif + break;So basically, you just moved the #ifdefs to another place. :)
Many #ifdefs inconsistently scattered through all the device code have been replaced by a single #ifdef.
Quoted 4 lines
Shouldn't this be dependent on the CPU state and determined at runtime? Thinking of MSR LE bit on ppc. I guess QEMU doesn't support bi-endian ppc today, as does the 970, but it would be nice to keep it in mind.
Quoted 7 lines
Switching endianness of a CPU generally does not effect the endianness of the CPU/peripheral busses. It makes the CPU byteswap accesses before they are seen by either memory or devices.
In theory it might be possible to avoid redundant byteswaps if you're really clever. In practice you still have to handle the fact that your devices are a different endianness to RAM, so it probably doesn't gain you a whole lot.
Sparc64 MMU can also perform byte swapping, there is also a byte swapping CPU mode and byte swapping access instructions. I think only the instructions are used (for PCI).
Re: [Qemu-devel] [PATCH 01/15] exec: introduce endianness swapped mmio
Quoted 4 lines
Quoted 4 lines
Switching endianness of a CPU generally does not effect the endianness of the CPU/peripheral busses. It makes the CPU byteswap accesses before they are seen by either memory or devices.
Quoted 8 lines
Quoted 4 lines
In theory it might be possible to avoid redundant byteswaps if you're really clever. In practice you still have to handle the fact that your devices are a different endianness to RAM, so it probably doesn't gain you a whole lot.
Sparc64 MMU can also perform byte swapping, there is also a byte swapping CPU mode and byte swapping access instructions. I think only the instructions are used (for PCI).
Right, but that is (to a large extent) a separate problem from memory mapped peripherals. You still have to handle the case where a single TLB entry covers both ram and a cross-endian device.
Paul
Re: [Qemu-devel] [PATCH 01/15] exec: introduce endianness swapped mmio
In reply to Alexander GrafQuoted 6 lines · Alexander Graf
The way we're currently modeling mmio is too simplified. We assume that every device has the same endianness as the target CPU. In reality, most devices are little endian (all PCI and ISA ones I'm aware of). Some are big endian (special system devices) and a very little fraction is target native endian (
fw_cfg).
As far as I can see fw_cfg calls cpu_to_le() on some of entries and doesn't on others. Doesn't this makes it "mixed endian" (aka broken)?
--
Gleb.
Re: [Qemu-devel] [PATCH 01/15] exec: introduce endianness swapped mmio
Quoted 9 lines · Gleb Natapov
Quoted 6 lines · Alexander Graf
The way we're currently modeling mmio is too simplified. We assume that every device has the same endianness as the target CPU. In reality, most devices are little endian (all PCI and ISA ones I'm aware of). Some are big endian (special system devices) and a very little fraction is target native endian (
fw_cfg).As far as I can see
fw_cfgcallscpu_to_le()on some of entries and doesn't on others. Doesn't this makes it "mixed endian" (aka broken)?
There are two layers of brokenness:
1) MMIO
2) Internal structures
A device that assumes native target endianness for its own MMIO is usually broken. Devices don't know which CPU they're plugged to (unless built inside of course) :).
That specific issue is that fw_cfg_mem_writew directly takes the selector as is and both openbios and seabios expect it to accept values in native endianness. The way forward to fix this is probably to declare the selector as little endian and just commit a new version of openbios.
Its internal structures are a different story. If the interface spec of fw_cfg (basically the .c file atm) defines some values to be a different endianness from the other, that might be acceptable. It's still unpretty though. I'd way prefer to see everything aligned to a single endianness.
Alex
PATCH 2/15 Add endianness as io mem parameter
In reply to Alexander GrafAs stated before, devices can be little, big or native endian. The target endianness is not of their concern, so we need to push things down a level.
This patch adds a parameter to cpu_register_io_memory that allows a device to choose its endianness. For now, all devices simply choose native endian, because that's the same behavior as before.
--- cpu-common.h | 2 +- exec.c | 25 ++++++++++++++++--------- hw/apb_pci.c | 6 ++++-- hw/apic.c | 3 ++- hw/arm_gic.c | 3 ++- hw/arm_sysctl.c | 3 ++- hw/arm_timer.c | 5 +++-- hw/armv7m.c | 2 +- hw/axis_dev88.c | 6 ++++-- hw/bonito.c | 15 ++++++++++----- hw/cirrus_vga.c | 12 ++++++++---- hw/cs4231.c | 3 ++- hw/cuda.c | 3 ++- hw/dp8393x.c | 3 ++- hw/ds1225y.c | 6 ++++-- hw/e1000.c | 2 +- hw/eccmemctl.c | 6 ++++-- hw/eepro100.c | 3 ++- hw/empty_slot.c | 3 ++- hw/escc.c | 3 ++- hw/esp.c | 3 ++- hw/etraxfs_dma.c | 2 +- hw/etraxfs_eth.c | 3 ++- hw/etraxfs_pic.c | 3 ++- hw/etraxfs_ser.c | 3 ++- hw/etraxfs_timer.c | 3 ++- hw/fdc.c | 6 ++++-- hw/fw_cfg.c | 6 ++++-- hw/g364fb.c | 3 ++- hw/gt64xxx.c | 3 ++- hw/heathrow_pic.c | 3 ++- hw/hpet.c | 3 ++- hw/ide/macio.c | 3 ++- hw/ide/mmio.c | 6 ++++-- hw/integratorcp.c | 9 ++++++--- hw/intel-hda.c | 3 ++- hw/ioapic.c | 3 ++- hw/isa_mmio.c | 6 ++++-- hw/ivshmem.c | 2 +- hw/jazz_led.c | 3 ++- hw/lan9118.c | 3 ++- hw/lance.c | 3 ++- hw/lsi53c895a.c | 6 ++++-- hw/m48t59.c | 3 ++- hw/mac_dbdma.c | 3 ++- hw/mac_nvram.c | 3 ++- hw/marvell_88w8618_audio.c | 3 ++- hw/mcf5206.c | 3 ++- hw/mcf5208.c | 6 ++++-- hw/mcf_fec.c | 3 ++- hw/mcf_intc.c | 3 ++- hw/mcf_uart.c | 3 ++- hw/mips_jazz.c | 6 ++++-- hw/mips_malta.c | 3 ++- hw/mips_r4k.c | 3 ++- hw/mpcore.c | 3 ++- hw/msix.c | 3 ++- hw/mst_fpga.c | 2 +- hw/musicpal.c | 24 ++++++++++++++++-------- hw/omap.h | 3 ++- hw/omap1.c | 42 ++++++++++++++++++++++-------------------- hw/omap2.c | 4 ++-- hw/omap_dma.c | 4 ++-- hw/omap_dss.c | 2 +- hw/omap_gpio.c | 2 +- hw/omap_gpmc.c | 2 +- hw/omap_i2c.c | 2 +- hw/omap_intc.c | 4 ++-- hw/omap_l4.c | 5 +++-- hw/omap_lcdc.c | 2 +- hw/omap_mmc.c | 2 +- hw/omap_sdrc.c | 2 +- hw/omap_sx1.c | 15 ++++++++++----- hw/omap_uart.c | 2 +- hw/onenand.c | 2 +- hw/openpic.c | 10 ++++++---- hw/palm.c | 12 ++++++++---- hw/parallel.c | 3 ++- hw/pcie_host.c | 3 ++- hw/pckbd.c | 3 ++- hw/pcnet.c | 3 ++- hw/pflash_cfi01.c | 6 ++++-- hw/pflash_cfi02.c | 4 ++-- hw/pl011.c | 3 ++- hw/pl022.c | 3 ++- hw/pl031.c | 3 ++- hw/pl050.c | 3 ++- hw/pl061.c | 3 ++- hw/pl080.c | 3 ++- hw/pl110.c | 3 ++- hw/pl181.c | 4 ++-- hw/pl190.c | 3 ++- hw/ppc405_boards.c | 6 ++++-- hw/ppc405_uc.c | 11 +++++++---- hw/ppc4xx_pci.c | 6 ++++-- hw/ppc_newworld.c | 3 ++- hw/ppc_prep.c | 8 +++++--- hw/ppce500_pci.c | 3 ++- hw/prep_pci.c | 3 ++- hw/pxa2xx.c | 25 +++++++++++++------------ hw/pxa2xx_dma.c | 2 +- hw/pxa2xx_gpio.c | 2 +- hw/pxa2xx_keypad.c | 2 +- hw/pxa2xx_lcd.c | 2 +- hw/pxa2xx_mmci.c | 2 +- hw/pxa2xx_pcmcia.c | 6 +++--- hw/pxa2xx_pic.c | 2 +- hw/pxa2xx_timer.c | 2 +- hw/r2d.c | 3 ++- hw/rc4030.c | 6 ++++-- hw/realview.c | 3 ++- hw/realview_gic.c | 3 ++- hw/rtl8139.c | 3 ++- hw/sbi.c | 3 ++- hw/serial.c | 6 ++++-- hw/sh7750.c | 6 ++++-- hw/sh_intc.c | 3 ++- hw/sh_pci.c | 3 ++- hw/sh_serial.c | 3 ++- hw/sh_timer.c | 3 ++- hw/slavio_intctl.c | 3 ++- hw/slavio_misc.c | 24 ++++++++++++++++-------- hw/slavio_timer.c | 3 ++- hw/sm501.c | 9 ++++++--- hw/smc91c111.c | 3 ++- hw/sparc32_dma.c | 3 ++- hw/spitz.c | 2 +- hw/stellaris.c | 12 ++++++++---- hw/stellaris_enet.c | 3 ++- hw/sun4c_intctl.c | 3 ++- hw/sun4m_iommu.c | 3 ++- hw/syborg_fb.c | 3 ++- hw/syborg_interrupt.c | 3 ++- hw/syborg_keyboard.c | 3 ++- hw/syborg_pointer.c | 3 ++- hw/syborg_rtc.c | 3 ++- hw/syborg_serial.c | 3 ++- hw/syborg_timer.c | 3 ++- hw/syborg_virtio.c | 3 ++- hw/tc6393xb.c | 2 +- hw/tcx.c | 5 +++-- hw/tusb6010.c | 2 +- hw/usb-ohci.c | 3 ++- hw/versatile_pci.c | 3 ++- hw/versatilepb.c | 3 ++- hw/vga-isa-mm.c | 6 ++++-- hw/vga.c | 3 ++- hw/vmware_vga.c | 2 +- hw/wdt_i6300esb.c | 3 ++- hw/xilinx_ethlite.c | 2 +- hw/xilinx_intc.c | 2 +- hw/xilinx_timer.c | 3 ++- hw/xilinx_uartlite.c | 3 ++- hw/zaurus.c | 2 +- rwhandler.c | 2 +- 155 files changed, 447 insertions(+), 264 deletions(-)
cpu-common.h +1 -1
@@ -56,7 +56,7 @@ ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr);int cpu_register_io_memory (CPUReadMemoryFunc *const *mem_read,CPUWriteMemoryFunc *const *mem_write, -void *opaque); +void *opaque,int endian);void cpu_unregister_io_memory (int table_address); void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
exec.c +16 -9
@@ -3312,7 +3312,8 @@ static subpage_t *subpage_init (target_phys_addr_t base, ram_addr_t *phys, mmio =qemu_mallocz (sizeof (subpage_t)); mmio->base = base; - subpage_memory =cpu_register_io_memory (subpage_read, subpage_write, mmio); + subpage_memory =cpu_register_io_memory (subpage_read, subpage_write, mmio, +DEVICE_NATIVE_ENDIAN );#if defined(DEBUG_SUBPAGE )printf ("%s: %p base " TARGET_FMT_plx" len %08x %d\n" , __func__, mmio, base,TARGET_PAGE_SIZE , subpage_memory);
@@ -3449,10 +3450,9 @@ static void swapendian_del(int io_index)static int cpu_register_io_memory_fixed (int io_index,CPUReadMemoryFunc *const *mem_read,CPUWriteMemoryFunc *const *mem_write, -void *opaque) +void *opaque,int endian) {int i; -int endian =DEVICE_NATIVE_ENDIAN ;if (io_index <=0 ) { io_index =get_free_io_mem_idx ();
@@ -3495,9 +3495,9 @@ static int cpu_register_io_memory_fixed(int io_index,int cpu_register_io_memory (CPUReadMemoryFunc *const *mem_read,CPUWriteMemoryFunc *const *mem_write, -void *opaque) +void *opaque,int endian) { -return cpu_register_io_memory_fixed (0 , mem_read, mem_write, opaque); +return cpu_register_io_memory_fixed (0 , mem_read, mem_write, opaque, endian); }void cpu_unregister_io_memory (int io_table_address)
@@ -3519,14 +3519,21 @@ static void io_mem_init(void) {int i; -cpu_register_io_memory_fixed (IO_MEM_ROM , error_mem_read, unassigned_mem_write,NULL ); -cpu_register_io_memory_fixed (IO_MEM_UNASSIGNED , unassigned_mem_read, unassigned_mem_write,NULL ); -cpu_register_io_memory_fixed (IO_MEM_NOTDIRTY , error_mem_read, notdirty_mem_write,NULL ); +cpu_register_io_memory_fixed (IO_MEM_ROM , error_mem_read, + unassigned_mem_write,NULL , +DEVICE_NATIVE_ENDIAN ); +cpu_register_io_memory_fixed (IO_MEM_UNASSIGNED , unassigned_mem_read, + unassigned_mem_write,NULL , +DEVICE_NATIVE_ENDIAN ); +cpu_register_io_memory_fixed (IO_MEM_NOTDIRTY , error_mem_read, + notdirty_mem_write,NULL , +DEVICE_NATIVE_ENDIAN );for (i=0 ; i<5 ; i++) io_mem_used[i] =1 ; io_mem_watch =cpu_register_io_memory (watch_mem_read, - watch_mem_write,NULL ); + watch_mem_write,NULL , +DEVICE_NATIVE_ENDIAN ); }#endif /* !defined(CONFIG_USER_ONLY) */
hw/apb_pci.c +4 -2
@@ -410,7 +410,8 @@ static int pci_pbm_init_device(SysBusDevice *dev)/* apb_config */ apb_config =cpu_register_io_memory (apb_config_read, - apb_config_write, s); + apb_config_write, s, +DEVICE_NATIVE_ENDIAN );/* at region 0 */ sysbus_init_mmio (dev,0x10000ULL , apb_config);
@@ -424,7 +425,8 @@ static int pci_pbm_init_device(SysBusDevice *dev)/* pci_ioport */ pci_ioport =cpu_register_io_memory (pci_apb_ioread, - pci_apb_iowrite, s); + pci_apb_iowrite, s, +DEVICE_NATIVE_ENDIAN );/* at region 2 */ sysbus_init_mmio (dev,0x10000ULL , pci_ioport);
hw/apic.c +2 -1
@@ -980,7 +980,8 @@ static int apic_init1(SysBusDevice *dev)return -1 ; } apic_io_memory =cpu_register_io_memory (apic_mem_read, - apic_mem_write,NULL ); + apic_mem_write,NULL , +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MSI_ADDR_SIZE , apic_io_memory); s->timer =qemu_new_timer (vm_clock, apic_timer, s);
hw/arm_gic.c +2 -1
@@ -742,7 +742,8 @@ static void gic_init(gic_state *s)sysbus_init_irq (&s->busdev, &s->parent_irq[i]); } s->iomemtype =cpu_register_io_memory (gic_dist_readfn, - gic_dist_writefn, s); + gic_dist_writefn, s, +DEVICE_NATIVE_ENDIAN );gic_reset (s);register_savevm (NULL ,"arm_gic" ,-1 ,1 , gic_save, gic_load, s); }
hw/arm_sysctl.c +2 -1
@@ -208,7 +208,8 @@ static int arm_sysctl_init1(SysBusDevice *dev)int iomemtype; iomemtype =cpu_register_io_memory (arm_sysctl_readfn, - arm_sysctl_writefn, s); + arm_sysctl_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);/* ??? Save/restore. */ return 0 ;
hw/arm_timer.c +3 -2
@@ -269,7 +269,7 @@ static int sp804_init(SysBusDevice *dev) s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ]; iomemtype =cpu_register_io_memory (sp804_readfn, - sp804_writefn, s); + sp804_writefn, s,DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);register_savevm (&dev->qdev,"sp804" ,-1 ,1 , sp804_save, sp804_load, s);return 0 ;
@@ -340,7 +340,8 @@ static int icp_pit_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->timer[2 ]->irq); iomemtype =cpu_register_io_memory (icp_pit_readfn, - icp_pit_writefn, s); + icp_pit_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);/* This device has no state to save/restore. The component timers will save themselves. */
hw/armv7m.c +1 -1
@@ -130,7 +130,7 @@ static int bitband_init(SysBusDevice *dev)int iomemtype; iomemtype =cpu_register_io_memory (bitband_readfn, bitband_writefn, - &s->base); + &s->base,DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x02000000 , iomemtype);return 0 ; }
hw/axis_dev88.c +4 -2
@@ -280,11 +280,13 @@ void axisdev88_init (ram_addr_t ram_size,/* Attach a NAND flash to CS1. */ nand_state.nand =nand_init (NAND_MFR_STMICRO ,0x39 ); - nand_regs =cpu_register_io_memory (nand_read, nand_write, &nand_state); + nand_regs =cpu_register_io_memory (nand_read, nand_write, &nand_state, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0x10000000 ,0x05000000 , nand_regs); gpio_state.nand = &nand_state; - gpio_regs =cpu_register_io_memory (gpio_read, gpio_write, &gpio_state); + gpio_regs =cpu_register_io_memory (gpio_read, gpio_write, &gpio_state, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0x3001a000 ,0x5c , gpio_regs);
hw/bonito.c +10 -5
@@ -698,7 +698,8 @@ static int bonito_initfn(PCIDevice *dev)pci_config_set_revision (dev->config,0x01 );/* set the north bridge register mapping */ - s->bonito_reg_handle =cpu_register_io_memory (bonito_read, bonito_write, s); + s->bonito_reg_handle =cpu_register_io_memory (bonito_read, bonito_write, s, +DEVICE_NATIVE_ENDIAN ); s->bonito_reg_start =BONITO_INTERNAL_REG_BASE ; s->bonito_reg_length =BONITO_INTERNAL_REG_SIZE ; cpu_register_physical_memory(s->bonito_reg_start, s->bonito_reg_length,
@@ -706,7 +707,8 @@ static int bonito_initfn(PCIDevice *dev)/* set the north bridge pci configure mapping */ s->bonito_pciconf_handle =cpu_register_io_memory (bonito_pciconf_read, - bonito_pciconf_write, s); + bonito_pciconf_write, s, +DEVICE_NATIVE_ENDIAN ); s->bonito_pciconf_start =BONITO_PCICONFIG_BASE ; s->bonito_pciconf_length =BONITO_PCICONFIG_SIZE ; cpu_register_physical_memory(s->bonito_pciconf_start, s->bonito_pciconf_length,
@@ -714,21 +716,24 @@ static int bonito_initfn(PCIDevice *dev)/* set the south bridge pci configure mapping */ s->bonito_spciconf_handle =cpu_register_io_memory (bonito_spciconf_read, - bonito_spciconf_write, s); + bonito_spciconf_write, s, +DEVICE_NATIVE_ENDIAN ); s->bonito_spciconf_start =BONITO_SPCICONFIG_BASE ; s->bonito_spciconf_length =BONITO_SPCICONFIG_SIZE ;cpu_register_physical_memory (s->bonito_spciconf_start, s->bonito_spciconf_length, s->bonito_spciconf_handle); s->bonito_ldma_handle =cpu_register_io_memory (bonito_ldma_read, - bonito_ldma_write, s); + bonito_ldma_write, s, +DEVICE_NATIVE_ENDIAN ); s->bonito_ldma_start =0xbfe00200 ; s->bonito_ldma_length =0x100 ;cpu_register_physical_memory (s->bonito_ldma_start, s->bonito_ldma_length, s->bonito_ldma_handle); s->bonito_cop_handle =cpu_register_io_memory (bonito_cop_read, - bonito_cop_write, s); + bonito_cop_write, s, +DEVICE_NATIVE_ENDIAN ); s->bonito_cop_start =0xbfe00300 ; s->bonito_cop_length =0x100 ; cpu_register_physical_memory(s->bonito_cop_start, s->bonito_cop_length,
hw/cirrus_vga.c +8 -4
@@ -3076,23 +3076,27 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)register_ioport_read (0x3da ,1 ,1 , cirrus_vga_ioport_read, s); s->vga.vga_io_memory =cpu_register_io_memory (cirrus_vga_mem_read, - cirrus_vga_mem_write, s); + cirrus_vga_mem_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (isa_mem_base +0x000a0000 ,0x20000 , s->vga.vga_io_memory);qemu_register_coalesced_mmio (isa_mem_base +0x000a0000 ,0x20000 );/* I/O handler for LFB */ s->cirrus_linear_io_addr = -cpu_register_io_memory (cirrus_linear_read, cirrus_linear_write, s); +cpu_register_io_memory (cirrus_linear_read, cirrus_linear_write, s, +DEVICE_NATIVE_ENDIAN );/* I/O handler for LFB */ s->cirrus_linear_bitblt_io_addr =cpu_register_io_memory (cirrus_linear_bitblt_read, - cirrus_linear_bitblt_write, s); + cirrus_linear_bitblt_write, s, +DEVICE_NATIVE_ENDIAN );/* I/O handler for memory-mapped I/O */ s->cirrus_mmio_io_addr = -cpu_register_io_memory (cirrus_mmio_read, cirrus_mmio_write, s); +cpu_register_io_memory (cirrus_mmio_read, cirrus_mmio_write, s, +DEVICE_NATIVE_ENDIAN ); s->real_vram_size = (s->device_id ==CIRRUS_ID_CLGD5446 ) ?4096 *1024 :2048 *1024 ;
hw/cs4231.c +2 -1
@@ -148,7 +148,8 @@ static int cs4231_init1(SysBusDevice *dev)int io;CSState *s =FROM_SYSBUS (CSState, dev); - io =cpu_register_io_memory (cs_mem_read, cs_mem_write, s); + io =cpu_register_io_memory (cs_mem_read, cs_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,CS_SIZE , io);sysbus_init_irq (dev, &s->irq);
hw/cuda.c +2 -1
@@ -762,7 +762,8 @@ void cuda_init (int *cuda_mem_index, qemu_irq irq) s->tick_offset = (uint32_t )mktimegm (&tm) +RTC_OFFSET ; s->adb_poll_timer =qemu_new_timer (vm_clock, cuda_adb_poll, s); - *cuda_mem_index =cpu_register_io_memory (cuda_read, cuda_write, s); + *cuda_mem_index =cpu_register_io_memory (cuda_read, cuda_write, s, +DEVICE_NATIVE_ENDIAN );register_savevm (NULL ,"cuda" ,-1 ,1 , cuda_save, cuda_load, s);qemu_register_reset (cuda_reset, s); }
hw/dp8393x.c +2 -1
@@ -908,6 +908,7 @@ void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift,qemu_register_reset (nic_reset, s);nic_reset (s); - s->mmio_index =cpu_register_io_memory (dp8393x_read, dp8393x_write, s); + s->mmio_index =cpu_register_io_memory (dp8393x_read, dp8393x_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x40 << it_shift, s->mmio_index); }
hw/ds1225y.c +4 -2
@@ -171,10 +171,12 @@ void *ds1225y_init(target_phys_addr_t mem_base, const char *filename) }/* Read/write memory */ - mem_indexRW =cpu_register_io_memory (nvram_read, nvram_write, s); + mem_indexRW =cpu_register_io_memory (nvram_read, nvram_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (mem_base, s->chip_size, mem_indexRW);/* Read/write protected memory */ - mem_indexRP =cpu_register_io_memory (nvram_read, nvram_write_protected, s); + mem_indexRP =cpu_register_io_memory (nvram_read, nvram_write_protected, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (mem_base + s->chip_size, s->chip_size, mem_indexRP);return s; }
hw/e1000.c +1 -1
@@ -1131,7 +1131,7 @@ static int pci_e1000_init(PCIDevice *pci_dev) pci_conf[PCI_INTERRUPT_PIN ] =1 ;// interrupt pin 0 d->mmio_index =cpu_register_io_memory (e1000_mmio_read, - e1000_mmio_write, d); + e1000_mmio_write, d,DEVICE_NATIVE_ENDIAN );pci_register_bar ((PCIDevice *)d,0 ,PNPMMIO_SIZE ,PCI_BASE_ADDRESS_SPACE_MEMORY , e1000_mmio_map);
hw/eccmemctl.c +4 -2
@@ -297,12 +297,14 @@ static int ecc_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); s->regs[0 ] = s->version; - ecc_io_memory =cpu_register_io_memory (ecc_mem_read, ecc_mem_write, s); + ecc_io_memory =cpu_register_io_memory (ecc_mem_read, ecc_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,ECC_SIZE , ecc_io_memory);if (s->version ==ECC_MCC ) {// SS-600MP only ecc_io_memory =cpu_register_io_memory (ecc_diag_mem_read, - ecc_diag_mem_write, s); + ecc_diag_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,ECC_DIAG_SIZE , ecc_io_memory); }
hw/eepro100.c +2 -1
@@ -1878,7 +1878,8 @@ static int e100_nic_init(PCIDevice *pci_dev)/* Handler for memory-mapped I/O */ s->mmio_index = -cpu_register_io_memory (pci_mmio_read, pci_mmio_write, s); +cpu_register_io_memory (pci_mmio_read, pci_mmio_write, s, +DEVICE_NATIVE_ENDIAN ); pci_register_bar(&s->dev, 0, PCI_MEM_SIZE, PCI_BASE_ADDRESS_SPACE_MEMORY |
hw/empty_slot.c +2 -1
@@ -73,7 +73,8 @@ static int empty_slot_init1(SysBusDevice *dev)ram_addr_t empty_slot_offset; empty_slot_offset =cpu_register_io_memory (empty_slot_read, - empty_slot_write, s); + empty_slot_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev, s->size, empty_slot_offset |IO_MEM_RAM );return 0 ; }
hw/escc.c +2 -1
@@ -914,7 +914,8 @@ static int escc_init1(SysBusDevice *dev) s->chn[0 ].otherchn = &s->chn[1 ]; s->chn[1 ].otherchn = &s->chn[0 ]; - io =cpu_register_io_memory (escc_mem_read, escc_mem_write, s); + io =cpu_register_io_memory (escc_mem_read, escc_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,ESCC_SIZE << s->it_shift, io); s->mmio_index = io;
hw/esp.c +2 -1
@@ -722,7 +722,8 @@ static int esp_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq);assert (s->it_shift !=-1 ); - esp_io_memory =cpu_register_io_memory (esp_mem_read, esp_mem_write, s); + esp_io_memory =cpu_register_io_memory (esp_mem_read, esp_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,ESP_REGS << s->it_shift, esp_io_memory);qdev_init_gpio_in (&dev->qdev, esp_gpio_demux,2 );
hw/etraxfs_dma.c +1 -1
@@ -750,7 +750,7 @@ void *etraxfs_dmac_init(target_phys_addr_t base, int nr_channels) ctrl->nr_channels = nr_channels; ctrl->channels =qemu_mallocz (sizeof ctrl->channels[0 ] * nr_channels); - ctrl->map =cpu_register_io_memory (dma_read, dma_write, ctrl); + ctrl->map =cpu_register_io_memory (dma_read, dma_write, ctrl,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base, nr_channels *0x2000 , ctrl->map);return ctrl; }
hw/etraxfs_eth.c +2 -1
@@ -598,7 +598,8 @@ void *etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr)tdk_init (ð->phy);mdio_attach (ð->mdio_bus, ð->phy, eth->phyaddr); - eth->ethregs =cpu_register_io_memory (eth_read, eth_write, eth); + eth->ethregs =cpu_register_io_memory (eth_read, eth_write, eth, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x5c , eth->ethregs);memcpy (eth->conf.macaddr.a, nd->macaddr,sizeof (nd->macaddr));
hw/etraxfs_pic.c +2 -1
@@ -145,7 +145,8 @@ static int etraxfs_pic_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->parent_irq);sysbus_init_irq (dev, &s->parent_nmi); - intr_vect_regs =cpu_register_io_memory (pic_read, pic_write, s); + intr_vect_regs =cpu_register_io_memory (pic_read, pic_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,R_MAX *4 , intr_vect_regs);return 0 ; }
hw/etraxfs_ser.c +2 -1
@@ -200,7 +200,8 @@ static int etraxfs_ser_init(SysBusDevice *dev) s->regs[RS_STAT_DIN ] |= (1 <<STAT_TR_IDLE );sysbus_init_irq (dev, &s->irq); - ser_regs =cpu_register_io_memory (ser_read, ser_write, s); + ser_regs =cpu_register_io_memory (ser_read, ser_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,R_MAX *4 , ser_regs); s->chr =qdev_init_chardev (&dev->qdev);if (s->chr)
hw/etraxfs_timer.c +2 -1
@@ -323,7 +323,8 @@ static int etraxfs_timer_init(SysBusDevice *dev)sysbus_init_irq (dev, &t->irq);sysbus_init_irq (dev, &t->nmi); - timer_regs =cpu_register_io_memory (timer_read, timer_write, t); + timer_regs =cpu_register_io_memory (timer_read, timer_write, t, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x5c , timer_regs);qemu_register_reset (etraxfs_timer_reset, t);
hw/fdc.c +4 -2
@@ -1999,7 +1999,8 @@ static int sysbus_fdc_init1(SysBusDevice *dev)int io;int ret; - io =cpu_register_io_memory (fdctrl_mem_read, fdctrl_mem_write, fdctrl); + io =cpu_register_io_memory (fdctrl_mem_read, fdctrl_mem_write, fdctrl, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x08 , io);sysbus_init_irq (dev, &fdctrl->irq);qdev_init_gpio_in (&dev->qdev, fdctrl_handle_tc,1 );
@@ -2017,7 +2018,8 @@ static int sun4m_fdc_init1(SysBusDevice *dev)int io; io =cpu_register_io_memory (fdctrl_mem_read_strict, - fdctrl_mem_write_strict, fdctrl); + fdctrl_mem_write_strict, fdctrl, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x08 , io);sysbus_init_irq (dev, &fdctrl->irq);qdev_init_gpio_in (&dev->qdev, fdctrl_handle_tc,1 );
hw/fw_cfg.c +4 -2
@@ -360,11 +360,13 @@ static int fw_cfg_init1(SysBusDevice *dev)int io_ctl_memory, io_data_memory; io_ctl_memory =cpu_register_io_memory (fw_cfg_ctl_mem_read, - fw_cfg_ctl_mem_write, s); + fw_cfg_ctl_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,FW_CFG_SIZE , io_ctl_memory); io_data_memory =cpu_register_io_memory (fw_cfg_data_mem_read, - fw_cfg_data_mem_write, s); + fw_cfg_data_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,FW_CFG_SIZE , io_data_memory);if (s->ctl_iobase) {
hw/g364fb.c +2 -1
@@ -607,7 +607,8 @@ int g364fb_mm_init(target_phys_addr_t vram_base,cpu_register_physical_memory (vram_base, s->vram_size, s->vram_offset); - io_ctrl =cpu_register_io_memory (g364fb_ctrl_read, g364fb_ctrl_write, s); + io_ctrl =cpu_register_io_memory (g364fb_ctrl_read, g364fb_ctrl_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (ctrl_base,0x200000 , io_ctrl);return 0 ;
hw/gt64xxx.c +2 -1
@@ -1116,7 +1116,8 @@ PCIBus *pci_gt64120_init(qemu_irq *pic) s->pci->bus =pci_register_bus (NULL ,"pci" , pci_gt64120_set_irq, pci_gt64120_map_irq, pic,PCI_DEVFN (18 ,0 ),4 ); - s->ISD_handle =cpu_register_io_memory (gt64120_read, gt64120_write, s); + s->ISD_handle =cpu_register_io_memory (gt64120_read, gt64120_write, s, +DEVICE_NATIVE_ENDIAN ); d =pci_register_device (s->pci->bus,"GT64120 PCI Bus" ,sizeof (PCIDevice),0 ,NULL ,NULL );
hw/heathrow_pic.c +2 -1
@@ -222,7 +222,8 @@ qemu_irq *heathrow_pic_init(int *pmem_index, s =qemu_mallocz (sizeof (HeathrowPICS));/* only 1 CPU */ s->irqs = irqs[0 ]; - *pmem_index =cpu_register_io_memory (pic_read, pic_write, s); + *pmem_index =cpu_register_io_memory (pic_read, pic_write, s, +DEVICE_NATIVE_ENDIAN );register_savevm (NULL ,"heathrow_pic" ,-1 ,1 , heathrow_pic_save, heathrow_pic_load, s);
hw/hpet.c +2 -1
@@ -720,7 +720,8 @@ static int hpet_init(SysBusDevice *dev)/* HPET Area */ iomemtype =cpu_register_io_memory (hpet_ram_read, - hpet_ram_write, s); + hpet_ram_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x400 , iomemtype);return 0 ; }
hw/ide/macio.c +2 -1
@@ -320,7 +320,8 @@ int pmac_ide_init (DriveInfo **hd_table, qemu_irq irq,DBDMA_register_channel (dbdma, channel, dma_irq, pmac_ide_transfer, pmac_ide_flush, d); pmac_ide_memory =cpu_register_io_memory (pmac_ide_read, - pmac_ide_write, d); + pmac_ide_write, d, +DEVICE_NATIVE_ENDIAN );vmstate_register (NULL ,0 , &vmstate_pmac, d);qemu_register_reset (pmac_ide_reset, d);
hw/ide/mmio.c +4 -2
@@ -129,8 +129,10 @@ void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2, s->shift = shift; - mem1 =cpu_register_io_memory (mmio_ide_reads, mmio_ide_writes, s); - mem2 =cpu_register_io_memory (mmio_ide_status, mmio_ide_cmd, s); + mem1 =cpu_register_io_memory (mmio_ide_reads, mmio_ide_writes, s, +DEVICE_NATIVE_ENDIAN ); + mem2 =cpu_register_io_memory (mmio_ide_status, mmio_ide_cmd, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (membase,16 << shift, mem1);cpu_register_physical_memory (membase2,2 << shift, mem2);vmstate_register (NULL ,0 , &vmstate_ide_mmio, s);
hw/integratorcp.c +6 -3
@@ -256,7 +256,8 @@ static int integratorcm_init(SysBusDevice *dev) s->flash_offset =qemu_ram_alloc (NULL ,"integrator.flash" ,0x100000 ); iomemtype =cpu_register_io_memory (integratorcm_readfn, - integratorcm_writefn, s); + integratorcm_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x00800000 , iomemtype);integratorcm_do_remap (s,1 );/* ??? Save/restore. */
@@ -382,7 +383,8 @@ static int icp_pic_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->parent_irq);sysbus_init_irq (dev, &s->parent_fiq); iomemtype =cpu_register_io_memory (icp_pic_readfn, - icp_pic_writefn, s); + icp_pic_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x00800000 , iomemtype);return 0 ; }
@@ -435,7 +437,8 @@ static void icp_control_init(uint32_t base)int iomemtype; iomemtype =cpu_register_io_memory (icp_control_readfn, - icp_control_writefn,NULL ); + icp_control_writefn,NULL , +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00800000 , iomemtype);/* ??? Save/restore. */ }
hw/intel-hda.c +2 -1
@@ -1156,7 +1156,8 @@ static int intel_hda_init(PCIDevice *pci) conf[0x40 ] =0x01 ; d->mmio_addr =cpu_register_io_memory (intel_hda_mmio_read, - intel_hda_mmio_write, d); + intel_hda_mmio_write, d, +DEVICE_NATIVE_ENDIAN );pci_register_bar (&d->pci,0 ,0x4000 ,PCI_BASE_ADDRESS_SPACE_MEMORY , intel_hda_map);if (d->msi) {
hw/ioapic.c +2 -1
@@ -242,7 +242,8 @@ static int ioapic_init1(SysBusDevice *dev)int io_memory; io_memory =cpu_register_io_memory (ioapic_mem_read, - ioapic_mem_write, s); + ioapic_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , io_memory);qdev_init_gpio_in (&dev->qdev, ioapic_set_irq,IOAPIC_NUM_PINS );
hw/isa_mmio.c +4 -2
@@ -131,11 +131,13 @@ void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size, int be)if (be) { isa_mmio_iomemtype =cpu_register_io_memory (isa_mmio_read_be, isa_mmio_write_be, -NULL ); +NULL , +DEVICE_NATIVE_ENDIAN ); }else { isa_mmio_iomemtype =cpu_register_io_memory (isa_mmio_read_le, isa_mmio_write_le, -NULL ); +NULL , +DEVICE_NATIVE_ENDIAN ); } }cpu_register_physical_memory (base, size, isa_mmio_iomemtype);
hw/ivshmem.c +1 -1
@@ -720,7 +720,7 @@ static int pci_ivshmem_init(PCIDevice *dev) s->shm_fd =0 ; s->ivshmem_mmio_io_addr =cpu_register_io_memory (ivshmem_mmio_read, - ivshmem_mmio_write, s); + ivshmem_mmio_write, s,DEVICE_NATIVE_ENDIAN );/* region for registers*/ pci_register_bar (&s->dev,0 ,IVSHMEM_REG_BAR_SIZE ,PCI_BASE_ADDRESS_SPACE_MEMORY , ivshmem_mmio_map);
hw/jazz_led.c +2 -1
@@ -316,7 +316,8 @@ void jazz_led_init(target_phys_addr_t base) s->state =REDRAW_SEGMENTS |REDRAW_BACKGROUND ; - io =cpu_register_io_memory (led_read, led_write, s); + io =cpu_register_io_memory (led_read, led_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,1 , io); s->ds = graphic_console_init(jazz_led_update_display,
hw/lan9118.c +2 -1
@@ -1124,7 +1124,8 @@ static int lan9118_init1(SysBusDevice *dev)int i; s->mmio_index =cpu_register_io_memory (lan9118_readfn, - lan9118_writefn, s); + lan9118_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x100 , s->mmio_index);sysbus_init_irq (dev, &s->irq);qemu_macaddr_default_if_unset (&s->conf.macaddr);
hw/lance.c +2 -1
@@ -118,7 +118,8 @@ static int lance_init(SysBusDevice *dev)PCNetState *s = &d->state; s->mmio_index = -cpu_register_io_memory (lance_mem_read, lance_mem_write, d); +cpu_register_io_memory (lance_mem_read, lance_mem_write, d, +DEVICE_NATIVE_ENDIAN );qdev_init_gpio_in (&dev->qdev, parent_lance_reset,1 );
hw/lsi53c895a.c +4 -2
@@ -2173,9 +2173,11 @@ static int lsi_scsi_init(PCIDevice *dev) pci_conf[PCI_INTERRUPT_PIN ] =0x01 ; s->mmio_io_addr =cpu_register_io_memory (lsi_mmio_readfn, - lsi_mmio_writefn, s); + lsi_mmio_writefn, s, +DEVICE_NATIVE_ENDIAN ); s->ram_io_addr =cpu_register_io_memory (lsi_ram_readfn, - lsi_ram_writefn, s); + lsi_ram_writefn, s, +DEVICE_NATIVE_ENDIAN );/* TODO: use dev and get rid of cast below */ pci_register_bar((struct PCIDevice *)s, 0, 256,
hw/m48t59.c +2 -1
@@ -716,7 +716,8 @@ static int m48t59_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->IRQ); - mem_index =cpu_register_io_memory (nvram_read, nvram_write, s); + mem_index =cpu_register_io_memory (nvram_read, nvram_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev, s->size, mem_index);m48t59_init_common (s);
hw/mac_dbdma.c +2 -1
@@ -844,7 +844,8 @@ void* DBDMA_init (int *dbdma_mem_index) s =qemu_mallocz (sizeof (DBDMA_channel) *DBDMA_CHANNELS ); - *dbdma_mem_index =cpu_register_io_memory (dbdma_read, dbdma_write, s); + *dbdma_mem_index =cpu_register_io_memory (dbdma_read, dbdma_write, s, +DEVICE_NATIVE_ENDIAN );register_savevm (NULL ,"dbdma" ,-1 ,1 , dbdma_save, dbdma_load, s);qemu_register_reset (dbdma_reset, s);
hw/mac_nvram.c +2 -1
@@ -138,7 +138,8 @@ MacIONVRAMState *macio_nvram_init (int *mem_index, target_phys_addr_t size, s->size = size; s->it_shift = it_shift; - s->mem_index =cpu_register_io_memory (nvram_read, nvram_write, s); + s->mem_index =cpu_register_io_memory (nvram_read, nvram_write, s, +DEVICE_NATIVE_ENDIAN ); *mem_index = s->mem_index;register_savevm (NULL ,"macio_nvram" ,-1 ,1 , macio_nvram_save, macio_nvram_load, s);
hw/marvell_88w8618_audio.c +2 -1
@@ -249,7 +249,8 @@ static int mv88w8618_audio_init(SysBusDevice *dev)wm8750_data_req_set (s->wm, mv88w8618_audio_callback, s); iomemtype =cpu_register_io_memory (mv88w8618_audio_readfn, - mv88w8618_audio_writefn, s); + mv88w8618_audio_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MP_AUDIO_SIZE , iomemtype);return 0 ;
hw/mcf5206.c +2 -1
@@ -525,7 +525,8 @@ qemu_irq *mcf5206_init(uint32_t base, CPUState *env) s = (m5206_mbar_state *)qemu_mallocz (sizeof (m5206_mbar_state)); iomemtype =cpu_register_io_memory (m5206_mbar_readfn, - m5206_mbar_writefn, s); + m5206_mbar_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00001000 , iomemtype); pic =qemu_allocate_irqs (m5206_mbar_set_irq, s,14 );
hw/mcf5208.c +4 -2
@@ -179,7 +179,8 @@ static void mcf5208_sys_init(qemu_irq *pic)int i; iomemtype =cpu_register_io_memory (m5208_sys_readfn, - m5208_sys_writefn,NULL ); + m5208_sys_writefn,NULL , +DEVICE_NATIVE_ENDIAN );/* SDRAMC. */ cpu_register_physical_memory (0xfc0a8000 ,0x00004000 , iomemtype);/* Timers. */
@@ -188,7 +189,8 @@ static void mcf5208_sys_init(qemu_irq *pic) bh =qemu_bh_new (m5208_timer_trigger, s); s->timer =ptimer_init (bh); iomemtype =cpu_register_io_memory (m5208_timer_readfn, - m5208_timer_writefn, s); + m5208_timer_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0xfc080000 +0x4000 * i,0x00004000 , iomemtype); s->irq = pic[4 + i];
hw/mcf_fec.c +2 -1
@@ -467,7 +467,8 @@ void mcf_fec_init(NICInfo *nd, target_phys_addr_t base, qemu_irq *irq) s = (mcf_fec_state *)qemu_mallocz (sizeof (mcf_fec_state)); s->irq = irq; s->mmio_index =cpu_register_io_memory (mcf_fec_readfn, - mcf_fec_writefn, s); + mcf_fec_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x400 , s->mmio_index);memcpy (s->conf.macaddr.a, nd->macaddr,sizeof (nd->macaddr));
hw/mcf_intc.c +2 -1
@@ -149,7 +149,8 @@ qemu_irq *mcf_intc_init(target_phys_addr_t base, CPUState *env)mcf_intc_reset (s); iomemtype =cpu_register_io_memory (mcf_intc_readfn, - mcf_intc_writefn, s); + mcf_intc_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x100 , iomemtype);return qemu_allocate_irqs (mcf_intc_set_irq, s,64 );
hw/mcf_uart.c +2 -1
@@ -304,6 +304,7 @@ void mcf_uart_mm_init(target_phys_addr_t base, qemu_irq irq, s =mcf_uart_init (irq, chr); iomemtype =cpu_register_io_memory (mcf_uart_readfn, - mcf_uart_writefn, s); + mcf_uart_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x40 , iomemtype); }
hw/mips_jazz.c +4 -2
@@ -191,7 +191,8 @@ void mips_jazz_init (ram_addr_t ram_size,/* Chipset */ rc4030_opaque =rc4030_init (env->irq[6 ], env->irq[3 ], &rc4030, &dmas); - s_dma_dummy =cpu_register_io_memory (dma_dummy_read, dma_dummy_write,NULL ); + s_dma_dummy =cpu_register_io_memory (dma_dummy_read, dma_dummy_write,NULL , +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0x8000d000 ,0x00001000 , s_dma_dummy);/* ISA devices */
@@ -259,7 +260,8 @@ void mips_jazz_init (ram_addr_t ram_size,/* Real time clock */ rtc_init (1980 ,NULL ); - s_rtc =cpu_register_io_memory (rtc_read, rtc_write,NULL ); + s_rtc =cpu_register_io_memory (rtc_read, rtc_write,NULL , +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0x80004000 ,0x00001000 , s_rtc);/* Keyboard (i8042) */
hw/mips_malta.c +2 -1
@@ -436,7 +436,8 @@ static MaltaFPGAState *malta_fpga_init(target_phys_addr_t base, qemu_irq uart_ir s = (MaltaFPGAState *)qemu_mallocz (sizeof (MaltaFPGAState)); malta =cpu_register_io_memory (malta_fpga_read, - malta_fpga_write, s); + malta_fpga_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x900 , malta);/* 0xa00 is less than a page, so will still get the right offsets. */
hw/mips_r4k.c +2 -1
@@ -204,7 +204,8 @@ void mips_r4k_init (ram_addr_t ram_size,if (!mips_qemu_iomemtype) { mips_qemu_iomemtype =cpu_register_io_memory (mips_qemu_read, - mips_qemu_write,NULL ); + mips_qemu_write,NULL , +DEVICE_NATIVE_ENDIAN ); }cpu_register_physical_memory (0x1fbf0000 ,0x10000 , mips_qemu_iomemtype);
hw/mpcore.c +2 -1
@@ -276,7 +276,8 @@ static int mpcore_priv_init(SysBusDevice *dev)gic_init (&s->gic, s->num_cpu); s->iomemtype =cpu_register_io_memory (mpcore_priv_readfn, - mpcore_priv_writefn, s); + mpcore_priv_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio_cb (dev,0x2000 , mpcore_priv_map);for (i =0 ; i < s->num_cpu *2 ; i++) {mpcore_timer_init (s, &s->timer[i], i);
hw/msix.c +2 -1
@@ -254,7 +254,8 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,msix_mask_all (dev, nentries); dev->msix_mmio_index =cpu_register_io_memory (msix_mmio_read, - msix_mmio_write, dev); + msix_mmio_write, dev, +DEVICE_NATIVE_ENDIAN );if (dev->msix_mmio_index ==-1 ) { ret = -EBUSY ; goto err_index;
hw/mst_fpga.c +1 -1
@@ -232,7 +232,7 @@ qemu_irq *mst_irq_init(PXA2xxState *cpu, uint32_t base, int irq) s->pins = qi; iomemtype =cpu_register_io_memory (mst_fpga_readfn, - mst_fpga_writefn, s); + mst_fpga_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00100000 , iomemtype);register_savevm (NULL ,"mainstone_fpga" ,0 ,0 , mst_fpga_save, mst_fpga_load, s);
hw/musicpal.c +16 -8
@@ -388,7 +388,8 @@ static int mv88w8618_eth_init(SysBusDevice *dev) s->nic =qemu_new_nic (&net_mv88w8618_info, &s->conf, dev->qdev.info->name, dev->qdev.id, s); s->mmio_index =cpu_register_io_memory (mv88w8618_eth_readfn, - mv88w8618_eth_writefn, s); + mv88w8618_eth_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MP_ETH_SIZE , s->mmio_index);return 0 ; }
@@ -600,7 +601,8 @@ static int musicpal_lcd_init(SysBusDevice *dev) s->brightness =7 ; iomemtype =cpu_register_io_memory (musicpal_lcd_readfn, - musicpal_lcd_writefn, s); + musicpal_lcd_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MP_LCD_SIZE , iomemtype); s->ds = graphic_console_init(lcd_refresh, lcd_invalidate,
@@ -725,7 +727,8 @@ static int mv88w8618_pic_init(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, mv88w8618_pic_set_irq,32 );sysbus_init_irq (dev, &s->parent_irq); iomemtype =cpu_register_io_memory (mv88w8618_pic_readfn, - mv88w8618_pic_writefn, s); + mv88w8618_pic_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MP_PIC_SIZE , iomemtype);return 0 ; }
@@ -886,7 +889,8 @@ static int mv88w8618_pit_init(SysBusDevice *dev) } iomemtype =cpu_register_io_memory (mv88w8618_pit_readfn, - mv88w8618_pit_writefn, s); + mv88w8618_pit_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MP_PIT_SIZE , iomemtype);return 0 ; }
@@ -976,7 +980,8 @@ static int mv88w8618_flashcfg_init(SysBusDevice *dev) s->cfgr0 =0xfffe4285 ;/* Default as set by U-Boot for 8 MB flash */ iomemtype =cpu_register_io_memory (mv88w8618_flashcfg_readfn, - mv88w8618_flashcfg_writefn, s); + mv88w8618_flashcfg_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MP_FLASHCFG_SIZE , iomemtype);return 0 ; }
@@ -1037,7 +1042,8 @@ static void musicpal_misc_init(void)int iomemtype; iomemtype =cpu_register_io_memory (musicpal_misc_readfn, - musicpal_misc_writefn,NULL ); + musicpal_misc_writefn,NULL , +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (MP_MISC_BASE ,MP_MISC_SIZE , iomemtype); }
@@ -1082,7 +1088,8 @@ static int mv88w8618_wlan_init(SysBusDevice *dev)int iomemtype; iomemtype =cpu_register_io_memory (mv88w8618_wlan_readfn, - mv88w8618_wlan_writefn,NULL ); + mv88w8618_wlan_writefn,NULL , +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MP_WLAN_SIZE , iomemtype);return 0 ; }
@@ -1293,7 +1300,8 @@ static int musicpal_gpio_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); iomemtype =cpu_register_io_memory (musicpal_gpio_readfn, - musicpal_gpio_writefn, s); + musicpal_gpio_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MP_GPIO_SIZE , iomemtype);qdev_init_gpio_out (&dev->qdev, s->out,ARRAY_SIZE (s->out));
hw/omap.h +2 -1
@@ -1129,7 +1129,8 @@ inline static int debug_register_io_memory(CPUReadMemoryFunc * const *mem_read, s->mem_write = mem_write; s->opaque = opaque; s->in =0 ; - return cpu_register_io_memory(io_readfn, io_writefn, s); +return cpu_register_io_memory (io_readfn, io_writefn, s, + DEVICE_NATIVE_ENDIAN); }# define cpu_register_io_memory debug_register_io_memory# endif
hw/omap1.c +22 -20
156 lines not on this page · raw message
hw/omap2.c +2 -2
@@ -600,7 +600,7 @@ static struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta,AUD_register_card ("OMAP EAC" , &s->codec.card); iomemtype =cpu_register_io_memory (omap_eac_readfn, - omap_eac_writefn, s); + omap_eac_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype);return s;
@@ -788,7 +788,7 @@ static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta,omap_l4_attach (ta,0 , iomemtype); iomemtype =cpu_register_io_memory (omap_sti_fifo_readfn, - omap_sti_fifo_writefn, s); + omap_sti_fifo_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (channel_base,0x10000 , iomemtype);return s;
hw/omap_dma.c +2 -2
@@ -1659,7 +1659,7 @@ struct soc_dma_s *omap_dma_init(target_phys_addr_t base, qemu_irq *irqs,omap_dma_clk_update (s,0 ,1 ); iomemtype =cpu_register_io_memory (omap_dma_readfn, - omap_dma_writefn, s); + omap_dma_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base, memsize, iomemtype); mpu->drq = s->dma->drq;
@@ -2066,7 +2066,7 @@ struct soc_dma_s *omap_dma4_init(target_phys_addr_t base, qemu_irq *irqs,omap_dma_clk_update (s,0 , !!s->dma->freq); iomemtype =cpu_register_io_memory (omap_dma4_readfn, - omap_dma4_writefn, s); + omap_dma4_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x1000 , iomemtype); mpu->drq = s->dma->drq;
hw/omap_dss.c +1 -1
@@ -1045,7 +1045,7 @@ struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta, iomemtype[3 ] =l4_register_io_memory (omap_venc1_readfn, omap_venc1_writefn, s); iomemtype[4 ] =cpu_register_io_memory (omap_im3_readfn, - omap_im3_writefn, s); + omap_im3_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype[0 ]);omap_l4_attach (ta,1 , iomemtype[1 ]);omap_l4_attach (ta,2 , iomemtype[2 ]);
hw/omap_gpio.c +1 -1
@@ -183,7 +183,7 @@ struct omap_gpio_s *omap_gpio_init(target_phys_addr_t base,omap_gpio_reset (s); iomemtype =cpu_register_io_memory (omap_gpio_readfn, - omap_gpio_writefn, s); + omap_gpio_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x1000 , iomemtype);return s;
hw/omap_gpmc.c +1 -1
@@ -390,7 +390,7 @@ struct omap_gpmc_s *omap_gpmc_init(target_phys_addr_t base, qemu_irq irq)omap_gpmc_reset (s); iomemtype =cpu_register_io_memory (omap_gpmc_readfn, - omap_gpmc_writefn, s); + omap_gpmc_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x1000 , iomemtype);return s;
hw/omap_i2c.c +1 -1
@@ -437,7 +437,7 @@ struct omap_i2c_s *omap_i2c_init(target_phys_addr_t base,omap_i2c_reset (s); iomemtype =cpu_register_io_memory (omap_i2c_readfn, - omap_i2c_writefn, s); + omap_i2c_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x800 , iomemtype);return s;
hw/omap_intc.c +2 -2
@@ -371,7 +371,7 @@ struct omap_intr_handler_s *omap_inth_init(target_phys_addr_t base,omap_inth_reset (s); iomemtype =cpu_register_io_memory (omap_inth_readfn, - omap_inth_writefn, s); + omap_inth_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base, size, iomemtype);return s;
@@ -591,7 +591,7 @@ struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,omap_inth_reset (s); iomemtype =cpu_register_io_memory (omap2_inth_readfn, - omap2_inth_writefn, s); + omap2_inth_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base, size, iomemtype);return s;
hw/omap_l4.c +3 -2
@@ -107,7 +107,8 @@ int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read, CPUWriteMemoryFunc * const *mem_write, void *opaque) { -return cpu_register_io_memory (mem_read, mem_write, opaque); +return cpu_register_io_memory (mem_read, mem_write, opaque, +DEVICE_NATIVE_ENDIAN ); }#endif
@@ -131,7 +132,7 @@ struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num) omap_cpu_io_entry =cpu_register_io_memory (omap_l4_io_readfn, - omap_l4_io_writefn, bus); + omap_l4_io_writefn, bus,DEVICE_NATIVE_ENDIAN );# define L4_PAGES (0xb4000 / TARGET_PAGE_SIZE) omap_l4_io_readb_fn =qemu_mallocz (sizeof (void *) *L4_PAGES ); omap_l4_io_readh_fn =qemu_mallocz (sizeof (void *) *L4_PAGES );
hw/omap_lcdc.c +1 -1
@@ -450,7 +450,7 @@ struct omap_lcd_panel_s *omap_lcdc_init(target_phys_addr_t base, qemu_irq irq,omap_lcdc_reset (s); iomemtype =cpu_register_io_memory (omap_lcdc_readfn, - omap_lcdc_writefn, s); + omap_lcdc_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x100 , iomemtype); s->state = graphic_console_init(omap_update_display,
hw/omap_mmc.c +1 -1
@@ -587,7 +587,7 @@ struct omap_mmc_s *omap_mmc_init(target_phys_addr_t base,omap_mmc_reset (s); iomemtype =cpu_register_io_memory (omap_mmc_readfn, - omap_mmc_writefn, s); + omap_mmc_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x800 , iomemtype);/* Instantiate the storage */
hw/omap_sdrc.c +1 -1
@@ -158,7 +158,7 @@ struct omap_sdrc_s *omap_sdrc_init(target_phys_addr_t base)omap_sdrc_reset (s); iomemtype =cpu_register_io_memory (omap_sdrc_readfn, - omap_sdrc_writefn, s); + omap_sdrc_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x1000 , iomemtype);return s;
hw/omap_sx1.c +10 -5
@@ -143,12 +143,15 @@ static void sx1_init(ram_addr_t ram_size,qemu_ram_alloc (NULL ,"omap_sx1.flash0-0" , flash_size) | IO_MEM_ROM); - io =cpu_register_io_memory (static_readfn, static_writefn, &cs0val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs0val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS0_BASE + flash_size,OMAP_CS0_SIZE - flash_size, io); - io =cpu_register_io_memory (static_readfn, static_writefn, &cs2val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs2val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS2_BASE ,OMAP_CS2_SIZE , io); - io =cpu_register_io_memory (static_readfn, static_writefn, &cs3val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs3val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS3_BASE ,OMAP_CS3_SIZE , io); fl_idx =0 ;
@@ -175,7 +178,8 @@ static void sx1_init(ram_addr_t ram_size,cpu_register_physical_memory (OMAP_CS1_BASE , flash1_size,qemu_ram_alloc (NULL ,"omap_sx1.flash1-0" , flash1_size) |IO_MEM_ROM ); - io =cpu_register_io_memory (static_readfn, static_writefn, &cs1val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs1val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS1_BASE + flash1_size,OMAP_CS1_SIZE - flash1_size, io);
@@ -189,7 +193,8 @@ static void sx1_init(ram_addr_t ram_size, } fl_idx++; }else { - io =cpu_register_io_memory (static_readfn, static_writefn, &cs1val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs1val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS1_BASE ,OMAP_CS1_SIZE , io); }
hw/omap_uart.c +1 -1
@@ -170,7 +170,7 @@ struct omap_uart_s *omap2_uart_init(struct omap_target_agent_s *ta,struct omap_uart_s *s =omap_uart_init (base, irq, fclk, iclk, txdma, rxdma, label, chr);int iomemtype =cpu_register_io_memory (omap_uart_readfn, - omap_uart_writefn, s); + omap_uart_writefn, s,DEVICE_NATIVE_ENDIAN ); s->ta = ta;
hw/onenand.c +1 -1
@@ -630,7 +630,7 @@ void *onenand_init(uint32_t id, int regshift, qemu_irq irq) s->blockwp =qemu_malloc (s->blocks); s->density_mask = (id & (1 <<11 )) ? (1 << (6 + ((id >>12 ) &7 ))) :0 ; s->iomemtype =cpu_register_io_memory (onenand_readfn, - onenand_writefn, s); + onenand_writefn, s,DEVICE_NATIVE_ENDIAN );if (!dinfo) s->image =memset (qemu_malloc (size + (size >>5 )),0xff , size + (size >>5 ));
hw/openpic.c +6 -4
@@ -1035,7 +1035,8 @@ static void openpic_map(PCIDevice *pci_dev, int region_num,cpu_register_physical_memory (addr,0x40000 , opp->mem_index);#if 0 // Don't implement ISU for now opp_io_memory =cpu_register_io_memory (openpic_src_read, - openpic_src_write); + openpic_src_write, NULL +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (isu_base,0x20 * (EXT_IRQ +2 ), opp_io_memory);#endif
@@ -1202,8 +1203,8 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, }else { opp =qemu_mallocz (sizeof (openpic_t)); } - opp->mem_index =cpu_register_io_memory (openpic_read, - openpic_write, opp); + opp->mem_index =cpu_register_io_memory (openpic_read, openpic_write, opp, +DEVICE_NATIVE_ENDIAN );// isu_base &= 0xFFFC0000; opp->nb_cpus = nb_cpus;
@@ -1671,7 +1672,8 @@ qemu_irq *mpic_init (target_phys_addr_t base, int nb_cpus,for (i =0 ; i <sizeof (list)/sizeof (list[0 ]); i++) {int mem_index; - mem_index =cpu_register_io_memory (list[i].read, list[i].write, mpp); + mem_index =cpu_register_io_memory (list[i].read, list[i].write, mpp, +DEVICE_NATIVE_ENDIAN );if (mem_index <0 ) { goto free; }
hw/palm.c +8 -4
@@ -216,14 +216,18 @@ static void palmte_init(ram_addr_t ram_size,qemu_ram_alloc (NULL ,"palmte.flash" , flash_size) | IO_MEM_ROM); - io =cpu_register_io_memory (static_readfn, static_writefn, &cs0val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs0val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS0_BASE + flash_size,OMAP_CS0_SIZE - flash_size, io); - io =cpu_register_io_memory (static_readfn, static_writefn, &cs1val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs1val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS1_BASE ,OMAP_CS1_SIZE , io); - io =cpu_register_io_memory (static_readfn, static_writefn, &cs2val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs2val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS2_BASE ,OMAP_CS2_SIZE , io); - io =cpu_register_io_memory (static_readfn, static_writefn, &cs3val); + io =cpu_register_io_memory (static_readfn, static_writefn, &cs3val, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (OMAP_CS3_BASE ,OMAP_CS3_SIZE , io);palmte_microwire_setup (cpu);
hw/parallel.c +2 -1
@@ -577,7 +577,8 @@ ParallelState *parallel_mm_init(target_phys_addr_t base, int it_shift, qemu_irq s->it_shift = it_shift;qemu_register_reset (parallel_reset, s); - io_sw =cpu_register_io_memory (parallel_mm_read_sw, parallel_mm_write_sw, s); + io_sw =cpu_register_io_memory (parallel_mm_read_sw, parallel_mm_write_sw, + s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,8 << it_shift, io_sw);return s; }
hw/pcie_host.c +2 -1
@@ -137,7 +137,8 @@ int pcie_host_init(PCIExpressHost *e) { e->base_addr =PCIE_BASE_ADDR_UNMAPPED ; e->mmio_index = -cpu_register_io_memory (pcie_mmcfg_read, pcie_mmcfg_write, e); +cpu_register_io_memory (pcie_mmcfg_read, pcie_mmcfg_write, e, +DEVICE_NATIVE_ENDIAN );if (e->mmio_index <0 ) {return -1 ; }
hw/pckbd.c +2 -1
@@ -436,7 +436,8 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->mask = mask;vmstate_register (NULL ,0 , &vmstate_kbd, s); - s_io_memory =cpu_register_io_memory (kbd_mm_read, kbd_mm_write, s); + s_io_memory =cpu_register_io_memory (kbd_mm_read, kbd_mm_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base, size, s_io_memory); s->kbd =ps2_kbd_init (kbd_update_kbd_irq, s);
hw/pcnet.c +2 -1
@@ -1996,7 +1996,8 @@ static int pci_pcnet_init(PCIDevice *pci_dev)/* Handler for memory-mapped I/O */ s->mmio_index = -cpu_register_io_memory (pcnet_mmio_read, pcnet_mmio_write, &d->state); +cpu_register_io_memory (pcnet_mmio_read, pcnet_mmio_write, &d->state, +DEVICE_NATIVE_ENDIAN );pci_register_bar (pci_dev,0 ,PCNET_IOPORT_SIZE ,PCI_BASE_ADDRESS_SPACE_IO , pcnet_ioport_map);
hw/pflash_cfi01.c +4 -2
@@ -600,10 +600,12 @@ pflash_t *pflash_cfi01_register(target_phys_addr_t base, ram_addr_t off, pfl->storage =qemu_get_ram_ptr (off);if (be) { pfl->fl_mem =cpu_register_io_memory (pflash_read_ops_be, - pflash_write_ops_be, pfl); + pflash_write_ops_be, pfl, +DEVICE_NATIVE_ENDIAN ); }else { pfl->fl_mem =cpu_register_io_memory (pflash_read_ops_le, - pflash_write_ops_le, pfl); + pflash_write_ops_le, pfl, +DEVICE_NATIVE_ENDIAN ); } pfl->off = off; cpu_register_physical_memory(base, total_len,
hw/pflash_cfi02.c +2 -2
@@ -619,11 +619,11 @@ pflash_t *pflash_cfi02_register(target_phys_addr_t base, ram_addr_t off,if (be) { pfl->fl_mem =cpu_register_io_memory (pflash_read_ops_be, pflash_write_ops_be, - pfl); + pfl,DEVICE_NATIVE_ENDIAN ); }else { pfl->fl_mem =cpu_register_io_memory (pflash_read_ops_le, pflash_write_ops_le, - pfl); + pfl,DEVICE_NATIVE_ENDIAN ); } pfl->off = off; pfl->base = base;
hw/pl011.c +2 -1
@@ -292,7 +292,8 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id)pl011_state *s =FROM_SYSBUS (pl011_state, dev); iomemtype =cpu_register_io_memory (pl011_readfn, - pl011_writefn, s); + pl011_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 ,iomemtype);sysbus_init_irq (dev, &s->irq); s->id = id;
hw/pl022.c +2 -1
@@ -294,7 +294,8 @@ static int pl022_init(SysBusDevice *dev)int iomemtype; iomemtype =cpu_register_io_memory (pl022_readfn, - pl022_writefn, s); + pl022_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);sysbus_init_irq (dev, &s->irq); s->ssi =ssi_create_bus (&dev->qdev,"ssi" );
hw/pl031.c +2 -1
@@ -189,7 +189,8 @@ static int pl031_init(SysBusDevice *dev)pl031_state *s =FROM_SYSBUS (pl031_state, dev);struct tm tm; - iomemtype =cpu_register_io_memory (pl031_readfn, pl031_writefn, s); + iomemtype =cpu_register_io_memory (pl031_readfn, pl031_writefn, s, +DEVICE_NATIVE_ENDIAN );if (iomemtype ==-1 ) {hw_error ("pl031_init: Can't register I/O memory\n" ); }
hw/pl050.c +2 -1
@@ -128,7 +128,8 @@ static int pl050_init(SysBusDevice *dev, int is_mouse)int iomemtype; iomemtype =cpu_register_io_memory (pl050_readfn, - pl050_writefn, s); + pl050_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);sysbus_init_irq (dev, &s->irq); s->is_mouse = is_mouse;
hw/pl061.c +2 -1
@@ -297,7 +297,8 @@ static int pl061_init(SysBusDevice *dev)pl061_state *s =FROM_SYSBUS (pl061_state, dev); iomemtype =cpu_register_io_memory (pl061_readfn, - pl061_writefn, s); + pl061_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);sysbus_init_irq (dev, &s->irq);qdev_init_gpio_in (&dev->qdev, pl061_set_irq,8 );
hw/pl080.c +2 -1
@@ -325,7 +325,8 @@ static int pl08x_init(SysBusDevice *dev, int nchannels)pl080_state *s =FROM_SYSBUS (pl080_state, dev); iomemtype =cpu_register_io_memory (pl080_readfn, - pl080_writefn, s); + pl080_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);sysbus_init_irq (dev, &s->irq); s->nchannels = nchannels;
hw/pl110.c +2 -1
@@ -358,7 +358,8 @@ static int pl110_init(SysBusDevice *dev)int iomemtype; iomemtype =cpu_register_io_memory (pl110_readfn, - pl110_writefn, s); + pl110_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);sysbus_init_irq (dev, &s->irq); s->ds = graphic_console_init(pl110_update_display,
hw/pl181.c +2 -2
@@ -451,8 +451,8 @@ static int pl181_init(SysBusDevice *dev)pl181_state *s =FROM_SYSBUS (pl181_state, dev);BlockDriverState *bd; - iomemtype =cpu_register_io_memory (pl181_readfn, - pl181_writefn, s); + iomemtype =cpu_register_io_memory (pl181_readfn, pl181_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);sysbus_init_irq (dev, &s->irq[0 ]);sysbus_init_irq (dev, &s->irq[1 ]);
hw/pl190.c +2 -1
@@ -233,7 +233,8 @@ static int pl190_init(SysBusDevice *dev)int iomemtype; iomemtype =cpu_register_io_memory (pl190_readfn, - pl190_writefn, s); + pl190_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);qdev_init_gpio_in (&dev->qdev, pl190_set_irq,32 );sysbus_init_irq (dev, &s->irq);
hw/ppc405_boards.c +4 -2
@@ -164,7 +164,8 @@ static void ref405ep_fpga_init (uint32_t base) fpga =qemu_mallocz (sizeof (ref405ep_fpga_t)); fpga_memory =cpu_register_io_memory (ref405ep_fpga_read, - ref405ep_fpga_write, fpga); + ref405ep_fpga_write, fpga, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00000100 , fpga_memory);qemu_register_reset (&ref405ep_fpga_reset, fpga); }
@@ -488,7 +489,8 @@ static void taihu_cpld_init (uint32_t base) cpld =qemu_mallocz (sizeof (taihu_cpld_t)); cpld_memory =cpu_register_io_memory (taihu_cpld_read, - taihu_cpld_write, cpld); + taihu_cpld_write, cpld, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00000100 , cpld_memory);qemu_register_reset (&taihu_cpld_reset, cpld); }
hw/ppc405_uc.c +7 -4
@@ -383,7 +383,8 @@ static void ppc4xx_opba_init(target_phys_addr_t base)#ifdef DEBUG_OPBA printf ("%s: offset " TARGET_FMT_plx"\n" , __func__, base);#endif - io =cpu_register_io_memory (opba_read, opba_write, opba); + io =cpu_register_io_memory (opba_read, opba_write, opba, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x002 , io);qemu_register_reset (ppc4xx_opba_reset, opba); }
@@ -809,7 +810,8 @@ static void ppc405_gpio_init(target_phys_addr_t base)#ifdef DEBUG_GPIO printf ("%s: offset " TARGET_FMT_plx"\n" , __func__, base);#endif - io =cpu_register_io_memory (ppc405_gpio_read, ppc405_gpio_write, gpio); + io =cpu_register_io_memory (ppc405_gpio_read, ppc405_gpio_write, gpio, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x038 , io);qemu_register_reset (&ppc405_gpio_reset, gpio); }
@@ -1218,7 +1220,8 @@ static void ppc405_i2c_init(target_phys_addr_t base, qemu_irq irq)#ifdef DEBUG_I2C printf ("%s: offset " TARGET_FMT_plx"\n" , __func__, base);#endif - io =cpu_register_io_memory (i2c_read, i2c_write, i2c); + io =cpu_register_io_memory (i2c_read, i2c_write, i2c, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x011 , io);qemu_register_reset (ppc4xx_i2c_reset, i2c); }
@@ -1501,7 +1504,7 @@ static void ppc4xx_gpt_init(target_phys_addr_t base, qemu_irq irqs[5])#ifdef DEBUG_GPT printf ("%s: offset " TARGET_FMT_plx"\n" , __func__, base);#endif - io =cpu_register_io_memory (gpt_read, gpt_write, gpt); + io =cpu_register_io_memory (gpt_read, gpt_write, gpt,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x0d4 , io);qemu_register_reset (ppc4xx_gpt_reset, gpt); }
hw/ppc4xx_pci.c +4 -2
@@ -372,7 +372,8 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],/* CFGADDR */ index =cpu_register_io_memory (pci4xx_cfgaddr_read, - pci4xx_cfgaddr_write, controller); + pci4xx_cfgaddr_write, controller, +DEVICE_NATIVE_ENDIAN );if (index <0 ) goto free;cpu_register_physical_memory (config_space +PCIC0_CFGADDR ,4 , index);
@@ -384,7 +385,8 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],cpu_register_physical_memory (config_space +PCIC0_CFGDATA ,4 , index);/* Internal registers */ - index =cpu_register_io_memory (pci_reg_read, pci_reg_write, controller); + index =cpu_register_io_memory (pci_reg_read, pci_reg_write, controller, +DEVICE_NATIVE_ENDIAN );if (index <0 ) goto free;cpu_register_physical_memory (registers,PCI_REG_SIZE , index);
hw/ppc_newworld.c +2 -1
@@ -260,7 +260,8 @@ static void ppc_core99_init (ram_addr_t ram_size,isa_mmio_init (0xf2000000 ,0x00800000 ,1 );/* UniN init */ - unin_memory =cpu_register_io_memory (unin_read, unin_write,NULL ); + unin_memory =cpu_register_io_memory (unin_read, unin_write,NULL , +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0xf8000000 ,0x00001000 , unin_memory); openpic_irqs =qemu_mallocz (smp_cpus *sizeof (qemu_irq *));
hw/ppc_prep.c +5 -3
@@ -690,7 +690,8 @@ static void ppc_prep_init (ram_addr_t ram_size,// pci_bus = i440fx_init(); /* Register 8 MB of ISA IO space (needed for non-contiguous map) */ PPC_io_memory =cpu_register_io_memory (PPC_prep_io_read, - PPC_prep_io_write, sysctrl); + PPC_prep_io_write, sysctrl, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0x80000000 ,0x00800000 , PPC_io_memory);/* init basic PC hardware */
@@ -755,12 +756,13 @@ static void ppc_prep_init (ram_addr_t ram_size,register_ioport_write (0x0800 ,0x52 ,1 , &PREP_io_800_writeb, sysctrl);/* PCI intack location */ PPC_io_memory =cpu_register_io_memory (PPC_intack_read, - PPC_intack_write,NULL ); + PPC_intack_write,NULL , +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0xBFFFFFF0 ,0x4 , PPC_io_memory);/* PowerPC control and status register group */ #if 0 PPC_io_memory =cpu_register_io_memory (PPC_XCSR_read, PPC_XCSR_write, -NULL ); +NULL ,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0xFEFF0000 ,0x1000 , PPC_io_memory);#endif
hw/ppce500_pci.c +2 -1
@@ -304,7 +304,8 @@ PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t registers)cpu_register_physical_memory (registers +PCIE500_CFGDATA ,4 , index); index =cpu_register_io_memory (e500_pci_reg_read, - e500_pci_reg_write, controller); + e500_pci_reg_write, controller, +DEVICE_NATIVE_ENDIAN );if (index <0 ) goto free; cpu_register_physical_memory(registers + PCIE500_REG_BASE,
hw/prep_pci.c +2 -1
@@ -125,7 +125,8 @@ PCIBus *pci_prep_init(qemu_irq *pic)pci_host_data_register_ioport (0xcfc , s); PPC_io_memory =cpu_register_io_memory (PPC_PCIIO_read, - PPC_PCIIO_write, s); + PPC_PCIIO_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0x80800000 ,0x00400000 , PPC_io_memory);/* PCI host bridge */
hw/pxa2xx.c +13 -12
@@ -859,7 +859,8 @@ static int pxa2xx_ssp_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); iomemtype =cpu_register_io_memory (pxa2xx_ssp_readfn, - pxa2xx_ssp_writefn, s); + pxa2xx_ssp_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);register_savevm (&dev->qdev,"pxa2xx_ssp" ,-1 ,0 , pxa2xx_ssp_save, pxa2xx_ssp_load, s);
@@ -1512,7 +1513,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base, s->offset = base - (base & (~region_size) &TARGET_PAGE_MASK ); iomemtype =cpu_register_io_memory (pxa2xx_i2c_readfn, - pxa2xx_i2c_writefn, s); + pxa2xx_i2c_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base & ~region_size, region_size +1 , iomemtype);
@@ -1749,7 +1750,7 @@ static PXA2xxI2SState *pxa2xx_i2s_init(target_phys_addr_t base,pxa2xx_i2s_reset (s); iomemtype =cpu_register_io_memory (pxa2xx_i2s_readfn, - pxa2xx_i2s_writefn, s); + pxa2xx_i2s_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x100000 , iomemtype); register_savevm(NULL, "pxa2xx_i2s", base, 0,
@@ -2009,7 +2010,7 @@ static PXA2xxFIrState *pxa2xx_fir_init(target_phys_addr_t base,pxa2xx_fir_reset (s); iomemtype =cpu_register_io_memory (pxa2xx_fir_readfn, - pxa2xx_fir_writefn, s); + pxa2xx_fir_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x1000 , iomemtype);if (chr)
@@ -2102,7 +2103,7 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) s->cm_regs[CCCR >>2 ] =0x02000210 ;/* 416.0 MHz */ s->clkcfg =0x00000009 ;/* Turbo mode active */ iomemtype =cpu_register_io_memory (pxa2xx_cm_readfn, - pxa2xx_cm_writefn, s); + pxa2xx_cm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->cm_base,0x1000 , iomemtype);register_savevm (NULL ,"pxa2xx_cm" ,0 ,0 , pxa2xx_cm_save, pxa2xx_cm_load, s);
@@ -2113,13 +2114,13 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) s->mm_regs[MDREFR >>2 ] =0x03ca4000 ; s->mm_regs[MECR >>2 ] =0x00000001 ;/* Two PC Card sockets */ iomemtype =cpu_register_io_memory (pxa2xx_mm_readfn, - pxa2xx_mm_writefn, s); + pxa2xx_mm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->mm_base,0x1000 , iomemtype);register_savevm (NULL ,"pxa2xx_mm" ,0 ,0 , pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base =0x40f00000 ; iomemtype =cpu_register_io_memory (pxa2xx_pm_readfn, - pxa2xx_pm_writefn, s); + pxa2xx_pm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->pm_base,0x100 , iomemtype);register_savevm (NULL ,"pxa2xx_pm" ,0 ,0 , pxa2xx_pm_save, pxa2xx_pm_load, s);
@@ -2142,7 +2143,7 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) s->rtc_base =0x40900000 ; iomemtype =cpu_register_io_memory (pxa2xx_rtc_readfn, - pxa2xx_rtc_writefn, s); + pxa2xx_rtc_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->rtc_base,0x1000 , iomemtype);pxa2xx_rtc_init (s); register_savevm(NULL, "pxa2xx_rtc", 0, 0, pxa2xx_rtc_save,
@@ -2225,7 +2226,7 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) s->cm_regs[CCCR >>2 ] =0x02000210 ;/* 416.0 MHz */ s->clkcfg =0x00000009 ;/* Turbo mode active */ iomemtype =cpu_register_io_memory (pxa2xx_cm_readfn, - pxa2xx_cm_writefn, s); + pxa2xx_cm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->cm_base,0x1000 , iomemtype);register_savevm (NULL ,"pxa2xx_cm" ,0 ,0 , pxa2xx_cm_save, pxa2xx_cm_load, s);
@@ -2236,13 +2237,13 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) s->mm_regs[MDREFR >>2 ] =0x03ca4000 ; s->mm_regs[MECR >>2 ] =0x00000001 ;/* Two PC Card sockets */ iomemtype =cpu_register_io_memory (pxa2xx_mm_readfn, - pxa2xx_mm_writefn, s); + pxa2xx_mm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->mm_base,0x1000 , iomemtype);register_savevm (NULL ,"pxa2xx_mm" ,0 ,0 , pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base =0x40f00000 ; iomemtype =cpu_register_io_memory (pxa2xx_pm_readfn, - pxa2xx_pm_writefn, s); + pxa2xx_pm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->pm_base,0x100 , iomemtype);register_savevm (NULL ,"pxa2xx_pm" ,0 ,0 , pxa2xx_pm_save, pxa2xx_pm_load, s);
@@ -2265,7 +2266,7 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) s->rtc_base =0x40900000 ; iomemtype =cpu_register_io_memory (pxa2xx_rtc_readfn, - pxa2xx_rtc_writefn, s); + pxa2xx_rtc_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->rtc_base,0x1000 , iomemtype);pxa2xx_rtc_init (s); register_savevm(NULL, "pxa2xx_rtc", 0, 0, pxa2xx_rtc_save,
hw/pxa2xx_dma.c +1 -1
@@ -504,7 +504,7 @@ static PXA2xxDMAState *pxa2xx_dma_init(target_phys_addr_t base,memset (s->req,0 ,sizeof (uint8_t ) *PXA2XX_DMA_NUM_REQUESTS ); iomemtype =cpu_register_io_memory (pxa2xx_dma_readfn, - pxa2xx_dma_writefn, s); + pxa2xx_dma_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00010000 , iomemtype);register_savevm (NULL ,"pxa2xx_dma" ,0 ,0 , pxa2xx_dma_save, pxa2xx_dma_load, s);
hw/pxa2xx_gpio.c +1 -1
@@ -309,7 +309,7 @@ PXA2xxGPIOInfo *pxa2xx_gpio_init(target_phys_addr_t base, s->in =qemu_allocate_irqs (pxa2xx_gpio_set, s, lines); iomemtype =cpu_register_io_memory (pxa2xx_gpio_readfn, - pxa2xx_gpio_writefn, s); + pxa2xx_gpio_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00001000 , iomemtype); register_savevm(NULL, "pxa2xx_gpio", 0, 0,
hw/pxa2xx_keypad.c +1 -1
@@ -314,7 +314,7 @@ PXA2xxKeyPadState *pxa27x_keypad_init(target_phys_addr_t base, s->irq = irq; iomemtype =cpu_register_io_memory (pxa2xx_keypad_readfn, - pxa2xx_keypad_writefn, s); + pxa2xx_keypad_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00100000 , iomemtype); register_savevm(NULL, "pxa2xx_keypad", 0, 0,
hw/pxa2xx_lcd.c +1 -1
@@ -929,7 +929,7 @@ PXA2xxLCDState *pxa2xx_lcdc_init(target_phys_addr_t base, qemu_irq irq)pxa2xx_lcdc_orientation (s, graphic_rotate); iomemtype =cpu_register_io_memory (pxa2xx_lcdc_readfn, - pxa2xx_lcdc_writefn, s); + pxa2xx_lcdc_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00100000 , iomemtype); s->ds = graphic_console_init(pxa2xx_update_display,
hw/pxa2xx_mmci.c +1 -1
@@ -528,7 +528,7 @@ PXA2xxMMCIState *pxa2xx_mmci_init(target_phys_addr_t base, s->dma = dma; iomemtype =cpu_register_io_memory (pxa2xx_mmci_readfn, - pxa2xx_mmci_writefn, s); + pxa2xx_mmci_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00100000 , iomemtype);/* Instantiate the actual storage */
hw/pxa2xx_pcmcia.c +3 -3
@@ -140,19 +140,19 @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(target_phys_addr_t base)/* Socket I/O Memory Space */ iomemtype =cpu_register_io_memory (pxa2xx_pcmcia_io_readfn, - pxa2xx_pcmcia_io_writefn, s); + pxa2xx_pcmcia_io_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base |0x00000000 ,0x04000000 , iomemtype);/* Then next 64 MB is reserved */ /* Socket Attribute Memory Space */ iomemtype =cpu_register_io_memory (pxa2xx_pcmcia_attr_readfn, - pxa2xx_pcmcia_attr_writefn, s); + pxa2xx_pcmcia_attr_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base |0x08000000 ,0x04000000 , iomemtype);/* Socket Common Memory Space */ iomemtype =cpu_register_io_memory (pxa2xx_pcmcia_common_readfn, - pxa2xx_pcmcia_common_writefn, s); + pxa2xx_pcmcia_common_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base |0x0c000000 ,0x04000000 , iomemtype);if (base ==0x30000000 )
hw/pxa2xx_pic.c +1 -1
@@ -300,7 +300,7 @@ qemu_irq *pxa2xx_pic_init(target_phys_addr_t base, CPUState *env)/* Enable IC memory-mapped registers access. */ iomemtype =cpu_register_io_memory (pxa2xx_pic_readfn, - pxa2xx_pic_writefn, s); + pxa2xx_pic_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00100000 , iomemtype);/* Enable IC coprocessor access. */
hw/pxa2xx_timer.c +1 -1
@@ -452,7 +452,7 @@ static pxa2xx_timer_info *pxa2xx_timer_init(target_phys_addr_t base, } iomemtype =cpu_register_io_memory (pxa2xx_timer_readfn, - pxa2xx_timer_writefn, s); + pxa2xx_timer_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00001000 , iomemtype); register_savevm(NULL, "pxa2xx_timer", 0, 0,
hw/r2d.c +2 -1
@@ -189,7 +189,8 @@ static qemu_irq *r2d_fpga_init(target_phys_addr_t base, qemu_irq irl) s->irl = irl; iomemtype =cpu_register_io_memory (r2d_fpga_readfn, - r2d_fpga_writefn, s); + r2d_fpga_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x40 , iomemtype);return qemu_allocate_irqs (r2d_fpga_irq_set, s,NR_IRQS ); }
hw/rc4030.c +4 -2
@@ -819,9 +819,11 @@ void *rc4030_init(qemu_irq timer, qemu_irq jazz_bus,register_savevm (NULL ,"rc4030" ,0 ,2 , rc4030_save, rc4030_load, s);rc4030_reset (s); - s_chipset =cpu_register_io_memory (rc4030_read, rc4030_write, s); + s_chipset =cpu_register_io_memory (rc4030_read, rc4030_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0x80000000 ,0x300 , s_chipset); - s_jazzio =cpu_register_io_memory (jazzio_read, jazzio_write, s); + s_jazzio =cpu_register_io_memory (jazzio_read, jazzio_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0xf0000000 ,0x00001000 , s_jazzio);return s;
hw/realview.c +2 -1
@@ -81,7 +81,8 @@ static int realview_i2c_init(SysBusDevice *dev) bus =i2c_init_bus (&dev->qdev,"i2c" ); s->bitbang =bitbang_i2c_init (bus); iomemtype =cpu_register_io_memory (realview_i2c_readfn, - realview_i2c_writefn, s); + realview_i2c_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);return 0 ; }
hw/realview_gic.c +2 -1
@@ -64,7 +64,8 @@ static int realview_gic_init(SysBusDevice *dev)gic_init (&s->gic); s->iomemtype =cpu_register_io_memory (realview_gic_cpu_readfn, - realview_gic_cpu_writefn, s); + realview_gic_cpu_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio_cb (dev,0x2000 , realview_gic_map);return 0 ; }
hw/rtl8139.c +2 -1
@@ -3366,7 +3366,8 @@ static int pci_rtl8139_init(PCIDevice *dev)/* I/O handler for memory-mapped I/O */ s->rtl8139_mmio_io_addr = -cpu_register_io_memory (rtl8139_mmio_read, rtl8139_mmio_write, s); +cpu_register_io_memory (rtl8139_mmio_read, rtl8139_mmio_write, s, +DEVICE_NATIVE_ENDIAN );pci_register_bar (&s->dev,0 ,0x100 ,PCI_BASE_ADDRESS_SPACE_IO , rtl8139_ioport_map);
hw/sbi.c +2 -1
@@ -125,7 +125,8 @@ static int sbi_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->cpu_irqs[i]); } - sbi_io_memory =cpu_register_io_memory (sbi_mem_read, sbi_mem_write, s); + sbi_io_memory =cpu_register_io_memory (sbi_mem_read, sbi_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,SBI_SIZE , sbi_io_memory);return 0 ;
hw/serial.c +4 -2
@@ -955,10 +955,12 @@ SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,if (ioregister) {if (be) { s_io_memory =cpu_register_io_memory (serial_mm_read_be, - serial_mm_write_be, s); + serial_mm_write_be, s, +DEVICE_NATIVE_ENDIAN ); }else { s_io_memory =cpu_register_io_memory (serial_mm_read_le, - serial_mm_write_le, s); + serial_mm_write_le, s, +DEVICE_NATIVE_ENDIAN ); }cpu_register_physical_memory (base,8 << it_shift, s_io_memory); }
hw/sh7750.c +4 -2
@@ -713,7 +713,8 @@ SH7750State *sh7750_init(CPUSH4State * cpu) s->cpu = cpu; s->periph_freq =60000000 ;/* 60MHz */ sh7750_io_memory =cpu_register_io_memory (sh7750_mem_read, - sh7750_mem_write, s); + sh7750_mem_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory_offset (0x1f000000 ,0x1000 , sh7750_io_memory,0x1f000000 ); cpu_register_physical_memory_offset(0xff000000, 0x1000,
@@ -728,7 +729,8 @@ SH7750State *sh7750_init(CPUSH4State * cpu) sh7750_io_memory, 0x1fc00000); sh7750_mm_cache_and_tlb =cpu_register_io_memory (sh7750_mmct_read, - sh7750_mmct_write, s); + sh7750_mmct_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0xf0000000 ,0x08000000 , sh7750_mm_cache_and_tlb);
hw/sh_intc.c +2 -1
@@ -442,7 +442,8 @@ int sh_intc_init(struct intc_desc *desc, desc->irqs =qemu_allocate_irqs (sh_intc_set_irq, desc, nr_sources); desc->iomemtype =cpu_register_io_memory (sh_intc_readfn, - sh_intc_writefn, desc); + sh_intc_writefn, desc, +DEVICE_NATIVE_ENDIAN );if (desc->mask_regs) {for (i =0 ; i < desc->nr_mask_regs; i++) {struct intc_mask_reg *mr = desc->mask_regs + i;
hw/sh_pci.c +2 -1
@@ -103,7 +103,8 @@ PCIBus *sh_pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, p->dev =pci_register_device (p->bus,"SH PCIC" ,sizeof (PCIDevice),-1 ,NULL ,NULL ); - reg =cpu_register_io_memory (sh_pci_reg.r, sh_pci_reg.w, p); + reg =cpu_register_io_memory (sh_pci_reg.r, sh_pci_reg.w, p, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (0x1e200000 ,0x224 , reg);cpu_register_physical_memory (0xfe200000 ,0x224 , reg);
hw/sh_serial.c +2 -1
@@ -395,7 +395,8 @@ void sh_serial_init (target_phys_addr_t base, int feat,sh_serial_clear_fifo (s); s_io_memory =cpu_register_io_memory (sh_serial_readfn, - sh_serial_writefn, s); + sh_serial_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (P4ADDR (base),0x28 , s_io_memory);cpu_register_physical_memory (A7ADDR (base),0x28 , s_io_memory);
hw/sh_timer.c +2 -1
@@ -319,7 +319,8 @@ void tmu012_init(target_phys_addr_t base, int feat, uint32_t freq, s->timer[2 ] =sh_timer_init (freq, timer_feat |TIMER_FEAT_CAPT , ch2_irq0);/* ch2_irq1 not supported */ iomemtype =cpu_register_io_memory (tmu012_readfn, - tmu012_writefn, s); + tmu012_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (P4ADDR (base),0x00001000 , iomemtype);cpu_register_physical_memory (A7ADDR (base),0x00001000 , iomemtype);/* ??? Save/restore. */
hw/slavio_intctl.c +2 -1
@@ -422,7 +422,8 @@ static int slavio_intctl_init1(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, slavio_set_irq_all,32 +MAX_CPUS ); io_memory =cpu_register_io_memory (slavio_intctlm_mem_read, - slavio_intctlm_mem_write, s); + slavio_intctlm_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,INTCTLM_SIZE , io_memory);for (i =0 ; i <MAX_CPUS ; i++) {
hw/slavio_misc.c +16 -8
@@ -412,7 +412,8 @@ static int apc_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->cpu_halt);/* Power management (APC) XXX: not a Slavio device */ - io =cpu_register_io_memory (apc_mem_read, apc_mem_write, s); + io =cpu_register_io_memory (apc_mem_read, apc_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MISC_SIZE , io);return 0 ; }
@@ -428,39 +429,46 @@ static int slavio_misc_init1(SysBusDevice *dev)/* 8 bit registers */ /* Slavio control */ io =cpu_register_io_memory (slavio_cfg_mem_read, - slavio_cfg_mem_write, s); + slavio_cfg_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MISC_SIZE , io);/* Diagnostics */ io =cpu_register_io_memory (slavio_diag_mem_read, - slavio_diag_mem_write, s); + slavio_diag_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MISC_SIZE , io);/* Modem control */ io =cpu_register_io_memory (slavio_mdm_mem_read, - slavio_mdm_mem_write, s); + slavio_mdm_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MISC_SIZE , io);/* 16 bit registers */ /* ss600mp diag LEDs */ io =cpu_register_io_memory (slavio_led_mem_read, - slavio_led_mem_write, s); + slavio_led_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MISC_SIZE , io);/* 32 bit registers */ /* System control */ io =cpu_register_io_memory (slavio_sysctrl_mem_read, - slavio_sysctrl_mem_write, s); + slavio_sysctrl_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,SYSCTRL_SIZE , io);/* AUX 1 (Misc System Functions) */ io =cpu_register_io_memory (slavio_aux1_mem_read, - slavio_aux1_mem_write, s); + slavio_aux1_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MISC_SIZE , io);/* AUX 2 (Software Powerdown Control) */ io =cpu_register_io_memory (slavio_aux2_mem_read, - slavio_aux2_mem_write, s); + slavio_aux2_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,MISC_SIZE , io);qdev_init_gpio_in (&dev->qdev, slavio_set_power_fail,1 );
hw/slavio_timer.c +2 -1
@@ -390,7 +390,8 @@ static int slavio_timer_init1(SysBusDevice *dev)ptimer_set_period (s->cputimer[i].timer,TIMER_PERIOD ); io =cpu_register_io_memory (slavio_timer_mem_read, - slavio_timer_mem_write, tc); + slavio_timer_mem_write, tc, +DEVICE_NATIVE_ENDIAN );if (i ==0 ) {sysbus_init_mmio (dev,SYS_TIMER_SIZE , io); }else {
hw/sm501.c +6 -3
@@ -1379,15 +1379,18 @@ void sm501_init(uint32_t base, uint32_t local_mem_bytes, qemu_irq irq,/* map mmio */ sm501_system_config_index =cpu_register_io_memory (sm501_system_config_readfn, - sm501_system_config_writefn, s); + sm501_system_config_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base +MMIO_BASE_OFFSET ,0x6c , sm501_system_config_index); sm501_disp_ctrl_index =cpu_register_io_memory (sm501_disp_ctrl_readfn, - sm501_disp_ctrl_writefn, s); + sm501_disp_ctrl_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base +MMIO_BASE_OFFSET +SM501_DC ,0x1000 , sm501_disp_ctrl_index); sm501_2d_engine_index =cpu_register_io_memory (sm501_2d_engine_readfn, - sm501_2d_engine_writefn, s); + sm501_2d_engine_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base +MMIO_BASE_OFFSET +SM501_2D_ENGINE ,0x54 , sm501_2d_engine_index);
hw/smc91c111.c +2 -1
@@ -719,7 +719,8 @@ static int smc91c111_init1(SysBusDevice *dev)smc91c111_state *s =FROM_SYSBUS (smc91c111_state, dev); s->mmio_index =cpu_register_io_memory (smc91c111_readfn, - smc91c111_writefn, s); + smc91c111_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,16 , s->mmio_index);sysbus_init_irq (dev, &s->irq);qemu_macaddr_default_if_unset (&s->conf.macaddr);
hw/sparc32_dma.c +2 -1
@@ -257,7 +257,8 @@ static int sparc32_dma_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); - dma_io_memory =cpu_register_io_memory (dma_mem_read, dma_mem_write, s); + dma_io_memory =cpu_register_io_memory (dma_mem_read, dma_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,DMA_SIZE , dma_io_memory);qdev_init_gpio_in (&dev->qdev, dma_set_irq,1 );
hw/spitz.c +1 -1
@@ -176,7 +176,7 @@ static void sl_flash_register(PXA2xxState *cpu, int size) s->nand =nand_init (NAND_MFR_SAMSUNG ,0xf1 ); iomemtype =cpu_register_io_memory (sl_readfn, - sl_writefn, s); + sl_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (FLASH_BASE ,0x40 , iomemtype);register_savevm (NULL ,"sl_flash" ,0 ,0 , sl_save, sl_load, s);
hw/stellaris.c +8 -4
@@ -348,7 +348,8 @@ static int stellaris_gptm_init(SysBusDevice *dev)qdev_init_gpio_out (&dev->qdev, &s->trigger,1 ); iomemtype =cpu_register_io_memory (gptm_readfn, - gptm_writefn, s); + gptm_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype); s->opaque[0 ] = s->opaque[1 ] = s;
@@ -671,7 +672,8 @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq, s->user1 = macaddr[3 ] | (macaddr[4 ] <<8 ) | (macaddr[5 ] <<16 ); iomemtype =cpu_register_io_memory (ssys_readfn, - ssys_writefn, s); + ssys_writefn, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x00001000 , iomemtype);ssys_reset (s);register_savevm (NULL ,"stellaris_sys" ,-1 ,1 , ssys_save, ssys_load, s);
@@ -884,7 +886,8 @@ static int stellaris_i2c_init(SysBusDevice * dev) s->bus = bus; iomemtype =cpu_register_io_memory (stellaris_i2c_readfn, - stellaris_i2c_writefn, s); + stellaris_i2c_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);/* ??? For now we only implement the master interface. */ stellaris_i2c_reset (s);
@@ -1193,7 +1196,8 @@ static int stellaris_adc_init(SysBusDevice *dev) } iomemtype =cpu_register_io_memory (stellaris_adc_readfn, - stellaris_adc_writefn, s); + stellaris_adc_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);stellaris_adc_reset (s);qdev_init_gpio_in (&dev->qdev, stellaris_adc_trigger,1 );
hw/stellaris_enet.c +2 -1
@@ -409,7 +409,8 @@ static int stellaris_enet_init(SysBusDevice *dev)stellaris_enet_state *s =FROM_SYSBUS (stellaris_enet_state, dev); s->mmio_index =cpu_register_io_memory (stellaris_enet_readfn, - stellaris_enet_writefn, s); + stellaris_enet_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , s->mmio_index);sysbus_init_irq (dev, &s->irq);qemu_macaddr_default_if_unset (&s->conf.macaddr);
hw/sun4c_intctl.c +2 -1
@@ -196,7 +196,8 @@ static int sun4c_intctl_init1(SysBusDevice *dev)unsigned int i; io_memory =cpu_register_io_memory (sun4c_intctl_mem_read, - sun4c_intctl_mem_write, s); + sun4c_intctl_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,INTCTL_SIZE , io_memory);qdev_init_gpio_in (&dev->qdev, sun4c_set_irq,8 );
hw/sun4m_iommu.c +2 -1
@@ -351,7 +351,8 @@ static int iommu_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); - io =cpu_register_io_memory (iommu_mem_read, iommu_mem_write, s); + io =cpu_register_io_memory (iommu_mem_read, iommu_mem_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,IOMMU_NREGS *sizeof (uint32_t ), io);return 0 ;
hw/syborg_fb.c +2 -1
@@ -510,7 +510,8 @@ static int syborg_fb_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); iomemtype =cpu_register_io_memory (syborg_fb_readfn, - syborg_fb_writefn, s); + syborg_fb_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype); s->ds = graphic_console_init(syborg_fb_update_display,
hw/syborg_interrupt.c +2 -1
@@ -210,7 +210,8 @@ static int syborg_int_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->parent_irq);qdev_init_gpio_in (&dev->qdev, syborg_int_set_irq, s->num_irqs); iomemtype =cpu_register_io_memory (syborg_int_readfn, - syborg_int_writefn, s); + syborg_int_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype); s->flags =qemu_mallocz (s->num_irqs *sizeof (syborg_int_flags));
hw/syborg_keyboard.c +2 -1
@@ -210,7 +210,8 @@ static int syborg_keyboard_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); iomemtype =cpu_register_io_memory (syborg_keyboard_readfn, - syborg_keyboard_writefn, s); + syborg_keyboard_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);if (s->fifo_size <=0 ) {fprintf (stderr,"syborg_keyboard: fifo too small\n" );
hw/syborg_pointer.c +2 -1
@@ -206,7 +206,8 @@ static int syborg_pointer_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); iomemtype =cpu_register_io_memory (syborg_pointer_readfn, - syborg_pointer_writefn, s); + syborg_pointer_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);if (s->fifo_size <=0 ) {
hw/syborg_rtc.c +2 -1
@@ -130,7 +130,8 @@ static int syborg_rtc_init(SysBusDevice *dev)int iomemtype; iomemtype =cpu_register_io_memory (syborg_rtc_readfn, - syborg_rtc_writefn, s); + syborg_rtc_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);qemu_get_timedate (&tm,0 );
hw/syborg_serial.c +2 -1
@@ -322,7 +322,8 @@ static int syborg_serial_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); iomemtype =cpu_register_io_memory (syborg_serial_readfn, - syborg_serial_writefn, s); + syborg_serial_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype); s->chr =qdev_init_chardev (&dev->qdev);if (s->chr) {
hw/syborg_timer.c +2 -1
@@ -215,7 +215,8 @@ static int syborg_timer_init(SysBusDevice *dev) }sysbus_init_irq (dev, &s->irq); iomemtype =cpu_register_io_memory (syborg_timer_readfn, - syborg_timer_writefn, s); + syborg_timer_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype); bh =qemu_bh_new (syborg_timer_tick, s);
hw/syborg_virtio.c +2 -1
@@ -265,7 +265,8 @@ static int syborg_virtio_init(SyborgVirtIOProxy *proxy, VirtIODevice *vdev) proxy->vdev->nvectors =0 ;sysbus_init_irq (&proxy->busdev, &proxy->irq); iomemtype =cpu_register_io_memory (syborg_virtio_readfn, - syborg_virtio_writefn, proxy); + syborg_virtio_writefn, proxy, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (&proxy->busdev,0x1000 , iomemtype); proxy->id = ((uint32_t )0x1af4 <<16 ) | vdev->device_id;
hw/tc6393xb.c +1 -1
@@ -590,7 +590,7 @@ TC6393xbState *tc6393xb_init(uint32_t base, qemu_irq irq) s->flash =nand_init (NAND_MFR_TOSHIBA ,0x76 ); iomemtype =cpu_register_io_memory (tc6393xb_readfn, - tc6393xb_writefn, s); + tc6393xb_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (base,0x10000 , iomemtype); s->vram_addr =qemu_ram_alloc (NULL ,"tc6393xb.vram" ,0x100000 );
hw/tcx.c +3 -2
@@ -522,12 +522,13 @@ static int tcx_init1(SysBusDevice *dev) vram_base += size;/* DAC */ - io_memory =cpu_register_io_memory (tcx_dac_read, tcx_dac_write, s); + io_memory =cpu_register_io_memory (tcx_dac_read, tcx_dac_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,TCX_DAC_NREGS , io_memory);/* TEC (dummy) */ dummy_memory =cpu_register_io_memory (tcx_dummy_read, tcx_dummy_write, - s); + s,DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,TCX_TEC_NREGS , dummy_memory);/* THC: NetBSD writes here even with 8-bit display: dummy */ sysbus_init_mmio (dev,TCX_THC_NREGS_24 , dummy_memory);
hw/tusb6010.c +1 -1
@@ -740,7 +740,7 @@ TUSBState *tusb6010_init(qemu_irq intr) s->intr =0x00000000 ; s->otg_timer_val =0 ; s->iomemtype[1 ] =cpu_register_io_memory (tusb_async_readfn, - tusb_async_writefn, s); + tusb_async_writefn, s,DEVICE_NATIVE_ENDIAN ); s->irq = intr; s->otg_timer =qemu_new_timer (vm_clock, tusb_otg_tick, s); s->pwr_timer =qemu_new_timer (vm_clock, tusb_power_tick, s);
hw/usb-ohci.c +2 -1
@@ -1697,7 +1697,8 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, usb_frame_time, usb_bit_time); } - ohci->mem =cpu_register_io_memory (ohci_readfn, ohci_writefn, ohci); + ohci->mem =cpu_register_io_memory (ohci_readfn, ohci_writefn, ohci, +DEVICE_NATIVE_ENDIAN ); ohci->localmem_base = localmem_base; ohci->name = dev->info->name;
hw/versatile_pci.c +2 -1
@@ -132,7 +132,8 @@ static int pci_vpb_init(SysBusDevice *dev)/* ??? Register memory space. */ s->mem_config =cpu_register_io_memory (pci_vpb_config_read, - pci_vpb_config_write, bus); + pci_vpb_config_write, bus, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio_cb (dev,0x04000000 , pci_vpb_map);pci_create_simple (bus,-1 ,"versatile_pci_host" );
hw/versatilepb.c +2 -1
@@ -143,7 +143,8 @@ static int vpb_sic_init(SysBusDevice *dev) } s->irq =31 ; iomemtype =cpu_register_io_memory (vpb_sic_readfn, - vpb_sic_writefn, s); + vpb_sic_writefn, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype);/* ??? Save/restore. */ return 0 ;
hw/vga-isa-mm.c +4 -2
@@ -97,8 +97,10 @@ static void vga_mm_init(ISAVGAMMState *s, target_phys_addr_t vram_base,int s_ioport_ctrl, vga_io_memory; s->it_shift = it_shift; - s_ioport_ctrl =cpu_register_io_memory (vga_mm_read_ctrl, vga_mm_write_ctrl, s); - vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); + s_ioport_ctrl =cpu_register_io_memory (vga_mm_read_ctrl, vga_mm_write_ctrl, s, +DEVICE_NATIVE_ENDIAN ); + vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s, +DEVICE_NATIVE_ENDIAN );vmstate_register (NULL ,0 , &vmstate_vga_common, s);
hw/vga.c +2 -1
@@ -2320,7 +2320,8 @@ void vga_init(VGACommonState *s)#endif #endif /* CONFIG_BOCHS_VBE */ - vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); + vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (isa_mem_base +0x000a0000 ,0x20000 , vga_io_memory);qemu_register_coalesced_mmio (isa_mem_base +0x000a0000 ,0x20000 );
hw/vmware_vga.c +1 -1
@@ -1250,7 +1250,7 @@ static void pci_vmsvga_map_mem(PCIDevice *pci_dev, int region_num, s->vram_base = addr;#ifdef DIRECT_VRAM iomemtype =cpu_register_io_memory (vmsvga_vram_read, - vmsvga_vram_write, s); + vmsvga_vram_write, s,DEVICE_NATIVE_ENDIAN );#else iomemtype = s->vga.vram_offset |IO_MEM_RAM ;#endif
hw/wdt_i6300esb.c +2 -1
@@ -361,7 +361,8 @@ static void i6300esb_map(PCIDevice *dev, int region_num,i6300esb_debug ("addr = %" FMT_PCIBUS ", size = %" FMT_PCIBUS ", type = %d\n" , addr, size, type); - io_mem =cpu_register_io_memory (mem_read, mem_write, d); + io_mem =cpu_register_io_memory (mem_read, mem_write, d, +DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (addr,0x10 , io_mem);/* qemu_register_coalesced_mmio (addr, 0x10); ? */ }
hw/xilinx_ethlite.c +1 -1
@@ -224,7 +224,7 @@ static int xilinx_ethlite_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); s->rxbuf =0 ; - regs =cpu_register_io_memory (eth_read, eth_write, s); + regs =cpu_register_io_memory (eth_read, eth_write, s,DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,R_MAX *4 , regs);qemu_macaddr_default_if_unset (&s->conf.macaddr);
hw/xilinx_intc.c +1 -1
@@ -153,7 +153,7 @@ static int xilinx_intc_init(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, irq_handler,32 );sysbus_init_irq (dev, &p->parent_irq); - pic_regs =cpu_register_io_memory (pic_read, pic_write, p); + pic_regs =cpu_register_io_memory (pic_read, pic_write, p,DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,R_MAX *4 , pic_regs);return 0 ; }
hw/xilinx_timer.c +2 -1
@@ -210,7 +210,8 @@ static int xilinx_timer_init(SysBusDevice *dev)ptimer_set_freq (xt->ptimer, t->freq_hz); } - timer_regs =cpu_register_io_memory (timer_read, timer_write, t); + timer_regs =cpu_register_io_memory (timer_read, timer_write, t, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,R_MAX *4 * t->nr_timers, timer_regs);return 0 ; }
hw/xilinx_uartlite.c +2 -1
@@ -201,7 +201,8 @@ static int xilinx_uartlite_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq);uart_update_status (s); - uart_regs =cpu_register_io_memory (uart_read, uart_write, s); + uart_regs =cpu_register_io_memory (uart_read, uart_write, s, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,R_MAX *4 , uart_regs); s->chr =qdev_init_chardev (&dev->qdev);
hw/zaurus.c +1 -1
@@ -228,7 +228,7 @@ ScoopInfo *scoop_init(PXA2xxState *cpu, s->status =0x02 ; s->in =qemu_allocate_irqs (scoop_gpio_set, s,16 ); iomemtype =cpu_register_io_memory (scoop_readfn, - scoop_writefn, s); + scoop_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (target_base,0x1000 , iomemtype);register_savevm (NULL ,"scoop" , instance,1 , scoop_save, scoop_load, s);
rwhandler.c +1 -1
@@ -42,7 +42,7 @@ int cpu_register_io_memory_simple(struct ReadWriteHandler *handler) }return cpu_register_io_memory (cpu_io_memory_simple_read, cpu_io_memory_simple_write, - handler); + handler,DEVICE_NATIVE_ENDIAN ); }RWHANDLER_WRITE (ioport_simple_writeb,1 , uint32_t);
Signature · 1 line
1.6.0.2
PATCH 3/15 Make simple io mem handler endian aware
In reply to Alexander GrafAs an alternative to the 3 individual handlers, there is also a simplified io mem hook function. To be consistent, let's add an endianness parameter there too.
--- hw/apb_pci.c | 3 ++- hw/pci_host.c | 12 ++++++++---- hw/unin_pci.c | 6 ++++-- rwhandler.c | 4 ++-- rwhandler.h | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-)
hw/apb_pci.c +2 -1
@@ -418,7 +418,8 @@ static int pci_pbm_init_device(SysBusDevice *dev)/* PCI configuration space */ s->pci_config_handler.read = apb_pci_config_read; s->pci_config_handler.write = apb_pci_config_write; - pci_config =cpu_register_io_memory_simple (&s->pci_config_handler); + pci_config =cpu_register_io_memory_simple (&s->pci_config_handler, +DEVICE_NATIVE_ENDIAN );assert (pci_config >=0 );/* at region 1 */ sysbus_init_mmio (dev,0x1000000ULL , pci_config);
hw/pci_host.c +8 -4
@@ -187,9 +187,11 @@ int pci_host_conf_register_mmio(PCIHostState *s, int swap) {pci_host_init (s);if (swap) { -return cpu_register_io_memory_simple (&s->conf_handler); +return cpu_register_io_memory_simple (&s->conf_handler, +DEVICE_NATIVE_ENDIAN ); }else { -return cpu_register_io_memory_simple (&s->conf_noswap_handler); +return cpu_register_io_memory_simple (&s->conf_noswap_handler, +DEVICE_NATIVE_ENDIAN ); } }
@@ -203,9 +205,11 @@ int pci_host_data_register_mmio(PCIHostState *s, int swap) {pci_host_init (s);if (swap) { -return cpu_register_io_memory_simple (&s->data_handler); +return cpu_register_io_memory_simple (&s->data_handler, +DEVICE_NATIVE_ENDIAN ); }else { -return cpu_register_io_memory_simple (&s->data_noswap_handler); +return cpu_register_io_memory_simple (&s->data_noswap_handler, +DEVICE_NATIVE_ENDIAN ); } }
hw/unin_pci.c +4 -2
@@ -154,7 +154,8 @@ static int pci_unin_main_init_device(SysBusDevice *dev) pci_mem_config =pci_host_conf_register_mmio (&s->host_state,1 ); s->data_handler.read = unin_data_read; s->data_handler.write = unin_data_write; - pci_mem_data =cpu_register_io_memory_simple (&s->data_handler); + pci_mem_data =cpu_register_io_memory_simple (&s->data_handler, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , pci_mem_config);sysbus_init_mmio (dev,0x1000 , pci_mem_data);
@@ -175,7 +176,8 @@ static int pci_u3_agp_init_device(SysBusDevice *dev) pci_mem_config =pci_host_conf_register_mmio (&s->host_state,1 ); s->data_handler.read = unin_data_read; s->data_handler.write = unin_data_write; - pci_mem_data =cpu_register_io_memory_simple (&s->data_handler); + pci_mem_data =cpu_register_io_memory_simple (&s->data_handler, +DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , pci_mem_config);sysbus_init_mmio (dev,0x1000 , pci_mem_data);
rwhandler.c +2 -2
@@ -35,14 +35,14 @@ static CPUReadMemoryFunc * const cpu_io_memory_simple_read[] = { &cpu_io_memory_simple_readl, }; -int cpu_register_io_memory_simple (struct ReadWriteHandler *handler) +int cpu_register_io_memory_simple (struct ReadWriteHandler *handler,int endian) {if (!handler->read || !handler->write) {return -1 ; }return cpu_register_io_memory (cpu_io_memory_simple_read, cpu_io_memory_simple_write, - handler,DEVICE_NATIVE_ENDIAN ); + handler, endian); }RWHANDLER_WRITE (ioport_simple_writeb,1 , uint32_t);
rwhandler.h +1 -1
@@ -19,7 +19,7 @@ struct ReadWriteHandler {/* Helpers for when we want to use a single routine with length. */ /* CPU memory handler: both read and write must be present. */ -int cpu_register_io_memory_simple (ReadWriteHandler *); +int cpu_register_io_memory_simple (ReadWriteHandler *,int endian);/* io port handler: can supply only read or write handlers. */ int register_ioport_simple (ReadWriteHandler *,pio_addr_t start,int length,int size);
Signature · 1 line
1.6.0.2
PATCH 4/15 dbdma: Make little endian
In reply to Alexander GrafThe device is only used on big endian systems, but always byte swaps. That's a very good indicator that it's actually a little endian device ;-).
--- hw/mac_dbdma.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
hw/mac_dbdma.c +1 -4
@@ -707,8 +707,6 @@ static void dbdma_writel (void *opaque,DBDMA_DPRINTF ("channel 0x%x reg 0x%x\n" , (uint32_t )addr >>DBDMA_CHANNEL_SHIFT , reg); - value =bswap32 (value); -/* cmdptr cannot be modified if channel is RUN or ACTIVE */ if (reg == DBDMA_CMDPTR_LO &&
@@ -788,7 +786,6 @@ static uint32_t dbdma_readl (void *opaque, target_phys_addr_t addr)break ; } - value =bswap32 (value);return value; }
@@ -845,7 +842,7 @@ void* DBDMA_init (int *dbdma_mem_index) s =qemu_mallocz (sizeof (DBDMA_channel) *DBDMA_CHANNELS ); *dbdma_mem_index =cpu_register_io_memory (dbdma_read, dbdma_write, s, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );register_savevm (NULL ,"dbdma" ,-1 ,1 , dbdma_save, dbdma_load, s);qemu_register_reset (dbdma_reset, s);
Signature · 1 line
1.6.0.2
PATCH 5/15 pci-host: Delegate bswap to mmio layer
In reply to Alexander GrafThe only reason we have bswap versions of the pci host code is that most pci host devices are little endian. The ppc e500 is the only odd one here, being big endian.
So let's directly pass the endianness down to the mmio layer and not worry about it on the pci host layer.
--- hw/dec_pci.c | 6 ++- hw/grackle_pci.c | 6 ++- hw/pci_host.c | 105 ++++++++++------------------------------------------- hw/pci_host.h | 6 +-- hw/ppce500_pci.c | 6 ++- hw/unin_pci.c | 18 ++++++--- 6 files changed, 46 insertions(+), 101 deletions(-)
hw/dec_pci.c +4 -2
@@ -96,8 +96,10 @@ static int pci_dec_21154_init_device(SysBusDevice *dev) s =FROM_SYSBUS (DECState, dev); - pci_mem_config =pci_host_conf_register_mmio (&s->host_state,1 ); - pci_mem_data =pci_host_data_register_mmio (&s->host_state,1 ); + pci_mem_config =pci_host_conf_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN ); + pci_mem_data =pci_host_data_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN );sysbus_init_mmio (dev,0x1000 , pci_mem_config);sysbus_init_mmio (dev,0x1000 , pci_mem_data);return 0 ;
hw/grackle_pci.c +4 -2
@@ -108,8 +108,10 @@ static int pci_grackle_init_device(SysBusDevice *dev) s =FROM_SYSBUS (GrackleState, dev); - pci_mem_config =pci_host_conf_register_mmio (&s->host_state,1 ); - pci_mem_data =pci_host_data_register_mmio (&s->host_state,1 ); + pci_mem_config =pci_host_conf_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN ); + pci_mem_data =pci_host_data_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN );sysbus_init_mmio (dev,0x1000 , pci_mem_config);sysbus_init_mmio (dev,0x1000 , pci_mem_data);
hw/pci_host.c +20 -85
163 lines not on this page · raw message
hw/pci_host.h +2 -4
@@ -33,9 +33,7 @@struct PCIHostState {SysBusDevice busdev; -ReadWriteHandler conf_noswap_handler;ReadWriteHandler conf_handler; -ReadWriteHandler data_noswap_handler;ReadWriteHandler data_handler;uint32_t config_reg;PCIBus *bus;
@@ -45,8 +43,8 @@ void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);uint32_t pci_data_read (PCIBus *s,uint32_t addr,int len);/* for mmio */ -int pci_host_conf_register_mmio (PCIHostState *s,int swap); -int pci_host_data_register_mmio (PCIHostState *s,int swap); +int pci_host_conf_register_mmio (PCIHostState *s,int endian); +int pci_host_data_register_mmio (PCIHostState *s,int endian);/* for ioio */ void pci_host_conf_register_ioport (pio_addr_t ioport,PCIHostState *s);
hw/ppce500_pci.c +4 -2
@@ -292,13 +292,15 @@ PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t registers) controller->pci_dev = d;/* CFGADDR */ - index =pci_host_conf_register_mmio (&controller->pci_state,0 ); + index =pci_host_conf_register_mmio (&controller->pci_state, +DEVICE_BIG_ENDIAN );if (index <0 ) goto free;cpu_register_physical_memory (registers +PCIE500_CFGADDR ,4 , index);/* CFGDATA */ - index =pci_host_data_register_mmio (&controller->pci_state,0 ); + index =pci_host_data_register_mmio (&controller->pci_state, +DEVICE_BIG_ENDIAN );if (index <0 ) goto free;cpu_register_physical_memory (registers +PCIE500_CFGDATA ,4 , index);
hw/unin_pci.c +12 -6
@@ -151,7 +151,8 @@ static int pci_unin_main_init_device(SysBusDevice *dev)/* Uninorth main bus */ s =FROM_SYSBUS (UNINState, dev); - pci_mem_config =pci_host_conf_register_mmio (&s->host_state,1 ); + pci_mem_config =pci_host_conf_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN ); s->data_handler.read = unin_data_read; s->data_handler.write = unin_data_write; pci_mem_data = cpu_register_io_memory_simple(&s->data_handler,
@@ -173,7 +174,8 @@ static int pci_u3_agp_init_device(SysBusDevice *dev)/* Uninorth U3 AGP bus */ s =FROM_SYSBUS (UNINState, dev); - pci_mem_config =pci_host_conf_register_mmio (&s->host_state,1 ); + pci_mem_config =pci_host_conf_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN ); s->data_handler.read = unin_data_read; s->data_handler.write = unin_data_write; pci_mem_data = cpu_register_io_memory_simple(&s->data_handler,
@@ -196,8 +198,10 @@ static int pci_unin_agp_init_device(SysBusDevice *dev)/* Uninorth AGP bus */ s =FROM_SYSBUS (UNINState, dev); - pci_mem_config =pci_host_conf_register_mmio (&s->host_state,0 ); - pci_mem_data =pci_host_data_register_mmio (&s->host_state,1 ); + pci_mem_config =pci_host_conf_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN ); + pci_mem_data =pci_host_data_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN );sysbus_init_mmio (dev,0x1000 , pci_mem_config);sysbus_init_mmio (dev,0x1000 , pci_mem_data);return 0 ;
@@ -211,8 +215,10 @@ static int pci_unin_internal_init_device(SysBusDevice *dev)/* Uninorth internal bus */ s =FROM_SYSBUS (UNINState, dev); - pci_mem_config =pci_host_conf_register_mmio (&s->host_state,0 ); - pci_mem_data =pci_host_data_register_mmio (&s->host_state,1 ); + pci_mem_config =pci_host_conf_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN ); + pci_mem_data =pci_host_data_register_mmio (&s->host_state, +DEVICE_LITTLE_ENDIAN );sysbus_init_mmio (dev,0x1000 , pci_mem_config);sysbus_init_mmio (dev,0x1000 , pci_mem_data);return 0 ;
Signature · 1 line
1.6.0.2
PATCH 6/15 uninorth: Get rid of bswap
In reply to Alexander GrafThere's no need to bswap once we correctly set the mmio to be little endian.
--- hw/unin_pci.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
hw/unin_pci.c +2 -4
@@ -121,7 +121,6 @@ static void unin_data_write(ReadWriteHandler *handler, pcibus_t addr, uint32_t val, int len) { UNINState *s = container_of(handler, UNINState, data_handler); - val =qemu_bswap_len (val, len);UNIN_DPRINTF ("write addr %" FMT_PCIBUS " len %d val %x\n" , addr, len, val); pci_data_write(s->host_state.bus, unin_get_config_reg(s->host_state.config_reg, addr),
@@ -138,7 +137,6 @@ static uint32_t unin_data_read(ReadWriteHandler *handler,unin_get_config_reg (s->host_state.config_reg, addr), len);UNIN_DPRINTF ("read addr %" FMT_PCIBUS " len %d val %x\n" , addr, len, val); - val =qemu_bswap_len (val, len);return val; }
@@ -156,7 +154,7 @@ static int pci_unin_main_init_device(SysBusDevice *dev) s->data_handler.read = unin_data_read; s->data_handler.write = unin_data_write; pci_mem_data =cpu_register_io_memory_simple (&s->data_handler, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );sysbus_init_mmio (dev,0x1000 , pci_mem_config);sysbus_init_mmio (dev,0x1000 , pci_mem_data);
@@ -179,7 +177,7 @@ static int pci_u3_agp_init_device(SysBusDevice *dev) s->data_handler.read = unin_data_read; s->data_handler.write = unin_data_write; pci_mem_data =cpu_register_io_memory_simple (&s->data_handler, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );sysbus_init_mmio (dev,0x1000 , pci_mem_config);sysbus_init_mmio (dev,0x1000 , pci_mem_data);
Signature · 1 line
1.6.0.2
PATCH 7/15 e1000: Make little endian
In reply to Alexander GrafThe e1000 has compatibility code to handle big endianness which makes it mandatory to be recompiled on different targets.
With the generic mmio endianness solution, there's no need for that anymore. We just declare all mmio to be little endian and call it a day.
Because we don't depend on the target endianness anymore, we can also move the driver over to Makefile.objs.
--- Makefile.objs | 1 + Makefile.target | 1 - hw/e1000.c | 11 ++--------- 3 files changed, 3 insertions(+), 10 deletions(-)
Makefile.objs +1 -0
@@ -215,6 +215,7 @@ hw-obj-y += msix.o msi.o hw-obj-y += ne2000.o hw-obj-y += eepro100.o hw-obj-y += pcnet.o +hw-obj-y += e1000.o hw-obj-$(CONFIG_SMC91C111) += smc91c111.o hw-obj-$(CONFIG_LAN9118) += lan9118.o
Makefile.target +0 -1
@@ -211,7 +211,6 @@ obj-$(CONFIG_USB_OHCI) += usb-ohci.o # PCI network cards obj-y += rtl8139.o -obj-y += e1000.o # Inter-VM PCI shared memory obj-$(CONFIG_KVM) += ivshmem.o
hw/e1000.c +2 -9
@@ -857,9 +857,6 @@ e1000_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val)E1000State *s = opaque;unsigned int index = (addr &0x1ffff ) >>2 ; -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap32 (val); -#endif if (index <NWRITEOPS && macreg_writeops[index]) { macreg_writeops[index](s, index, val); }else if (index <NREADOPS && macreg_readops[index]) {
@@ -894,11 +891,7 @@ e1000_mmio_readl(void *opaque, target_phys_addr_t addr)if (index <NREADOPS && macreg_readops[index]) { -uint32_t val = macreg_readops[index](s, index); -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap32 (val); -#endif -return val; +return macreg_readops[index](s, index); }DBGOUT (UNKNOWN ,"MMIO unknown read addr=0x%08x\n" , index<<2 );return 0 ;
@@ -1131,7 +1124,7 @@ static int pci_e1000_init(PCIDevice *pci_dev) pci_conf[PCI_INTERRUPT_PIN ] =1 ;// interrupt pin 0 d->mmio_index =cpu_register_io_memory (e1000_mmio_read, - e1000_mmio_write, d,DEVICE_NATIVE_ENDIAN ); + e1000_mmio_write, d,DEVICE_LITTLE_ENDIAN );pci_register_bar ((PCIDevice *)d,0 ,PNPMMIO_SIZE ,PCI_BASE_ADDRESS_SPACE_MEMORY , e1000_mmio_map);
Signature · 1 line
1.6.0.2
PATCH 8/15 prep: Declare as little endian
In reply to Alexander GrafThis patch replaces explicit bswaps with endianness hints to the mmio layer.
--- hw/ppc_prep.c | 38 +++----------------------------------- 1 files changed, 3 insertions(+), 35 deletions(-)
hw/ppc_prep.c +3 -35
@@ -145,20 +145,12 @@ static uint32_t PPC_intack_readb (void *opaque, target_phys_addr_t addr)static uint32_t PPC_intack_readw (void *opaque,target_phys_addr_t addr) { -#ifdef TARGET_WORDS_BIGENDIAN -return bswap16 (_PPC_intack_read (addr)); -#else return _PPC_intack_read (addr); -#endif }static uint32_t PPC_intack_readl (void *opaque,target_phys_addr_t addr) { -#ifdef TARGET_WORDS_BIGENDIAN -return bswap32 (_PPC_intack_read (addr)); -#else return _PPC_intack_read (addr); -#endif }static CPUWriteMemoryFunc *const PPC_intack_write[] = {
@@ -210,9 +202,6 @@ static void PPC_XCSR_writeb (void *opaque,static void PPC_XCSR_writew (void *opaque,target_phys_addr_t addr,uint32_t value) { -#ifdef TARGET_WORDS_BIGENDIAN - value =bswap16 (value); -#endif printf ("%s: 0x" TARGET_FMT_plx" => 0x%08" PRIx32"\n" , __func__, addr, value); }
@@ -220,9 +209,6 @@ static void PPC_XCSR_writew (void *opaque,static void PPC_XCSR_writel (void *opaque,target_phys_addr_t addr,uint32_t value) { -#ifdef TARGET_WORDS_BIGENDIAN - value =bswap32 (value); -#endif printf ("%s: 0x" TARGET_FMT_plx" => 0x%08" PRIx32"\n" , __func__, addr, value); }
@@ -243,9 +229,6 @@ static uint32_t PPC_XCSR_readw (void *opaque, target_phys_addr_t addr)printf ("%s: 0x" TARGET_FMT_plx" <= %08" PRIx32"\n" , __func__, addr, retval); -#ifdef TARGET_WORDS_BIGENDIAN - retval =bswap16 (retval); -#endif return retval; }
@@ -256,9 +239,6 @@ static uint32_t PPC_XCSR_readl (void *opaque, target_phys_addr_t addr)printf ("%s: 0x" TARGET_FMT_plx" <= %08" PRIx32"\n" , __func__, addr, retval); -#ifdef TARGET_WORDS_BIGENDIAN - retval =bswap32 (retval); -#endif return retval; }
@@ -484,9 +464,6 @@ static void PPC_prep_io_writew (void *opaque, target_phys_addr_t addr,sysctrl_t *sysctrl = opaque; addr =prep_IO_address (sysctrl, addr); -#ifdef TARGET_WORDS_BIGENDIAN - value =bswap16 (value); -#endif PPC_IO_DPRINTF ("0x" TARGET_FMT_plx" => 0x%08" PRIx32"\n" , addr, value);cpu_outw (addr, value); }
@@ -498,9 +475,6 @@ static uint32_t PPC_prep_io_readw (void *opaque, target_phys_addr_t addr) addr =prep_IO_address (sysctrl, addr); ret =cpu_inw (addr); -#ifdef TARGET_WORDS_BIGENDIAN - ret =bswap16 (ret); -#endif PPC_IO_DPRINTF ("0x" TARGET_FMT_plx" <= 0x%08" PRIx32"\n" , addr, ret);return ret;
@@ -512,9 +486,6 @@ static void PPC_prep_io_writel (void *opaque, target_phys_addr_t addr,sysctrl_t *sysctrl = opaque; addr =prep_IO_address (sysctrl, addr); -#ifdef TARGET_WORDS_BIGENDIAN - value =bswap32 (value); -#endif PPC_IO_DPRINTF ("0x" TARGET_FMT_plx" => 0x%08" PRIx32"\n" , addr, value);cpu_outl (addr, value); }
@@ -526,9 +497,6 @@ static uint32_t PPC_prep_io_readl (void *opaque, target_phys_addr_t addr) addr =prep_IO_address (sysctrl, addr); ret =cpu_inl (addr); -#ifdef TARGET_WORDS_BIGENDIAN - ret =bswap32 (ret); -#endif PPC_IO_DPRINTF ("0x" TARGET_FMT_plx" <= 0x%08" PRIx32"\n" , addr, ret);return ret;
@@ -691,7 +659,7 @@ static void ppc_prep_init (ram_addr_t ram_size,/* Register 8 MB of ISA IO space (needed for non-contiguous map) */ PPC_io_memory =cpu_register_io_memory (PPC_prep_io_read, PPC_prep_io_write, sysctrl, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );cpu_register_physical_memory (0x80000000 ,0x00800000 , PPC_io_memory);/* init basic PC hardware */
@@ -757,12 +725,12 @@ static void ppc_prep_init (ram_addr_t ram_size,/* PCI intack location */ PPC_io_memory =cpu_register_io_memory (PPC_intack_read, PPC_intack_write,NULL , -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );cpu_register_physical_memory (0xBFFFFFF0 ,0x4 , PPC_io_memory);/* PowerPC control and status register group */ #if 0 PPC_io_memory =cpu_register_io_memory (PPC_XCSR_read, PPC_XCSR_write, -NULL ,DEVICE_NATIVE_ENDIAN ); +NULL ,DEVICE_LITTLE_ENDIAN );cpu_register_physical_memory (0xFEFF0000 ,0x1000 , PPC_io_memory);#endif
Signature · 1 line
1.6.0.2
Re: [Qemu-devel] [PATCH 08/15] prep: Declare as little endian
Am 25.11.2010 um 08:35 schrieb Alexander Graf:
Quoted 4 lines
This patch replaces explicit bswaps with endianness hints to the mmio layer.
Signed-off-by Alexander Graf <[email protected]>
I'm confused by the subject: Are you positive that PReP is little-endian? Or should this read "prep: Declare some devices as little endian"?
Also, how did you test this? I did some minor prep patches to remove the firmware size check and a crashing hw_error(), and kept getting some ISA IRQ error a few weeks ago.
http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/prep
Andreas
Re: [Qemu-devel] [PATCH 08/15] prep: Declare as little endian
Quoted 5 lines · Andreas Färber
Am 25.11.2010 um 08:35 schrieb Alexander Graf:
Quoted 3 lines
This patch replaces explicit bswaps with endianness hints to the mmio layer.
Quoted 7 lines
Quoted 1 line
Signed-off-by Alexander Graf <[email protected]>I'm confused by the subject: Are you positive that PReP is little-endian? Or should this read "prep: Declare some devices as little endian"?
Also, how did you test this? I did some minor prep patches to remove the firmware size check and a crashing
hw_error(), and kept getting some ISA IRQ error a few weeks ago.http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/prep
I simply replaces explicit bswaps with the flag. Testing prep is hard, as recent kernels don't run on it. To be honest, unless someone steps up to maintain it I might declare it as deprecated soon and just drop it.
Alex
Re: [Qemu-devel] [PATCH 08/15] prep: Declare as little endian
Quoted 6 lines · Alexander Graf
I simply replaces explicit bswaps with the flag. Testing prep is hard, as recent kernels don't run on it. To be honest, unless someone steps up to maintain it I might declare it as deprecated soon and just drop it.
But to answer the original question, yes, pretty much all devices on PReP are LE. It's basically an x86 chipset stuck to a PPC processor ;-)
Cheers,
Ben.
PATCH 9/15 versatile_pci: Declare as little endian
In reply to Alexander GrafThis patch replaces explicit bswaps with endianness hints to the mmio layer.
--- hw/versatile_pci.c | 14 +------------- 1 files changed, 1 insertions(+), 13 deletions(-)
hw/versatile_pci.c +1 -13
@@ -32,18 +32,12 @@ static void pci_vpb_config_writeb (void *opaque, target_phys_addr_t addr,static void pci_vpb_config_writew (void *opaque,target_phys_addr_t addr,uint32_t val) { -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap16 (val); -#endif pci_data_write (opaque,vpb_pci_config_addr (addr), val,2 ); }static void pci_vpb_config_writel (void *opaque,target_phys_addr_t addr,uint32_t val) { -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap32 (val); -#endif pci_data_write (opaque,vpb_pci_config_addr (addr), val,4 ); }
@@ -58,9 +52,6 @@ static uint32_t pci_vpb_config_readw (void *opaque, target_phys_addr_t addr) {uint32_t val; val =pci_data_read (opaque,vpb_pci_config_addr (addr),2 ); -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap16 (val); -#endif return val; }
@@ -68,9 +59,6 @@ static uint32_t pci_vpb_config_readl (void *opaque, target_phys_addr_t addr) {uint32_t val; val =pci_data_read (opaque,vpb_pci_config_addr (addr),4 ); -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap32 (val); -#endif return val; }
@@ -133,7 +121,7 @@ static int pci_vpb_init(SysBusDevice *dev) s->mem_config =cpu_register_io_memory (pci_vpb_config_read, pci_vpb_config_write, bus, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );sysbus_init_mmio_cb (dev,0x04000000 , pci_vpb_map);pci_create_simple (bus,-1 ,"versatile_pci_host" );
Signature · 1 line
1.6.0.2
PATCH 10/15 ppc4xx_pci: Declare as little endian
In reply to Alexander GrafThis patch replaces explicit bswaps with endianness hints to the mmio layer.
--- hw/ppc4xx_pci.c | 17 ++--------------- 1 files changed, 2 insertions(+), 15 deletions(-)
hw/ppc4xx_pci.c +2 -15
@@ -24,7 +24,6 @@#include "ppc4xx.h" #include "pci.h" #include "pci_host.h" -#include "bswap.h" #undef DEBUG#ifdef DEBUG
@@ -102,10 +101,6 @@ static void pci4xx_cfgaddr_writel(void *opaque, target_phys_addr_t addr, {PPC4xxPCIState *ppc4xx_pci = opaque; -#ifdef TARGET_WORDS_BIGENDIAN - value =bswap32 (value); -#endif - ppc4xx_pci->pci_state.config_reg = value & ~0x3 ; }
@@ -120,10 +115,6 @@ static void ppc4xx_pci_reg_write4(void *opaque, target_phys_addr_t offset, {struct PPC4xxPCIState *pci = opaque; -#ifdef TARGET_WORDS_BIGENDIAN - value =bswap32 (value); -#endif -/* We ignore all target attempts at PCI configuration, effectively * assuming a bidirectional 1:1 mapping of PLB and PCI space. */
@@ -251,10 +242,6 @@ static uint32_t ppc4xx_pci_reg_read4(void *opaque, target_phys_addr_t offset) value =0 ; } -#ifdef TARGET_WORDS_BIGENDIAN - value =bswap32 (value); -#endif -return value; }
@@ -373,7 +360,7 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],/* CFGADDR */ index =cpu_register_io_memory (pci4xx_cfgaddr_read, pci4xx_cfgaddr_write, controller, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );if (index <0 ) goto free;cpu_register_physical_memory (config_space +PCIC0_CFGADDR ,4 , index);
@@ -386,7 +373,7 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],/* Internal registers */ index =cpu_register_io_memory (pci_reg_read, pci_reg_write, controller, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );if (index <0 ) goto free;cpu_register_physical_memory (registers,PCI_REG_SIZE , index);
Signature · 1 line
1.6.0.2
PATCH 11/15 openpic: Replace explicit byte swap with endian hints
In reply to Alexander GrafThis patch replaces explicit bswaps with endianness hints to the mmio layer.
--- hw/openpic.c | 23 ++--------------------- 1 files changed, 2 insertions(+), 21 deletions(-)
hw/openpic.c +2 -21
@@ -242,19 +242,10 @@ typedef struct openpic_t {int max_irq;int irq_ipi0;int irq_tim0; -int need_swap;void (*reset) (void *);void (*irq_raise) (struct openpic_t *,int ,IRQ_src_t *); } openpic_t; -static inline uint32_t openpic_swap32 (openpic_t *opp,uint32_t val) -{ -if (opp->need_swap) -return bswap32 (val); - -return val; -} -static inline void IRQ_setbit (IRQ_queue_t *q,int n_IRQ) {set_bit (q->queue, n_IRQ);
@@ -599,7 +590,6 @@ static void openpic_gbl_write (void *opaque, target_phys_addr_t addr, uint32_t vDPRINTF ("%s: addr " TARGET_FMT_plx" <= %08x\n" , __func__, addr, val);if (addr &0xF )return ; - val =openpic_swap32 (opp, val); addr &=0xFF ;switch (addr) {case 0x00 :/* FREP */
@@ -693,7 +683,6 @@ static uint32_t openpic_gbl_read (void *opaque, target_phys_addr_t addr)break ; }DPRINTF ("%s: => %08x\n" , __func__, retval); - retval =openpic_swap32 (opp, retval);return retval; }
@@ -706,7 +695,6 @@ static void openpic_timer_write (void *opaque, uint32_t addr, uint32_t val)DPRINTF ("%s: addr %08x <= %08x\n" , __func__, addr, val);if (addr &0xF )return ; - val =openpic_swap32 (opp, val); addr -=0x1100 ; addr &=0xFFFF ; idx = (addr &0xFFF0 ) >>6 ;
@@ -759,7 +747,6 @@ static uint32_t openpic_timer_read (void *opaque, uint32_t addr)break ; }DPRINTF ("%s: => %08x\n" , __func__, retval); - retval =openpic_swap32 (opp, retval);return retval; }
@@ -772,7 +759,6 @@ static void openpic_src_write (void *opaque, uint32_t addr, uint32_t val)DPRINTF ("%s: addr %08x <= %08x\n" , __func__, addr, val);if (addr &0xF )return ; - val =openpic_swap32 (opp, val); addr = addr &0xFFF0 ; idx = addr >>5 ;if (addr &0x10 ) {
@@ -804,7 +790,6 @@ static uint32_t openpic_src_read (void *opaque, uint32_t addr) retval =read_IRQreg (opp, idx,IRQ_IPVP ); }DPRINTF ("%s: => %08x\n" , __func__, retval); - retval =openpic_swap32 (opp, retval);return retval; }
@@ -819,7 +804,6 @@ static void openpic_cpu_write (void *opaque, target_phys_addr_t addr, uint32_t vDPRINTF ("%s: addr " TARGET_FMT_plx" <= %08x\n" , __func__, addr, val);if (addr &0xF )return ; - val =openpic_swap32 (opp, val); addr &=0x1FFF0 ; idx = addr /0x1000 ; dst = &opp->dst[idx];
@@ -937,7 +921,6 @@ static uint32_t openpic_cpu_read (void *opaque, target_phys_addr_t addr)break ; }DPRINTF ("%s: => %08x\n" , __func__, retval); - retval =openpic_swap32 (opp, retval);return retval; }
@@ -1204,7 +1187,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, opp =qemu_mallocz (sizeof (openpic_t)); } opp->mem_index =cpu_register_io_memory (openpic_read, openpic_write, opp, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );// isu_base &= 0xFFFC0000; opp->nb_cpus = nb_cpus;
@@ -1232,7 +1215,6 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,for (i =0 ; i < nb_cpus; i++) opp->dst[i].irqs = irqs[i]; opp->irq_out = irq_out; - opp->need_swap =1 ;register_savevm (&opp->pci_dev.qdev,"openpic" ,0 ,2 , openpic_save, openpic_load, opp);
@@ -1673,7 +1655,7 @@ qemu_irq *mpic_init (target_phys_addr_t base, int nb_cpus,int mem_index; mem_index =cpu_register_io_memory (list[i].read, list[i].write, mpp, -DEVICE_NATIVE_ENDIAN ); +DEVICE_BIG_ENDIAN );if (mem_index <0 ) { goto free; }
@@ -1689,7 +1671,6 @@ qemu_irq *mpic_init (target_phys_addr_t base, int nb_cpus,for (i =0 ; i < nb_cpus; i++) mpp->dst[i].irqs = irqs[i]; mpp->irq_out = irq_out; - mpp->need_swap =0 ;/* MPIC has the same endian as target */ mpp->irq_raise = mpic_irq_raise; mpp->reset = mpic_reset;
Signature · 1 line
1.6.0.2
PATCH 12/15 rtl8139: Declare as little endian
In reply to Alexander GrafThis patch replaces explicit bswaps with endianness hints to the mmio layer.
Because we don't depend on the target endianness anymore, we can also move the driver over to Makefile.objs.
--- Makefile.objs | 1 + Makefile.target | 3 --- hw/rtl8139.c | 14 +------------- 3 files changed, 2 insertions(+), 16 deletions(-)
Makefile.objs +1 -0
@@ -216,6 +216,7 @@ hw-obj-y += ne2000.o hw-obj-y += eepro100.o hw-obj-y += pcnet.o hw-obj-y += e1000.o +hw-obj-y += rtl8139.o hw-obj-$(CONFIG_SMC91C111) += smc91c111.o hw-obj-$(CONFIG_LAN9118) += lan9118.o
Makefile.target +0 -3
@@ -209,9 +209,6 @@ obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o # USB layer obj-$(CONFIG_USB_OHCI) += usb-ohci.o -# PCI network cards -obj-y += rtl8139.o - # Inter-VM PCI shared memory obj-$(CONFIG_KVM) += ivshmem.o
hw/rtl8139.c +1 -13
@@ -3125,17 +3125,11 @@ static void rtl8139_mmio_writeb(void *opaque, target_phys_addr_t addr, uint32_tstatic void rtl8139_mmio_writew (void *opaque,target_phys_addr_t addr,uint32_t val) { -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap16 (val); -#endif rtl8139_io_writew (opaque, addr &0xFF , val); }static void rtl8139_mmio_writel (void *opaque,target_phys_addr_t addr,uint32_t val) { -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap32 (val); -#endif rtl8139_io_writel (opaque, addr &0xFF , val); }
@@ -3147,18 +3141,12 @@ static uint32_t rtl8139_mmio_readb(void *opaque, target_phys_addr_t addr)static uint32_t rtl8139_mmio_readw (void *opaque,target_phys_addr_t addr) {uint32_t val =rtl8139_io_readw (opaque, addr &0xFF ); -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap16 (val); -#endif return val; }static uint32_t rtl8139_mmio_readl (void *opaque,target_phys_addr_t addr) {uint32_t val =rtl8139_io_readl (opaque, addr &0xFF ); -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap32 (val); -#endif return val; }
@@ -3367,7 +3355,7 @@ static int pci_rtl8139_init(PCIDevice *dev)/* I/O handler for memory-mapped I/O */ s->rtl8139_mmio_io_addr =cpu_register_io_memory (rtl8139_mmio_read, rtl8139_mmio_write, s, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );pci_register_bar (&s->dev,0 ,0x100 ,PCI_BASE_ADDRESS_SPACE_IO , rtl8139_ioport_map);
Signature · 1 line
1.6.0.2
PATCH 13/15 heathrow_pic: Declare as little endian
In reply to Alexander GrafThis patch replaces explicit bswaps with endianness hints to the mmio layer.
--- hw/heathrow_pic.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
hw/heathrow_pic.c +1 -3
@@ -68,7 +68,6 @@ static void pic_writel (void *opaque, target_phys_addr_t addr, uint32_t value)HeathrowPIC *pic;unsigned int n; - value =bswap32 (value); n = ((addr &0xfff ) -0x10 ) >>4 ;PIC_DPRINTF ("writel: " TARGET_FMT_plx" %u: %08x\n" , addr, n, value);if (n >=2 )
@@ -118,7 +117,6 @@ static uint32_t pic_readl (void *opaque, target_phys_addr_t addr) } }PIC_DPRINTF ("readl: " TARGET_FMT_plx" %u: %08x\n" , addr, n, value); - value =bswap32 (value);return value; }
@@ -223,7 +221,7 @@ qemu_irq *heathrow_pic_init(int *pmem_index,/* only 1 CPU */ s->irqs = irqs[0 ]; *pmem_index =cpu_register_io_memory (pic_read, pic_write, s, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN );register_savevm (NULL ,"heathrow_pic" ,-1 ,1 , heathrow_pic_save, heathrow_pic_load, s);
Signature · 1 line
1.6.0.2
PATCH 14/15 isa_mmio: Always use little endian
In reply to Alexander GrafThis patch converts the ISA MMIO bridge code to always use little endian mmio. All bswap code that existed was only there to convert from native cpu endianness to little endian ISA devices.
--- hw/bonito.c | 4 +- hw/gt64xxx.c | 6 +-- hw/isa.h | 2 +- hw/isa_mmio.c | 102 +++++++++-------------------------------------- hw/mips_jazz.c | 7 +--- hw/mips_mipssim.c | 6 +-- hw/mips_r4k.c | 6 +-- hw/ppc440.c | 2 +- hw/ppc_newworld.c | 2 +- hw/ppc_oldworld.c | 2 +- hw/ppce500_mpc8544ds.c | 2 +- hw/sh_pci.c | 4 +- hw/sun4u.c | 4 +- hw/versatile_pci.c | 6 +-- 14 files changed, 36 insertions(+), 119 deletions(-)
hw/bonito.c +2 -2
@@ -743,12 +743,12 @@ static int bonito_initfn(PCIDevice *dev) s->bonito_pciio_start =BONITO_PCIIO_BASE ; s->bonito_pciio_length =BONITO_PCIIO_SIZE ; isa_mem_base = s->bonito_pciio_start; -isa_mmio_init (s->bonito_pciio_start, s->bonito_pciio_length,0 ); +isa_mmio_init (s->bonito_pciio_start, s->bonito_pciio_length);/* add pci local io mapping */ s->bonito_localio_start =BONITO_DEV_BASE ; s->bonito_localio_length =BONITO_DEV_SIZE ; -isa_mmio_init (s->bonito_localio_start, s->bonito_localio_length,0 ); +isa_mmio_init (s->bonito_localio_start, s->bonito_localio_length);/* set the default value of north bridge pci config */ pci_set_word (dev->config +PCI_COMMAND ,0x0000 );
hw/gt64xxx.c +1 -5
@@ -297,11 +297,7 @@ static void gt64120_pci_mapping(GT64120State *s) s->PCI0IO_start = s->regs[GT_PCI0IOLD ] <<21 ; s->PCI0IO_length = ((s->regs[GT_PCI0IOHD ] +1 ) - (s->regs[GT_PCI0IOLD ] &0x7f )) <<21 ; isa_mem_base = s->PCI0IO_start; -#ifdef TARGET_WORDS_BIGENDIAN -isa_mmio_init (s->PCI0IO_start, s->PCI0IO_length,1 ); -#else -isa_mmio_init (s->PCI0IO_start, s->PCI0IO_length,0 ); -#endif +isa_mmio_init (s->PCI0IO_start, s->PCI0IO_length); } }
hw/isa.h +1 -1
@@ -32,7 +32,7 @@ ISADevice *isa_create_simple(const char *name);extern target_phys_addr_t isa_mem_base; -void isa_mmio_init (target_phys_addr_t base,target_phys_addr_t size,int be); +void isa_mmio_init (target_phys_addr_t base,target_phys_addr_t size);/* dma.c */ int DMA_get_channel_mode (int nchan);
hw/isa_mmio.c +20 -82
133 lines not on this page · raw message
hw/mips_jazz.c +1 -6
@@ -205,12 +205,7 @@ void mips_jazz_init (ram_addr_t ram_size,pcspk_init (pit);/* ISA IO space at 0x90000000 */ -#ifdef TARGET_WORDS_BIGENDIAN -isa_mmio_init (0x90000000 ,0x01000000 ,1 ); -#else -isa_mmio_init (0x90000000 ,0x01000000 ,0 ); -#endif - +isa_mmio_init (0x90000000 ,0x01000000 ); isa_mem_base =0x11000000 ;/* Video card */
hw/mips_mipssim.c +1 -5
@@ -186,11 +186,7 @@ mips_mipssim_init (ram_addr_t ram_size,cpu_mips_clock_init (env);/* Register 64 KB of ISA IO space at 0x1fd00000. */ -#ifdef TARGET_WORDS_BIGENDIAN -isa_mmio_init (0x1fd00000 ,0x00010000 ,1 ); -#else -isa_mmio_init (0x1fd00000 ,0x00010000 ,0 ); -#endif +isa_mmio_init (0x1fd00000 ,0x00010000 );/* A single 16450 sits at offset 0x3f8. It is attached to MIPS CPU INT2, which is interrupt 4. */
hw/mips_r4k.c +1 -5
@@ -271,11 +271,7 @@ void mips_r4k_init (ram_addr_t ram_size,rtc_init (2000 ,NULL );/* Register 64 KB of ISA IO space at 0x14000000 */ -#ifdef TARGET_WORDS_BIGENDIAN -isa_mmio_init (0x14000000 ,0x00010000 ,1 ); -#else -isa_mmio_init (0x14000000 ,0x00010000 ,0 ); -#endif +isa_mmio_init (0x14000000 ,0x00010000 ); isa_mem_base =0x10000000 ; pit =pit_init (0x40 , i8259[0 ]);
hw/ppc440.c +1 -1
@@ -85,7 +85,7 @@ CPUState *ppc440ep_init(ram_addr_t *ram_size, PCIBus **pcip,if (!*pcip)printf ("couldn't create PCI controller!\n" ); -isa_mmio_init (PPC440EP_PCI_IO ,PPC440EP_PCI_IOLEN ,1 ); +isa_mmio_init (PPC440EP_PCI_IO ,PPC440EP_PCI_IOLEN );if (serial_hds[0 ] !=NULL ) { serial_mm_init(0xef600300, 0, pic[0], PPC_SERIAL_MM_BAUDBASE,
hw/ppc_newworld.c +1 -1
@@ -257,7 +257,7 @@ static void ppc_core99_init (ram_addr_t ram_size, isa_mem_base =0x80000000 ;/* Register 8 MB of ISA IO space */ -isa_mmio_init (0xf2000000 ,0x00800000 ,1 ); +isa_mmio_init (0xf2000000 ,0x00800000 );/* UniN init */ unin_memory = cpu_register_io_memory(unin_read, unin_write, NULL,
hw/ppc_oldworld.c +1 -1
@@ -202,7 +202,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, isa_mem_base =0x80000000 ;/* Register 2 MB of ISA IO space */ -isa_mmio_init (0xfe000000 ,0x00200000 ,1 ); +isa_mmio_init (0xfe000000 ,0x00200000 );/* XXX: we register only 1 output pin for heathrow PIC */ heathrow_irqs =qemu_mallocz (smp_cpus *sizeof (qemu_irq *));
hw/ppce500_mpc8544ds.c +1 -1
@@ -220,7 +220,7 @@ static void mpc8544ds_init(ram_addr_t ram_size,if (!pci_bus)printf ("couldn't create PCI controller!\n" ); -isa_mmio_init (MPC8544_PCI_IO ,MPC8544_PCI_IOLEN ,1 ); +isa_mmio_init (MPC8544_PCI_IO ,MPC8544_PCI_IOLEN );if (pci_bus) {/* Register network interfaces. */
hw/sh_pci.c +2 -2
@@ -54,7 +54,7 @@ static void sh_pci_reg_write (void *p, target_phys_addr_t addr, uint32_t val)cpu_register_physical_memory (pcic->iobr &0xfffc0000 ,0x40000 ,IO_MEM_UNASSIGNED ); pcic->iobr = val &0xfffc0001 ; -isa_mmio_init (pcic->iobr &0xfffc0000 ,0x40000 ,0 ); +isa_mmio_init (pcic->iobr &0xfffc0000 ,0x40000 ); }break ;case 0x220 :
@@ -109,7 +109,7 @@ PCIBus *sh_pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,cpu_register_physical_memory (0xfe200000 ,0x224 , reg); p->iobr =0xfe240000 ; -isa_mmio_init (p->iobr,0x40000 ,0 ); +isa_mmio_init (p->iobr,0x40000 );pci_config_set_vendor_id (p->dev->config,PCI_VENDOR_ID_HITACHI );pci_config_set_device_id (p->dev->config,PCI_DEVICE_ID_HITACHI_SH7751R );
hw/sun4u.c +2 -2
@@ -525,10 +525,10 @@ static void ebus_mmio_mapfunc(PCIDevice *pci_dev, int region_num, region_num, addr);switch (region_num) {case 0 : -isa_mmio_init (addr,0x1000000 ,1 ); +isa_mmio_init (addr,0x1000000 );break ;case 1 : -isa_mmio_init (addr,0x800000 ,1 ); +isa_mmio_init (addr,0x800000 );break ; } }
hw/versatile_pci.c +1 -5
@@ -96,11 +96,7 @@ static void pci_vpb_map(SysBusDevice *dev, target_phys_addr_t base)if (s->realview) {/* IO memory area. */ -#ifdef TARGET_WORDS_BIGENDIAN -isa_mmio_init (base +0x03000000 ,0x00100000 ,1 ); -#else -isa_mmio_init (base +0x03000000 ,0x00100000 ,0 ); -#endif +isa_mmio_init (base +0x03000000 ,0x00100000 ); } }
Signature · 1 line
1.6.0.2
PATCH 15/15 usb_ohci: Always use little endian
In reply to Alexander GrafThis patch replaces explicit bswaps with endianness hints to the mmio layer.
Because we don't depend on the target endianness anymore, we can also move the driver over to Makefile.objs.
--- Makefile.objs | 1 + Makefile.target | 3 --- hw/usb-ohci.c | 9 +-------- 3 files changed, 2 insertions(+), 11 deletions(-)
Makefile.objs +1 -0
@@ -179,6 +179,7 @@ hw-obj-$(CONFIG_I8254) += i8254.o hw-obj-$(CONFIG_PCSPK) += pcspk.o hw-obj-$(CONFIG_PCKBD) += pckbd.o hw-obj-$(CONFIG_USB_UHCI) += usb-uhci.o +hw-obj-$(CONFIG_USB_OHCI) += usb-ohci.o hw-obj-$(CONFIG_FDC) += fdc.o hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o
Makefile.target +0 -3
@@ -206,9 +206,6 @@ QEMU_CFLAGS += $(VNC_PNG_CFLAGS) # xen backend driver support obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o -# USB layer -obj-$(CONFIG_USB_OHCI) += usb-ohci.o - # Inter-VM PCI shared memory obj-$(CONFIG_KVM) += ivshmem.o
hw/usb-ohci.c +1 -8
@@ -1530,9 +1530,6 @@ static uint32_t ohci_mem_read(void *ptr, target_phys_addr_t addr) } } -#ifdef TARGET_WORDS_BIGENDIAN - retval =bswap32 (retval); -#endif return retval; }
@@ -1542,10 +1539,6 @@ static void ohci_mem_write(void *ptr, target_phys_addr_t addr, uint32_t val) addr &=0xff ; -#ifdef TARGET_WORDS_BIGENDIAN - val =bswap32 (val); -#endif -/* Only aligned reads are allowed on OHCI */ if (addr &3 ) {fprintf (stderr,"usb-ohci: Mis-aligned write\n" );
@@ -1698,7 +1691,7 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, } ohci->mem =cpu_register_io_memory (ohci_readfn, ohci_writefn, ohci, -DEVICE_NATIVE_ENDIAN ); +DEVICE_LITTLE_ENDIAN ); ohci->localmem_base = localmem_base; ohci->name = dev->info->name;
Signature · 1 line
1.6.0.2
Quoted 49 lines · Alexander Graf
The way mmio endianness is currently implemented is horrifying.
In the real world, CPUs have an endianness and write out data to the memory bus. Instead of RAM, a receiving side here can be a device. This device gets a byte stream again and needs to make sense of it.
Since big endian systems write big endian numbers into memory while little endian systems write little endian numbers there, the device and software on the CPU need to be aware of this.
In practice, most devices these days (ISA, PCI) assume that the data is little endian. So to communicate with such a device from the CPU's side, the OS byte swaps all MMIO.
In qemu however, we simply pass the register value we find on to the device. So any byte mangling the guest does to compensate for the transfer screw us up by exposing byte swapped MMIO on the device's side.
The way this has been fixed historically is by constructs like this one:
#ifdef TARGET_WORDS_BIGENDIAN val = bswap32(val);#endif
With the move to get device code only compiled once, this has become harder and harder to justify though, since we don't know the target endianness during compile time.
It's especially bad since it doesn't make any sense at all to clutter all the device code with endianness workarounds, aside from the fact that about 80% of the device code currently does the wrong thing :).
So my solution to the issue is to make every device define if it's a little, big or native (target) endianness device. This basically tells the layers below what endianness the device expects mmio to occur in. Little endian devices on little endian hosts don't swap. On big endian hosts they do. Same the other way around.
The only reason I added "native" endianness is that we have some PV devices like the
fw_cfgthat expect qemu's broken behavior. These devices are the minority though. In the long run I'd expect to see most code be committed with either of the two endianness choices.
Quoted 4 lines
The patch set also includes a bunch of conversions for devices that were already aware of endianness.
This is an RFC, so please comment as much as you can :).
Seen http://git.qemu.org/qemu.git/commit/?id=acd1c812b5548c8426e093075362b6d4119db6ac ?
I think it make sense to either extend it so it works for mmio too (and add the endian awareness along the way) or create something simliar for mmio.
cheers,
Gerd
Quoted 50 lines · Gerd Hoffmann
Quoted 49 lines · Alexander Graf
The way mmio endianness is currently implemented is horrifying.
In the real world, CPUs have an endianness and write out data to the memory bus. Instead of RAM, a receiving side here can be a device. This device gets a byte stream again and needs to make sense of it.
Since big endian systems write big endian numbers into memory while little endian systems write little endian numbers there, the device and software on the CPU need to be aware of this.
In practice, most devices these days (ISA, PCI) assume that the data is little endian. So to communicate with such a device from the CPU's side, the OS byte swaps all MMIO.
In qemu however, we simply pass the register value we find on to the device. So any byte mangling the guest does to compensate for the transfer screw us up by exposing byte swapped MMIO on the device's side.
The way this has been fixed historically is by constructs like this one:
#ifdef TARGET_WORDS_BIGENDIAN val = bswap32(val);#endif
With the move to get device code only compiled once, this has become harder and harder to justify though, since we don't know the target endianness during compile time.
It's especially bad since it doesn't make any sense at all to clutter all the device code with endianness workarounds, aside from the fact that about 80% of the device code currently does the wrong thing :).
So my solution to the issue is to make every device define if it's a little, big or native (target) endianness device. This basically tells the layers below what endianness the device expects mmio to occur in. Little endian devices on little endian hosts don't swap. On big endian hosts they do. Same the other way around.
The only reason I added "native" endianness is that we have some PV devices like the
fw_cfgthat expect qemu's broken behavior. These devices are the minority though. In the long run I'd expect to see most code be committed with either of the two endianness choices.
Quoted 8 lines
Quoted 4 lines
The patch set also includes a bunch of conversions for devices that were already aware of endianness.
This is an RFC, so please comment as much as you can :).
Seen http://git.qemu.org/qemu.git/commit/?id=acd1c812b5548c8426e093075362b6d4119db6ac ?
I think it make sense to either extend it so it works for mmio too (and add the endian awareness along the way) or create something simliar for mmio.
We only have a single opaque for mmio, so I don't see the value-add. There is a simple mmio version already in rwhandler.c btw.
http://git.qemu.org/qemu.git/commit/?id=049f7adbd547969ba013fed13c0a26c1f62a4a71
Alex
Quoted 53 lines · Gerd Hoffmann
Quoted 52 lines · Alexander Graf
The way mmio endianness is currently implemented is horrifying.
In the real world, CPUs have an endianness and write out data to the memory bus. Instead of RAM, a receiving side here can be a device. This device gets a byte stream again and needs to make sense of it.
Since big endian systems write big endian numbers into memory while little endian systems write little endian numbers there, the device and software on the CPU need to be aware of this.
In practice, most devices these days (ISA, PCI) assume that the data is little endian. So to communicate with such a device from the CPU's side, the OS byte swaps all MMIO.
In qemu however, we simply pass the register value we find on to the device. So any byte mangling the guest does to compensate for the transfer screw us up by exposing byte swapped MMIO on the device's side.
The way this has been fixed historically is by constructs like this one:
#ifdef TARGET_WORDS_BIGENDIAN val = bswap32(val);#endif
With the move to get device code only compiled once, this has become harder and harder to justify though, since we don't know the target endianness during compile time.
It's especially bad since it doesn't make any sense at all to clutter all the device code with endianness workarounds, aside from the fact that about 80% of the device code currently does the wrong thing :).
So my solution to the issue is to make every device define if it's a little, big or native (target) endianness device. This basically tells the layers below what endianness the device expects mmio to occur in. Little endian devices on little endian hosts don't swap. On big endian hosts they do. Same the other way around.
The only reason I added "native" endianness is that we have some PV devices like the
fw_cfgthat expect qemu's broken behavior. These devices are the minority though. In the long run I'd expect to see most code be committed with either of the two endianness choices.The patch set also includes a bunch of conversions for devices that were already aware of endianness.
Quoted 9 lines
Quoted 1 line
This is an RFC, so please comment as much as you can :).
Seen http://git.qemu.org/qemu.git/commit/?id=acd1c812b5548c8426e093075362b6d4119db6ac
?I think it make sense to either extend it so it works for mmio too (and add the endian awareness along the way) or create something simliar for mmio.
FWTW when I asked why addr and data in IORange are 64bit I was told that it is intended for use with MMIO too.
--
Gleb.
Quoted 1 line
The way mmio endianness is currently implemented is horrifying.
Agreed.
Quoted 7 lines
#ifdef TARGET_WORDS_BIGENDIAN val = bswap32(val);#endif
With the move to get device code only compiled once, this has become harder and harder to justify though, since we don't know the target endianness during compile time.
Not just that, it's wrong to start with. I've used machines with both native and cross-endian 16550 based UARTs.
Quoted 7 lines
So my solution to the issue is to make every device define if it's a little, big or native (target) endianness device. This basically tells the layers below what endianness the device expects mmio to occur in. Little endian devices on little endian hosts don't swap. On big endian hosts they do. Same the other way around.
Quoted 5 lines
The only reason I added "native" endianness is that we have some PV devices like the
fw_cfgthat expect qemu's broken behavior. These devices are the minority though. In the long run I'd expect to see most code be committed with either of the two endianness choices.
I'd prefer to avoid this, or at least document it as a temporary hack that should be removed. If a device can exist in either endian, then we really want to push this decision down to the board-level code.
One of the reasons I haven't bothered fixing this yet is that this feels like something that should be a device/bus property. e.g. PCI devices/busses are always little-endian[1], as as mentioned above some devices come in both flavors. I guess we can go with your approach for now, and make sure we fix this properly when we introduce bus-specific registration functions.
Paul
[1] Ignoring magical byteswapping cpu-pci bridges, but they're broken by design, and thankfully quite rare.
Quoted 49 lines · Alexander Graf
The way mmio endianness is currently implemented is horrifying.
In the real world, CPUs have an endianness and write out data to the memory bus. Instead of RAM, a receiving side here can be a device. This device gets a byte stream again and needs to make sense of it.
Since big endian systems write big endian numbers into memory while little endian systems write little endian numbers there, the device and software on the CPU need to be aware of this.
In practice, most devices these days (ISA, PCI) assume that the data is little endian. So to communicate with such a device from the CPU's side, the OS byte swaps all MMIO.
In qemu however, we simply pass the register value we find on to the device. So any byte mangling the guest does to compensate for the transfer screw us up by exposing byte swapped MMIO on the device's side.
The way this has been fixed historically is by constructs like this one:
#ifdef
TARGET_WORDS_BIGENDIAN
val = bswap32(val);
#endifWith the move to get device code only compiled once, this has become harder and harder to justify though, since we don't know the target endianness during compile time.
It's especially bad since it doesn't make any sense at all to clutter all the device code with endianness workarounds, aside from the fact that about 80% of the device code currently does the wrong thing :).
So my solution to the issue is to make every device define if it's a little, big or native (target) endianness device. This basically tells the layers below what endianness the device expects mmio to occur in. Little endian devices on little endian hosts don't swap. On big endian hosts they do. Same the other way around.
The only reason I added "native" endianness is that we have some PV devices like the
fw_cfgthat expect qemu's broken behavior. These devices are the minority though. In the long run I'd expect to see most code be committed with either of the two endianness choices.
Quoted 4 lines
The patch set also includes a bunch of conversions for devices that were already aware of endianness.
This is an RFC, so please comment as much as you can :).
Nice approach, better than mine. I'm looking forward to see VGA converted ;-). It's used by almost all targets, so that conversion would save a lot of compile cycles.
Quoted 50 lines · Blue Swirl
Quoted 49 lines · Alexander Graf
The way mmio endianness is currently implemented is horrifying.
In the real world, CPUs have an endianness and write out data to the memory bus. Instead of RAM, a receiving side here can be a device. This device gets a byte stream again and needs to make sense of it.
Since big endian systems write big endian numbers into memory while little endian systems write little endian numbers there, the device and software on the CPU need to be aware of this.
In practice, most devices these days (ISA, PCI) assume that the data is little endian. So to communicate with such a device from the CPU's side, the OS byte swaps all MMIO.
In qemu however, we simply pass the register value we find on to the device. So any byte mangling the guest does to compensate for the transfer screw us up by exposing byte swapped MMIO on the device's side.
The way this has been fixed historically is by constructs like this one:
#ifdef TARGET_WORDS_BIGENDIAN val = bswap32(val);#endif
With the move to get device code only compiled once, this has become harder and harder to justify though, since we don't know the target endianness during compile time.
It's especially bad since it doesn't make any sense at all to clutter all the device code with endianness workarounds, aside from the fact that about 80% of the device code currently does the wrong thing :).
So my solution to the issue is to make every device define if it's a little, big or native (target) endianness device. This basically tells the layers below what endianness the device expects mmio to occur in. Little endian devices on little endian hosts don't swap. On big endian hosts they do. Same the other way around.
The only reason I added "native" endianness is that we have some PV devices like the
fw_cfgthat expect qemu's broken behavior. These devices are the minority though. In the long run I'd expect to see most code be committed with either of the two endianness choices.
Quoted 8 lines
Quoted 4 lines
The patch set also includes a bunch of conversions for devices that were already aware of endianness.
This is an RFC, so please comment as much as you can :).
Nice approach, better than mine. I'm looking forward to see VGA converted ;-). It's used by almost all targets, so that conversion would save a lot of compile cycles.
The only issue for VGA should be the frame buffer. Since we can keep that as DEVICE_NATIVE_ENDIAN, we should be good. I hope. Not sure yet. :)
So far there hasn't really been any negative feedback. Should we take this RFC as v1 and just merge it?
Alex
Quoted 9 lines · Alexander Graf
Quoted 4 lines
Nice approach, better than mine. I'm looking forward to see VGA converted ;-). It's used by almost all targets, so that conversion would save a lot of compile cycles.
The only issue for VGA should be the frame buffer. Since we can keep that as
DEVICE_NATIVE_ENDIAN, we should be good. I hope. Not sure yet. :)So far there hasn't really been any negative feedback. Should we take this RFC as v1 and just merge it?
IMO we should. Very nice patchset.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.