Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [netbsd-10] src/sys/dev/pci



Module Name:    src
Committed By:   martin
Date:           Thu Nov 28 16:33:25 UTC 2024

Modified Files:
        src/sys/dev/pci [netbsd-10]: virtio_pci.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1018):

        sys/dev/pci/virtio_pci.c: revision 1.55

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.38.4.4 -r1.38.4.5 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.




Home | Main Index | Thread Index | Old Index