virtio: make the write_config buffer argument const
No functional change intended, but noticed that we could add const here while adding linuxkpi support for virtio. Reviewed By: bryanv, imp Differential Revision: https://reviews.freebsd.org/D32370
This commit is contained in:
parent
d98f2712c7
commit
6c4f95161d
@ -88,7 +88,7 @@ static void vtmmio_notify_virtqueue(device_t, uint16_t, bus_size_t);
|
||||
static uint8_t vtmmio_get_status(device_t);
|
||||
static void vtmmio_set_status(device_t, uint8_t);
|
||||
static void vtmmio_read_dev_config(device_t, bus_size_t, void *, int);
|
||||
static void vtmmio_write_dev_config(device_t, bus_size_t, void *, int);
|
||||
static void vtmmio_write_dev_config(device_t, bus_size_t, const void *, int);
|
||||
static void vtmmio_describe_features(struct vtmmio_softc *, const char *,
|
||||
uint64_t);
|
||||
static void vtmmio_probe_and_attach_child(struct vtmmio_softc *);
|
||||
@ -737,7 +737,7 @@ vtmmio_read_dev_config(device_t dev, bus_size_t offset,
|
||||
|
||||
static void
|
||||
vtmmio_write_dev_config(device_t dev, bus_size_t offset,
|
||||
void *src, int length)
|
||||
const void *src, int length)
|
||||
{
|
||||
struct vtmmio_softc *sc;
|
||||
bus_size_t off;
|
||||
@ -755,21 +755,21 @@ vtmmio_write_dev_config(device_t dev, bus_size_t offset,
|
||||
if (sc->vtmmio_version > 1) {
|
||||
switch (length) {
|
||||
case 1:
|
||||
vtmmio_write_config_1(sc, off, *(uint8_t *)src);
|
||||
vtmmio_write_config_1(sc, off, *(const uint8_t *)src);
|
||||
break;
|
||||
case 2:
|
||||
vtmmio_write_config_2(sc, off,
|
||||
htole16(*(uint16_t *)src));
|
||||
htole16(*(const uint16_t *)src));
|
||||
break;
|
||||
case 4:
|
||||
vtmmio_write_config_4(sc, off,
|
||||
htole32(*(uint32_t *)src));
|
||||
htole32(*(const uint32_t *)src));
|
||||
break;
|
||||
case 8:
|
||||
vtmmio_write_config_4(sc, off,
|
||||
htole32(*(uint64_t *)src));
|
||||
htole32(*(const uint64_t *)src));
|
||||
vtmmio_write_config_4(sc, off + 4,
|
||||
htole32((*(uint64_t *)src) >> 32));
|
||||
htole32((*(const uint64_t *)src) >> 32));
|
||||
break;
|
||||
default:
|
||||
panic("%s: invalid length %d\n", __func__, length);
|
||||
|
@ -97,7 +97,7 @@ static int vtpci_legacy_reinit(device_t, uint64_t);
|
||||
static void vtpci_legacy_reinit_complete(device_t);
|
||||
static void vtpci_legacy_notify_vq(device_t, uint16_t, bus_size_t);
|
||||
static void vtpci_legacy_read_dev_config(device_t, bus_size_t, void *, int);
|
||||
static void vtpci_legacy_write_dev_config(device_t, bus_size_t, void *, int);
|
||||
static void vtpci_legacy_write_dev_config(device_t, bus_size_t, const void *, int);
|
||||
|
||||
static bool vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc);
|
||||
static void vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc);
|
||||
@ -519,11 +519,11 @@ vtpci_legacy_read_dev_config(device_t dev, bus_size_t offset,
|
||||
|
||||
static void
|
||||
vtpci_legacy_write_dev_config(device_t dev, bus_size_t offset,
|
||||
void *src, int length)
|
||||
const void *src, int length)
|
||||
{
|
||||
struct vtpci_legacy_softc *sc;
|
||||
bus_size_t off;
|
||||
uint8_t *s;
|
||||
const uint8_t *s;
|
||||
int i;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
@ -123,7 +123,7 @@ static void vtpci_modern_reinit_complete(device_t);
|
||||
static void vtpci_modern_notify_vq(device_t, uint16_t, bus_size_t);
|
||||
static int vtpci_modern_config_generation(device_t);
|
||||
static void vtpci_modern_read_dev_config(device_t, bus_size_t, void *, int);
|
||||
static void vtpci_modern_write_dev_config(device_t, bus_size_t, void *, int);
|
||||
static void vtpci_modern_write_dev_config(device_t, bus_size_t, const void *, int);
|
||||
|
||||
static int vtpci_modern_probe_configs(device_t);
|
||||
static int vtpci_modern_find_cap(device_t, uint8_t, int *);
|
||||
@ -686,7 +686,7 @@ vtpci_modern_read_dev_config(device_t dev, bus_size_t offset, void *dst,
|
||||
}
|
||||
|
||||
static void
|
||||
vtpci_modern_write_dev_config(device_t dev, bus_size_t offset, void *src,
|
||||
vtpci_modern_write_dev_config(device_t dev, bus_size_t offset, const void *src,
|
||||
int length)
|
||||
{
|
||||
struct vtpci_modern_softc *sc;
|
||||
@ -700,20 +700,20 @@ vtpci_modern_write_dev_config(device_t dev, bus_size_t offset, void *src,
|
||||
|
||||
switch (length) {
|
||||
case 1:
|
||||
vtpci_modern_write_device_1(sc, offset, *(uint8_t *) src);
|
||||
vtpci_modern_write_device_1(sc, offset, *(const uint8_t *) src);
|
||||
break;
|
||||
case 2: {
|
||||
uint16_t val = virtio_gtoh16(true, *(uint16_t *) src);
|
||||
uint16_t val = virtio_gtoh16(true, *(const uint16_t *) src);
|
||||
vtpci_modern_write_device_2(sc, offset, val);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
uint32_t val = virtio_gtoh32(true, *(uint32_t *) src);
|
||||
uint32_t val = virtio_gtoh32(true, *(const uint32_t *) src);
|
||||
vtpci_modern_write_device_4(sc, offset, val);
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
uint64_t val = virtio_gtoh64(true, *(uint64_t *) src);
|
||||
uint64_t val = virtio_gtoh64(true, *(const uint64_t *) src);
|
||||
vtpci_modern_write_device_8(sc, offset, val);
|
||||
break;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ virtio_read_device_config(device_t dev, bus_size_t offset, void *dst, int len)
|
||||
}
|
||||
|
||||
void
|
||||
virtio_write_device_config(device_t dev, bus_size_t offset, void *dst, int len)
|
||||
virtio_write_device_config(device_t dev, bus_size_t offset, const void *dst, int len)
|
||||
{
|
||||
|
||||
VIRTIO_BUS_WRITE_DEVICE_CONFIG(device_get_parent(dev),
|
||||
|
@ -123,7 +123,7 @@ int virtio_child_pnpinfo(device_t busdev, device_t child, struct sbuf *sb);
|
||||
void virtio_read_device_config(device_t dev, bus_size_t offset,
|
||||
void *dst, int length);
|
||||
void virtio_write_device_config(device_t dev, bus_size_t offset,
|
||||
void *src, int length);
|
||||
const void *src, int length);
|
||||
|
||||
/* Inlined device specific read/write functions for common lengths. */
|
||||
#define VIRTIO_RDWR_DEVICE_CONFIG(size, type) \
|
||||
|
@ -107,7 +107,7 @@ METHOD void read_device_config {
|
||||
METHOD void write_device_config {
|
||||
device_t dev;
|
||||
bus_size_t offset;
|
||||
void *src;
|
||||
const void *src;
|
||||
int len;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user