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:
parent
7ec8c789c3
commit
116b8d2b0b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285091
@ -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)); \
|
||||
|
@ -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.
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user