]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 24 Apr 2023 16:50:53 +0000 (17:50 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 18 May 2023 18:09:59 +0000 (21:09 +0300)
commitec979ff52c1026a85595062c5e03a31a6f2fb786
tree9c5fc5d8a610d5008f87faaf4fb94f9ec2aa4f4c
parent4b02ac725a5e65a838c8a21be54d6325365b5e1f
hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields

In allwinner-sun8i-emac we just read directly from guest memory into
a host FrameDescriptor struct and back.  This only works on
little-endian hosts.  Reading and writing of descriptors is already
abstracted into functions; make those functions also handle the
byte-swapping so that TransferDescriptor structs as seen by the rest
of the code are always in host-order, and fix two places that were
doing ad-hoc descriptor reading without using the functions.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230424165053.1428857-3-peter.maydell@linaro.org
(cherry picked from commit a4ae17e5ec512862bf73e40dfbb1e7db71f2c1e7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/net/allwinner-sun8i-emac.c