virtio: Export a few things from virtio_mmio.c
Add a header file to allow other drivers to implement MMIO and share the code. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
19
drivers/virtio/virtio_internal.h
Normal file
19
drivers/virtio/virtio_internal.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Internal header file for virtio
|
||||
*
|
||||
* Copyright 2025 Simon Glass <sjg@chromium.org>
|
||||
*/
|
||||
|
||||
#ifndef _VIRTIO_INTERNAL_H
|
||||
#define _VIRTIO_INTERNAL_H
|
||||
|
||||
struct udevice;
|
||||
|
||||
/* MMIO operations from virtio_mmcio.c */
|
||||
extern const struct dm_virtio_ops virtio_mmio_ops;
|
||||
|
||||
/* exported probe function from virtio_mmcio.c */
|
||||
int virtio_mmio_probe(struct udevice *udev);
|
||||
|
||||
#endif
|
||||
@@ -344,13 +344,14 @@ static int virtio_mmio_of_to_plat(struct udevice *udev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int virtio_mmio_probe(struct udevice *udev)
|
||||
int virtio_mmio_probe(struct udevice *udev)
|
||||
{
|
||||
struct virtio_mmio_priv *priv = dev_get_priv(udev);
|
||||
struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
|
||||
u32 magic;
|
||||
|
||||
/* Check magic value */
|
||||
log_debug("probe %p\n", priv->base);
|
||||
magic = readl(priv->base + VIRTIO_MMIO_MAGIC_VALUE);
|
||||
if (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) {
|
||||
debug("(%s): wrong magic value 0x%08x!\n", udev->name, magic);
|
||||
@@ -379,13 +380,13 @@ static int virtio_mmio_probe(struct udevice *udev)
|
||||
if (priv->version == 1)
|
||||
writel(PAGE_SIZE, priv->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
|
||||
|
||||
debug("(%s): device (%d) vendor (%08x) version (%d)\n", udev->name,
|
||||
debug("(%s): device (%04x) vendor (%04x) version (%d)\n", udev->name,
|
||||
uc_priv->device, uc_priv->vendor, priv->version);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dm_virtio_ops virtio_mmio_ops = {
|
||||
const struct dm_virtio_ops virtio_mmio_ops = {
|
||||
.get_config = virtio_mmio_get_config,
|
||||
.set_config = virtio_mmio_set_config,
|
||||
.generation = virtio_mmio_generation,
|
||||
|
||||
Reference in New Issue
Block a user