Module Name: src Committed By: christos Date: Wed Sep 25 17:12:47 UTC 2024
Modified Files: src/sys/dev/pci: virtio_pci.c Log Message: Wrong byte order of config space write in big-endian (gorg) In virtio_pci.c, the function virtio_pci_bus_space_write_8 writes the first 4 bytes and second 4 bytes of an 8-byte value in the same or swapped order within the device's config space depending on the endianness of the system it is compiled for. However, the BUS_ADDR_LO32 and BUS_ADDR_HI32 always produce the least-significant and most-significant 4 bytes of an 8-byte value, respectively, regardless of the endianness of the system. Since virtio_pci_bus_space_write_8 is always used only for writing to little-endian parts of the config space, the least significant 4 bytes must always be written to the first 4 bytes in the config space value, and the most significant 4 bytes must always be written to the last 4 bytes of the config space value. Therefore, swapping the byte order produces incorrect behaviour on big-endian systems. The incorrect behaviour seems to have been introduced in revision 1.19 of virtio_pci.c, which this change would mostly reversed To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/pci/virtio_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.