1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-22 15:47:37 +00:00

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.
This commit is contained in:
Ruslan Bukin 2015-07-03 14:13:16 +00:00
parent 7ec8c789c3
commit 116b8d2b0b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285091
2 changed files with 22 additions and 0 deletions

View File

@ -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)); \

View File

@ -41,6 +41,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)
{
@ -57,6 +64,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.
#