mirror of
https://github.com/opnsense/src.git
synced 2026-05-25 02:35:01 -04:00
virtio-modern: fix PCI common read/write functions on big endian targets
Virtio modern has the common data organized in little endian, but
on powerpc64 BE it was reading and writing in the wrong endian.
Submitted by: Leonardo Bianconi <leonardo.bianconi@eldorado.org.br>
Reviewed by: bryanv, alfredo
Sponsored by: Eldorado Research Institute (eldorado.org.br)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28947
(cherry picked from commit fb53b42e36)
This commit is contained in:
parent
b3931cb0a8
commit
7e583075a4
1 changed files with 8 additions and 4 deletions
|
|
@ -1315,13 +1315,15 @@ vtpci_modern_read_common_1(struct vtpci_modern_softc *sc, bus_size_t off)
|
|||
static uint16_t
|
||||
vtpci_modern_read_common_2(struct vtpci_modern_softc *sc, bus_size_t off)
|
||||
{
|
||||
return (bus_read_2(&sc->vtpci_common_res_map.vtrm_map, off));
|
||||
return virtio_htog16(true,
|
||||
bus_read_2(&sc->vtpci_common_res_map.vtrm_map, off));
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
vtpci_modern_read_common_4(struct vtpci_modern_softc *sc, bus_size_t off)
|
||||
{
|
||||
return (bus_read_4(&sc->vtpci_common_res_map.vtrm_map, off));
|
||||
return virtio_htog32(true,
|
||||
bus_read_4(&sc->vtpci_common_res_map.vtrm_map, off));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1335,14 +1337,16 @@ static void
|
|||
vtpci_modern_write_common_2(struct vtpci_modern_softc *sc, bus_size_t off,
|
||||
uint16_t val)
|
||||
{
|
||||
bus_write_2(&sc->vtpci_common_res_map.vtrm_map, off, val);
|
||||
bus_write_2(&sc->vtpci_common_res_map.vtrm_map,
|
||||
off, virtio_gtoh16(true, val));
|
||||
}
|
||||
|
||||
static void
|
||||
vtpci_modern_write_common_4(struct vtpci_modern_softc *sc, bus_size_t off,
|
||||
uint32_t val)
|
||||
{
|
||||
bus_write_4(&sc->vtpci_common_res_map.vtrm_map, off, val);
|
||||
bus_write_4(&sc->vtpci_common_res_map.vtrm_map,
|
||||
off, virtio_gtoh32(true, val));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Reference in a new issue