xemu/hw/pci-host
Peter Maydell 7dc176bce4 hw/pci-host/prep: Don't reverse IO accesses on bigendian hosts
The raven_io_read() and raven_io_write() functions pass and
return values in little-endian format (since the IO op struct
is marked DEVICE_LITTLE_ENDIAN); however they were storing the
values in the buffer to pass to address_space_read/write()
in host-endian order, which meant that on big-endian hosts
the values were inadvertently reversed. Use the *_le_p()
accessors instead so that we are consistent regardless of
host endianness.

Strictly speaking the byte order of the buffer for
address_space_rw() is target byte order (which for PPC
will be BE) but it doesn't actually matter as long as we
are consistent about the marking on the IO op struct and
which stl_*_p().

This bug was probably introduced due to confusion caused by
the two different versions of ldl_p() and friends:
 bswap.h defines versions meaning "host endianness access"
 cpu-all.h defines versions meaning "target endianness access"
As a target-independent source file prep.c gets the bswap.h
versions; the very similar looking code in ioport.c is
compiled per-target and gets the cpu-all.h versions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1396972271-22660-1-git-send-email-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <rth@twiddle.net>
2014-04-08 18:37:45 +01:00
..
apb.c hw/pci-host/apb.c: Avoid shifting left into sign bit 2014-03-27 19:22:49 +04:00
bonito.c pci-host: Consistently set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:23 +01:00
grackle.c pci-host: Consistently set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:23 +01:00
Makefile.objs dec.c - move to pci-bridge 2013-06-02 18:13:37 +03:00
pam.c pam: partly fix write-only mode 2014-03-09 21:09:38 +02:00
piix.c qdev:pci: refactor PCIDevice to use generic "hotpluggable" property 2014-02-10 10:26:56 +02:00
ppce500.c pci-host: Consistently set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:23 +01:00
prep.c hw/pci-host/prep: Don't reverse IO accesses on bigendian hosts 2014-04-08 18:37:45 +01:00
q35.c q35: Correct typo BRDIGE -> BRIDGE 2014-03-11 13:27:27 +02:00
uninorth.c pci-host: Consistently set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:23 +01:00
versatile.c pci-host: Consistently set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:23 +01:00