Spaces:
Runtime error
Runtime error
| /* | |
| * A minimal implementation of virtio-mmio. Adapted from the Linux Kernel. | |
| * | |
| * Copyright (C) 2017, Red Hat Inc, Andrew Jones <drjones@redhat.com> | |
| * | |
| * This work is licensed under the terms of the GNU GPL, version 2. | |
| */ | |
| /* | |
| * The minimum queue size is 2*VIRTIO_MMIO_VRING_ALIGN, which | |
| * means the largest queue num for the minimum queue size is 128, i.e. | |
| * 2*VIRTIO_MMIO_VRING_ALIGN = vring_size(128, VIRTIO_MMIO_VRING_ALIGN), | |
| * where vring_size is | |
| * | |
| * unsigned vring_size(unsigned num, unsigned long align) | |
| * { | |
| * return ((sizeof(struct vring_desc) * num + sizeof(u16) * (3 + num) | |
| * + align - 1) & ~(align - 1)) | |
| * + sizeof(u16) * 3 + sizeof(struct vring_used_elem) * num; | |
| * } | |
| */ | |
| struct virtio_mmio_device { | |
| struct virtio_device vdev; | |
| void *base; | |
| }; | |
| extern struct virtio_device *virtio_mmio_bind(u32 devid); | |