svn commit: r285091 - head/sys/dev/virtio/mmio
Ruslan Bukin
br at FreeBSD.org
Fri Jul 3 14:13:18 UTC 2015
Author: br
Date: Fri Jul 3 14:13:16 2015
New Revision: 285091
URL: https://svnweb.freebsd.org/changeset/base/285091
Log:
Add 'prewrite' method allowing us to run some platform-specific
code before each write happens, e.g. write-back caches.
This will help booting in Bluespec simulator of CHERI processor.
Modified:
head/sys/dev/virtio/mmio/virtio_mmio.c
head/sys/dev/virtio/mmio/virtio_mmio_if.m
Modified: head/sys/dev/virtio/mmio/virtio_mmio.c
==============================================================================
--- head/sys/dev/virtio/mmio/virtio_mmio.c Fri Jul 3 14:11:01 2015 (r285090)
+++ head/sys/dev/virtio/mmio/virtio_mmio.c Fri Jul 3 14:13:16 2015 (r285091)
@@ -138,18 +138,24 @@ static void vtmmio_vq_intr(void *);
*/
#define vtmmio_write_config_1(sc, o, v) \
do { \
+ if (sc->platform != NULL) \
+ VIRTIO_MMIO_PREWRITE(sc->platform, (o), (v)); \
bus_write_1((sc)->res[0], (o), (v)); \
if (sc->platform != NULL) \
VIRTIO_MMIO_NOTE(sc->platform, (o), (v)); \
} while (0)
#define vtmmio_write_config_2(sc, o, v) \
do { \
+ if (sc->platform != NULL) \
+ VIRTIO_MMIO_PREWRITE(sc->platform, (o), (v)); \
bus_write_2((sc)->res[0], (o), (v)); \
if (sc->platform != NULL) \
VIRTIO_MMIO_NOTE(sc->platform, (o), (v)); \
} while (0)
#define vtmmio_write_config_4(sc, o, v) \
do { \
+ if (sc->platform != NULL) \
+ VIRTIO_MMIO_PREWRITE(sc->platform, (o), (v)); \
bus_write_4((sc)->res[0], (o), (v)); \
if (sc->platform != NULL) \
VIRTIO_MMIO_NOTE(sc->platform, (o), (v)); \
Modified: head/sys/dev/virtio/mmio/virtio_mmio_if.m
==============================================================================
--- head/sys/dev/virtio/mmio/virtio_mmio_if.m Fri Jul 3 14:11:01 2015 (r285090)
+++ head/sys/dev/virtio/mmio/virtio_mmio_if.m Fri Jul 3 14:13:16 2015 (r285091)
@@ -42,6 +42,13 @@ INTERFACE virtio_mmio;
CODE {
static int
+ virtio_mmio_prewrite(device_t dev, size_t offset, int val)
+ {
+
+ return (1);
+ }
+
+ static int
virtio_mmio_note(device_t dev, size_t offset, int val)
{
@@ -58,6 +65,15 @@ CODE {
};
#
+# Inform backend we are going to write data at offset.
+#
+METHOD int prewrite {
+ device_t dev;
+ size_t offset;
+ int val;
+} DEFAULT virtio_mmio_prewrite;
+
+#
# Inform backend we have data wrotten to offset.
#
METHOD int note {
More information about the svn-src-head
mailing list