// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
 *
 * VirtIO PCI bus transport driver
 * Ported from Linux drivers/virtio/virtio_pci*.c
 */

#include <dm.h>
#include <log.h>
#include <virtio_types.h>
#include <virtio.h>
#include <virtio_ring.h>
#include <dm/device.h>
#include <linux/bug.h>
#include <linux/compat.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
#include "virtio_pci.h"

#define VIRTIO_PCI_DRV_NAME	"virtio-pci.m"

/* PCI device ID in the range 0x1040 to 0x107f */
#define VIRTIO_PCI_VENDOR_ID	0x1af4
#define VIRTIO_PCI_DEVICE_ID00	0x1040
#define VIRTIO_PCI_DEVICE_ID01	0x1041
#define VIRTIO_PCI_DEVICE_ID02	0x1042
#define VIRTIO_PCI_DEVICE_ID03	0x1043
#define VIRTIO_PCI_DEVICE_ID04	0x1044
#define VIRTIO_PCI_DEVICE_ID05	0x1045
#define VIRTIO_PCI_DEVICE_ID06	0x1046
#define VIRTIO_PCI_DEVICE_ID07	0x1047
#define VIRTIO_PCI_DEVICE_ID08	0x1048
#define VIRTIO_PCI_DEVICE_ID09	0x1049
#define VIRTIO_PCI_DEVICE_ID0A	0x104a
#define VIRTIO_PCI_DEVICE_ID0B	0x104b
#define VIRTIO_PCI_DEVICE_ID0C	0x104c
#define VIRTIO_PCI_DEVICE_ID0D	0x104d
#define VIRTIO_PCI_DEVICE_ID0E	0x104e
#define VIRTIO_PCI_DEVICE_ID0F	0x104f
#define VIRTIO_PCI_DEVICE_ID10	0x1050
#define VIRTIO_PCI_DEVICE_ID11	0x1051
#define VIRTIO_PCI_DEVICE_ID12	0x1052
#define VIRTIO_PCI_DEVICE_ID13	0x1053
#define VIRTIO_PCI_DEVICE_ID14	0x1054
#define VIRTIO_PCI_DEVICE_ID15	0x1055
#define VIRTIO_PCI_DEVICE_ID16	0x1056
#define VIRTIO_PCI_DEVICE_ID17	0x1057
#define VIRTIO_PCI_DEVICE_ID18	0x1058
#define VIRTIO_PCI_DEVICE_ID19	0x1059
#define VIRTIO_PCI_DEVICE_ID1A	0x105a
#define VIRTIO_PCI_DEVICE_ID1B	0x105b
#define VIRTIO_PCI_DEVICE_ID1C	0x105c
#define VIRTIO_PCI_DEVICE_ID1D	0x105d
#define VIRTIO_PCI_DEVICE_ID1E	0x105e
#define VIRTIO_PCI_DEVICE_ID1F	0x105f
#define VIRTIO_PCI_DEVICE_ID20	0x1060
#define VIRTIO_PCI_DEVICE_ID21	0x1061
#define VIRTIO_PCI_DEVICE_ID22	0x1062
#define VIRTIO_PCI_DEVICE_ID23	0x1063
#define VIRTIO_PCI_DEVICE_ID24	0x1064
#define VIRTIO_PCI_DEVICE_ID25	0x1065
#define VIRTIO_PCI_DEVICE_ID26	0x1066
#define VIRTIO_PCI_DEVICE_ID27	0x1067
#define VIRTIO_PCI_DEVICE_ID28	0x1068
#define VIRTIO_PCI_DEVICE_ID29	0x1069
#define VIRTIO_PCI_DEVICE_ID2A	0x106a
#define VIRTIO_PCI_DEVICE_ID2B	0x106b
#define VIRTIO_PCI_DEVICE_ID2C	0x106c
#define VIRTIO_PCI_DEVICE_ID2D	0x106d
#define VIRTIO_PCI_DEVICE_ID2E	0x106e
#define VIRTIO_PCI_DEVICE_ID2F	0x106f
#define VIRTIO_PCI_DEVICE_ID30	0x1070
#define VIRTIO_PCI_DEVICE_ID31	0x1071
#define VIRTIO_PCI_DEVICE_ID32	0x1072
#define VIRTIO_PCI_DEVICE_ID33	0x1073
#define VIRTIO_PCI_DEVICE_ID34	0x1074
#define VIRTIO_PCI_DEVICE_ID35	0x1075
#define VIRTIO_PCI_DEVICE_ID36	0x1076
#define VIRTIO_PCI_DEVICE_ID37	0x1077
#define VIRTIO_PCI_DEVICE_ID38	0x1078
#define VIRTIO_PCI_DEVICE_ID39	0x1079
#define VIRTIO_PCI_DEVICE_ID3A	0x107a
#define VIRTIO_PCI_DEVICE_ID3B	0x107b
#define VIRTIO_PCI_DEVICE_ID3C	0x107c
#define VIRTIO_PCI_DEVICE_ID3D	0x107d
#define VIRTIO_PCI_DEVICE_ID3E	0x107e
#define VIRTIO_PCI_DEVICE_ID3F	0x107f

/**
 * virtio pci transport driver private data
 *
 * @common: pci transport device common register block base
 * @notify_base: pci transport device notify register block base
 * @notify_len: pci transport device notify register block length
 * @device: pci transport device device-specific register block base
 * @device_len: pci transport device device-specific register block length
 * @notify_offset_multiplier: multiply queue_notify_off by this value
 */
struct virtio_pci_priv {
	struct virtio_pci_common_cfg __iomem *common;
	void __iomem *notify_base;
	u32 notify_len;
	void __iomem *device;
	u32 device_len;
	u32 notify_offset_multiplier;
};

static int virtio_pci_get_config(struct udevice *udev, unsigned int offset,
				 void *buf, unsigned int len)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);
	u8 b;
	__le16 w;
	__le32 l;

	if (!priv->device)
		return -ENOSYS;

	if (offset + len > priv->device_len)
		return -EINVAL;

	switch (len) {
	case 1:
		b = ioread8(priv->device + offset);
		memcpy(buf, &b, sizeof(b));
		break;
	case 2:
		w = cpu_to_le16(ioread16(priv->device + offset));
		memcpy(buf, &w, sizeof(w));
		break;
	case 4:
		l = cpu_to_le32(ioread32(priv->device + offset));
		memcpy(buf, &l, sizeof(l));
		break;
	case 8:
		l = cpu_to_le32(ioread32(priv->device + offset));
		memcpy(buf, &l, sizeof(l));
		l = cpu_to_le32(ioread32(priv->device + offset + sizeof(l)));
		memcpy(buf + sizeof(l), &l, sizeof(l));
		break;
	default:
		return -EINVAL;
	}

	return 0;
}

static int virtio_pci_set_config(struct udevice *udev, unsigned int offset,
				 const void *buf, unsigned int len)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);
	u8 b;
	__le16 w;
	__le32 l;

	if (!priv->device)
		return -ENOSYS;

	if (offset + len > priv->device_len)
		return -EINVAL;

	switch (len) {
	case 1:
		memcpy(&b, buf, sizeof(b));
		iowrite8(b, priv->device + offset);
		break;
	case 2:
		memcpy(&w, buf, sizeof(w));
		iowrite16(le16_to_cpu(w), priv->device + offset);
		break;
	case 4:
		memcpy(&l, buf, sizeof(l));
		iowrite32(le32_to_cpu(l), priv->device + offset);
		break;
	case 8:
		memcpy(&l, buf, sizeof(l));
		iowrite32(le32_to_cpu(l), priv->device + offset);
		memcpy(&l, buf + sizeof(l), sizeof(l));
		iowrite32(le32_to_cpu(l), priv->device + offset + sizeof(l));
		break;
	default:
		return -EINVAL;
	}

	return 0;
}

static int virtio_pci_generation(struct udevice *udev, u32 *counter)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);

	*counter = ioread8(&priv->common->config_generation);

	return 0;
}

static int virtio_pci_get_status(struct udevice *udev, u8 *status)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);

	*status = ioread8(&priv->common->device_status);

	return 0;
}

static int virtio_pci_set_status(struct udevice *udev, u8 status)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);

	/* We should never be setting status to 0 */
	WARN_ON(status == 0);

	iowrite8(status, &priv->common->device_status);

	return 0;
}

static int virtio_pci_get_features(struct udevice *udev, u64 *features)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);

	iowrite32(0, &priv->common->device_feature_select);
	*features = ioread32(&priv->common->device_feature);
	iowrite32(1, &priv->common->device_feature_select);
	*features |= ((u64)ioread32(&priv->common->device_feature) << 32);

	return 0;
}

static int virtio_pci_set_features(struct udevice *udev)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);
	struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);

	if (!__virtio_test_bit(udev, VIRTIO_F_VERSION_1)) {
		debug("virtio: device uses modern interface but does not have VIRTIO_F_VERSION_1\n");
		return -EINVAL;
	}

	iowrite32(0, &priv->common->guest_feature_select);
	iowrite32((u32)uc_priv->features, &priv->common->guest_feature);
	iowrite32(1, &priv->common->guest_feature_select);
	iowrite32(uc_priv->features >> 32, &priv->common->guest_feature);

	return 0;
}

static struct virtqueue *virtio_pci_setup_vq(struct udevice *udev,
					     unsigned int index)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);
	struct virtio_pci_common_cfg __iomem *cfg = priv->common;
	struct virtqueue *vq;
	u16 num;
	u64 addr;
	int err;

	if (index >= ioread16(&cfg->num_queues))
		return ERR_PTR(-ENOENT);

	/* Select the queue we're interested in */
	iowrite16(index, &cfg->queue_select);

	/* Check if queue is either not available or already active */
	num = ioread16(&cfg->queue_size);
	if (!num || ioread16(&cfg->queue_enable))
		return ERR_PTR(-ENOENT);

	if (num & (num - 1)) {
		printf("(%s): bad queue size %u", udev->name, num);
		return ERR_PTR(-EINVAL);
	}

	/* Create the vring */
	vq = vring_create_virtqueue(index, num, VIRTIO_PCI_VRING_ALIGN, udev);
	if (!vq) {
		err = -ENOMEM;
		goto error_available;
	}

	/* Activate the queue */
	iowrite16(virtqueue_get_vring_size(vq), &cfg->queue_size);

	addr = virtqueue_get_desc_addr(vq);
	iowrite32((u32)addr, &cfg->queue_desc_lo);
	iowrite32(addr >> 32, &cfg->queue_desc_hi);

	addr = virtqueue_get_avail_addr(vq);
	iowrite32((u32)addr, &cfg->queue_avail_lo);
	iowrite32(addr >> 32, &cfg->queue_avail_hi);

	addr = virtqueue_get_used_addr(vq);
	iowrite32((u32)addr, &cfg->queue_used_lo);
	iowrite32(addr >> 32, &cfg->queue_used_hi);

	iowrite16(1, &cfg->queue_enable);

	return vq;

error_available:
	return ERR_PTR(err);
}

static void virtio_pci_del_vq(struct virtqueue *vq)
{
	struct virtio_pci_priv *priv = dev_get_priv(vq->vdev);
	unsigned int index = vq->index;

	iowrite16(index, &priv->common->queue_select);

	/* Select and deactivate the queue */
	iowrite16(0, &priv->common->queue_enable);

	vring_del_virtqueue(vq);
}

static int virtio_pci_del_vqs(struct udevice *udev)
{
	struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
	struct virtqueue *vq, *n;

	list_for_each_entry_safe(vq, n, &uc_priv->vqs, list)
		virtio_pci_del_vq(vq);

	return 0;
}

static int virtio_pci_find_vqs(struct udevice *udev, unsigned int nvqs,
			       struct virtqueue *vqs[])
{
	int i;

	for (i = 0; i < nvqs; ++i) {
		vqs[i] = virtio_pci_setup_vq(udev, i);
		if (IS_ERR(vqs[i])) {
			virtio_pci_del_vqs(udev);
			return PTR_ERR(vqs[i]);
		}
	}

	return 0;
}

static int virtio_pci_reset(struct udevice *udev)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);

	/* 0 status means a reset */
	iowrite8(0, &priv->common->device_status);

	/*
	 * After writing 0 to device_status, the driver MUST wait for a read
	 * of device_status to return 0 before reinitializing the device.
	 * This will flush out the status write, and flush in device writes,
	 * including MSI-X interrupts, if any.
	 */
	while (ioread8(&priv->common->device_status))
		udelay(1000);

	return virtio_pci_del_vqs(udev);
}

static int virtio_pci_notify(struct udevice *udev, struct virtqueue *vq)
{
	struct virtio_pci_priv *priv = dev_get_priv(udev);
	u16 off;

	/* Select the queue we're interested in */
	iowrite16(vq->index, &priv->common->queue_select);

	/* get offset of notification word for this vq */
	off = ioread16(&priv->common->queue_notify_off);

	/*
	 * Check the effective offset is in bounds and leaves space for the
	 * notification, which is just a single 16-bit value since
	 * VIRTIO_F_NOTIFICATION_DATA isn't negotiated by the drivers.
	 */
	off *= priv->notify_offset_multiplier;
	if (off > priv->notify_len - sizeof(u16))
		return -EIO;

	/*
	 * We write the queue's selector into the notification register
	 * to signal the other end
	 */
	iowrite16(vq->index, priv->notify_base + off);

	return 0;
}

/**
 * virtio_pci_find_capability - walk capabilities to find device info
 *
 * @udev:	the transport device
 * @cfg_type:	the VIRTIO_PCI_CAP_* value we seek
 * @cap_size:	expected size of the capability
 * @cap:	capability read from the config space
 *
 * Return: offset of the configuration structure
 */
static int virtio_pci_find_capability(struct udevice *udev, u8 cfg_type,
				      size_t cap_size,
				      struct virtio_pci_cap *cap)
{
	int pos;
	int offset;

	assert(cap_size >= sizeof(struct virtio_pci_cap));
	assert(cap_size <= PCI_CFG_SPACE_SIZE);

	if (!cap)
		return 0;

	for (pos = dm_pci_find_capability(udev, PCI_CAP_ID_VNDR);
	     pos > 0;
	     pos = dm_pci_find_next_capability(udev, pos, PCI_CAP_ID_VNDR)) {
		/* Ensure the capability is within bounds */
		if (PCI_CFG_SPACE_SIZE - cap_size < pos)
			return 0;

		offset = pos + offsetof(struct virtio_pci_cap, cap_vndr);
		dm_pci_read_config8(udev, offset, &cap->cap_vndr);
		offset = pos + offsetof(struct virtio_pci_cap, cap_next);
		dm_pci_read_config8(udev, offset, &cap->cap_next);
		offset = pos + offsetof(struct virtio_pci_cap, cap_len);
		dm_pci_read_config8(udev, offset, &cap->cap_len);
		offset = pos + offsetof(struct virtio_pci_cap, cfg_type);
		dm_pci_read_config8(udev, offset, &cap->cfg_type);
		offset = pos + offsetof(struct virtio_pci_cap, bar);
		dm_pci_read_config8(udev, offset, &cap->bar);
		offset = pos + offsetof(struct virtio_pci_cap, offset);
		dm_pci_read_config32(udev, offset, &cap->offset);
		offset = pos + offsetof(struct virtio_pci_cap, length);
		dm_pci_read_config32(udev, offset, &cap->length);

		/* Ignore structures with reserved BAR values */
		if (cap->bar > 0x5)
			continue;

		if (cap->cfg_type == cfg_type)
			return pos;
	}

	return 0;
}

/**
 * virtio_pci_map_capability - map base address of the capability
 *
 * @udev:	the transport device
 * @cap:	capability to map
 *
 * Return: base address of the capability
 */
static void __iomem *virtio_pci_map_capability(struct udevice *udev,
					       const struct virtio_pci_cap *cap)
{
	/*
	 * Find the corresponding memory region that isn't system memory but is
	 * writable.
	 */
	unsigned long mask =
			PCI_REGION_TYPE | PCI_REGION_SYS_MEMORY | PCI_REGION_RO;
	unsigned long flags = PCI_REGION_MEM;
	u8 *p = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0 + 4 * cap->bar, cap->offset,
			       cap->length, mask, flags);

	return (void __iomem *)p;
}

static int virtio_pci_bind(struct udevice *udev)
{
	static int num_devs;
	char name[20];

	/* Create a unique device name  */
	sprintf(name, "%s#%u", VIRTIO_PCI_DRV_NAME, num_devs++);
	device_set_name(udev, name);

	return 0;
}

static int virtio_pci_probe(struct udevice *udev)
{
	struct pci_child_plat *pplat = dev_get_parent_plat(udev);
	struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
	struct virtio_pci_priv *priv = dev_get_priv(udev);
	u16 subvendor;
	u8 revision;
	int common, notify, device;
	struct virtio_pci_cap common_cap, notify_cap, device_cap;
	int offset;

	/* We only own devices >= 0x1040 and <= 0x107f: leave the rest. */
	if (pplat->device < 0x1040 || pplat->device > 0x107f)
		return -ENODEV;

	/* Transitional devices must not have a PCI revision ID of 0 */
	dm_pci_read_config8(udev, PCI_REVISION_ID, &revision);

	/* Modern devices: simply use PCI device id, but start from 0x1040. */
	uc_priv->device = pplat->device - 0x1040;
	dm_pci_read_config16(udev, PCI_SUBSYSTEM_VENDOR_ID, &subvendor);
	uc_priv->vendor = subvendor;

	/* Check for a common config: if not, use legacy mode (bar 0) */
	common = virtio_pci_find_capability(udev, VIRTIO_PCI_CAP_COMMON_CFG,
					    sizeof(struct virtio_pci_cap),
					    &common_cap);
	if (!common) {
		printf("(%s): leaving for legacy driver\n", udev->name);
		return -ENODEV;
	}

	if (common_cap.length < sizeof(struct virtio_pci_common_cfg)) {
		printf("(%s): virtio common config too small\n", udev->name);
		return -EINVAL;
	}

	/* If common is there, notify should be too */
	notify = virtio_pci_find_capability(udev, VIRTIO_PCI_CAP_NOTIFY_CFG,
					    sizeof(struct virtio_pci_notify_cap),
					    &notify_cap);
	if (!notify) {
		printf("(%s): missing capabilities %i/%i\n", udev->name,
		       common, notify);
		return -EINVAL;
	}

	/* Map configuration structures */
	priv->common = virtio_pci_map_capability(udev, &common_cap);
	if (!priv->common) {
		printf("(%s): could not map common config\n", udev->name);
		return -EINVAL;
	}

	priv->notify_len = notify_cap.length;
	priv->notify_base = virtio_pci_map_capability(udev, &notify_cap);
	if (!priv->notify_base) {
		printf("(%s): could not map notify config\n", udev->name);
		return -EINVAL;
	}

	/*
	 * Device capability is only mandatory for devices that have
	 * device-specific configuration.
	 */
	device = virtio_pci_find_capability(udev, VIRTIO_PCI_CAP_DEVICE_CFG,
					    sizeof(struct virtio_pci_cap),
					    &device_cap);
	if (device) {
		priv->device_len = device_cap.length;
		priv->device = virtio_pci_map_capability(udev, &device_cap);
		if (!priv->device) {
			printf("(%s): could not map device config\n",
			       udev->name);
			return -EINVAL;
		}
	}

	debug("(%p): common @ %p, notify base @ %p, device @ %p\n",
	      udev, priv->common, priv->notify_base, priv->device);

	/* Read notify_off_multiplier from config space */
	offset = notify + offsetof(struct virtio_pci_notify_cap,
				   notify_off_multiplier);
	dm_pci_read_config32(udev, offset, &priv->notify_offset_multiplier);

	debug("(%s): device (%d) vendor (%08x) version (%d)\n", udev->name,
	      uc_priv->device, uc_priv->vendor, revision);

	return 0;
}

static const struct dm_virtio_ops virtio_pci_ops = {
	.get_config	= virtio_pci_get_config,
	.set_config	= virtio_pci_set_config,
	.generation	= virtio_pci_generation,
	.get_status	= virtio_pci_get_status,
	.set_status	= virtio_pci_set_status,
	.reset		= virtio_pci_reset,
	.get_features	= virtio_pci_get_features,
	.set_features	= virtio_pci_set_features,
	.find_vqs	= virtio_pci_find_vqs,
	.del_vqs	= virtio_pci_del_vqs,
	.notify		= virtio_pci_notify,
};

U_BOOT_DRIVER(virtio_pci_modern) = {
	.name	= VIRTIO_PCI_DRV_NAME,
	.id	= UCLASS_VIRTIO,
	.ops	= &virtio_pci_ops,
	.bind	= virtio_pci_bind,
	.probe	= virtio_pci_probe,
	.priv_auto	= sizeof(struct virtio_pci_priv),
};

static struct pci_device_id virtio_pci_supported[] = {
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID00) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID01) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID02) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID03) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID04) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID05) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID06) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID07) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID08) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID09) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0A) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0B) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0C) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0D) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0E) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0F) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID10) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID11) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID12) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID13) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID14) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID15) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID16) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID17) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID18) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID19) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1A) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1B) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1C) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1D) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1E) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1F) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID20) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID21) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID22) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID23) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID24) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID25) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID26) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID27) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID28) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID29) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2A) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2B) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2C) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2D) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2E) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2F) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID30) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID31) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID32) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID33) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID34) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID35) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID36) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID37) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID38) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID39) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3A) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3B) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3C) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3D) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3E) },
	{ PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3F) },
	{},
};

U_BOOT_PCI_DEVICE(virtio_pci_modern, virtio_pci_supported);
