]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
fw_cfg: the I/O port variant expects little-endian
authorPaolo Bonzini <pbonzini@redhat.com>
Sun, 28 Jul 2013 12:35:54 +0000 (14:35 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 7 Aug 2013 17:48:15 +0000 (12:48 -0500)
The I/O port variant of fw_cfg is used by sparc64, which is a big-endian machine.
Firmware swaps bytes before sending them to fw_cfg, so we need to unswap them in
the device.

This is only used on sparc64 and on (little-endian) x86, so it does not affect
any other target.  32-bit Sparc and PPC all use memory-mapped fw_cfg.

Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-id: 1375014954-31916-2-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/nvram/fw_cfg.c

index 0a35015b9eec761f41fa4a12f85521f30dcae4c9..d0820e507b78720c9bf5a7019d108dc3dda877aa 100644 (file)
@@ -324,7 +324,7 @@ static const MemoryRegionOps fw_cfg_data_mem_ops = {
 static const MemoryRegionOps fw_cfg_comb_mem_ops = {
     .read = fw_cfg_comb_read,
     .write = fw_cfg_comb_write,
-    .endianness = DEVICE_NATIVE_ENDIAN,
+    .endianness = DEVICE_LITTLE_ENDIAN,
     .valid.accepts = fw_cfg_comb_valid,
 };