Date: Fri, 3 Jul 2015 14:13:17 +0000 (UTC) From: Ruslan Bukin <br@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285091 - head/sys/dev/virtio/mmio Message-ID: <201507031413.t63EDH4S039047@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507031413.t63EDH4S039047>