64430f3b196d9afcc6e4806943494be3aff9fc9e
[oweals/u-boot.git] / drivers / virtio / virtio_pci_modern.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
4  *
5  * VirtIO PCI bus transport driver
6  * Ported from Linux drivers/virtio/virtio_pci*.c
7  */
8
9 #include <common.h>
10 #include <dm.h>
11 #include <log.h>
12 #include <virtio_types.h>
13 #include <virtio.h>
14 #include <virtio_ring.h>
15 #include <dm/device.h>
16 #include <linux/bug.h>
17 #include <linux/compat.h>
18 #include <linux/err.h>
19 #include <linux/io.h>
20 #include "virtio_pci.h"
21
22 #define VIRTIO_PCI_DRV_NAME     "virtio-pci.m"
23
24 /* PCI device ID in the range 0x1040 to 0x107f */
25 #define VIRTIO_PCI_VENDOR_ID    0x1af4
26 #define VIRTIO_PCI_DEVICE_ID00  0x1040
27 #define VIRTIO_PCI_DEVICE_ID01  0x1041
28 #define VIRTIO_PCI_DEVICE_ID02  0x1042
29 #define VIRTIO_PCI_DEVICE_ID03  0x1043
30 #define VIRTIO_PCI_DEVICE_ID04  0x1044
31 #define VIRTIO_PCI_DEVICE_ID05  0x1045
32 #define VIRTIO_PCI_DEVICE_ID06  0x1046
33 #define VIRTIO_PCI_DEVICE_ID07  0x1047
34 #define VIRTIO_PCI_DEVICE_ID08  0x1048
35 #define VIRTIO_PCI_DEVICE_ID09  0x1049
36 #define VIRTIO_PCI_DEVICE_ID0A  0x104a
37 #define VIRTIO_PCI_DEVICE_ID0B  0x104b
38 #define VIRTIO_PCI_DEVICE_ID0C  0x104c
39 #define VIRTIO_PCI_DEVICE_ID0D  0x104d
40 #define VIRTIO_PCI_DEVICE_ID0E  0x104e
41 #define VIRTIO_PCI_DEVICE_ID0F  0x104f
42 #define VIRTIO_PCI_DEVICE_ID10  0x1050
43 #define VIRTIO_PCI_DEVICE_ID11  0x1051
44 #define VIRTIO_PCI_DEVICE_ID12  0x1052
45 #define VIRTIO_PCI_DEVICE_ID13  0x1053
46 #define VIRTIO_PCI_DEVICE_ID14  0x1054
47 #define VIRTIO_PCI_DEVICE_ID15  0x1055
48 #define VIRTIO_PCI_DEVICE_ID16  0x1056
49 #define VIRTIO_PCI_DEVICE_ID17  0x1057
50 #define VIRTIO_PCI_DEVICE_ID18  0x1058
51 #define VIRTIO_PCI_DEVICE_ID19  0x1059
52 #define VIRTIO_PCI_DEVICE_ID1A  0x105a
53 #define VIRTIO_PCI_DEVICE_ID1B  0x105b
54 #define VIRTIO_PCI_DEVICE_ID1C  0x105c
55 #define VIRTIO_PCI_DEVICE_ID1D  0x105d
56 #define VIRTIO_PCI_DEVICE_ID1E  0x105e
57 #define VIRTIO_PCI_DEVICE_ID1F  0x105f
58 #define VIRTIO_PCI_DEVICE_ID20  0x1060
59 #define VIRTIO_PCI_DEVICE_ID21  0x1061
60 #define VIRTIO_PCI_DEVICE_ID22  0x1062
61 #define VIRTIO_PCI_DEVICE_ID23  0x1063
62 #define VIRTIO_PCI_DEVICE_ID24  0x1064
63 #define VIRTIO_PCI_DEVICE_ID25  0x1065
64 #define VIRTIO_PCI_DEVICE_ID26  0x1066
65 #define VIRTIO_PCI_DEVICE_ID27  0x1067
66 #define VIRTIO_PCI_DEVICE_ID28  0x1068
67 #define VIRTIO_PCI_DEVICE_ID29  0x1069
68 #define VIRTIO_PCI_DEVICE_ID2A  0x106a
69 #define VIRTIO_PCI_DEVICE_ID2B  0x106b
70 #define VIRTIO_PCI_DEVICE_ID2C  0x106c
71 #define VIRTIO_PCI_DEVICE_ID2D  0x106d
72 #define VIRTIO_PCI_DEVICE_ID2E  0x106e
73 #define VIRTIO_PCI_DEVICE_ID2F  0x106f
74 #define VIRTIO_PCI_DEVICE_ID30  0x1070
75 #define VIRTIO_PCI_DEVICE_ID31  0x1071
76 #define VIRTIO_PCI_DEVICE_ID32  0x1072
77 #define VIRTIO_PCI_DEVICE_ID33  0x1073
78 #define VIRTIO_PCI_DEVICE_ID34  0x1074
79 #define VIRTIO_PCI_DEVICE_ID35  0x1075
80 #define VIRTIO_PCI_DEVICE_ID36  0x1076
81 #define VIRTIO_PCI_DEVICE_ID37  0x1077
82 #define VIRTIO_PCI_DEVICE_ID38  0x1078
83 #define VIRTIO_PCI_DEVICE_ID39  0x1079
84 #define VIRTIO_PCI_DEVICE_ID3A  0x107a
85 #define VIRTIO_PCI_DEVICE_ID3B  0x107b
86 #define VIRTIO_PCI_DEVICE_ID3C  0x107c
87 #define VIRTIO_PCI_DEVICE_ID3D  0x107d
88 #define VIRTIO_PCI_DEVICE_ID3E  0x107e
89 #define VIRTIO_PCI_DEVICE_ID3F  0x107f
90
91 /**
92  * virtio pci transport driver private data
93  *
94  * @common: pci transport device common register block base
95  * @notify_base: pci transport device notify register block base
96  * @device: pci transport device device-specific register block base
97  * @device_len: pci transport device device-specific register block length
98  * @notify_offset_multiplier: multiply queue_notify_off by this value
99  */
100 struct virtio_pci_priv {
101         struct virtio_pci_common_cfg __iomem *common;
102         void __iomem *notify_base;
103         void __iomem *device;
104         u32 device_len;
105         u32 notify_offset_multiplier;
106 };
107
108 static int virtio_pci_get_config(struct udevice *udev, unsigned int offset,
109                                  void *buf, unsigned int len)
110 {
111         struct virtio_pci_priv *priv = dev_get_priv(udev);
112         u8 b;
113         __le16 w;
114         __le32 l;
115
116         WARN_ON(offset + len > priv->device_len);
117
118         switch (len) {
119         case 1:
120                 b = ioread8(priv->device + offset);
121                 memcpy(buf, &b, sizeof(b));
122                 break;
123         case 2:
124                 w = cpu_to_le16(ioread16(priv->device + offset));
125                 memcpy(buf, &w, sizeof(w));
126                 break;
127         case 4:
128                 l = cpu_to_le32(ioread32(priv->device + offset));
129                 memcpy(buf, &l, sizeof(l));
130                 break;
131         case 8:
132                 l = cpu_to_le32(ioread32(priv->device + offset));
133                 memcpy(buf, &l, sizeof(l));
134                 l = cpu_to_le32(ioread32(priv->device + offset + sizeof(l)));
135                 memcpy(buf + sizeof(l), &l, sizeof(l));
136                 break;
137         default:
138                 WARN_ON(true);
139         }
140
141         return 0;
142 }
143
144 static int virtio_pci_set_config(struct udevice *udev, unsigned int offset,
145                                  const void *buf, unsigned int len)
146 {
147         struct virtio_pci_priv *priv = dev_get_priv(udev);
148         u8 b;
149         __le16 w;
150         __le32 l;
151
152         WARN_ON(offset + len > priv->device_len);
153
154         switch (len) {
155         case 1:
156                 memcpy(&b, buf, sizeof(b));
157                 iowrite8(b, priv->device + offset);
158                 break;
159         case 2:
160                 memcpy(&w, buf, sizeof(w));
161                 iowrite16(le16_to_cpu(w), priv->device + offset);
162                 break;
163         case 4:
164                 memcpy(&l, buf, sizeof(l));
165                 iowrite32(le32_to_cpu(l), priv->device + offset);
166                 break;
167         case 8:
168                 memcpy(&l, buf, sizeof(l));
169                 iowrite32(le32_to_cpu(l), priv->device + offset);
170                 memcpy(&l, buf + sizeof(l), sizeof(l));
171                 iowrite32(le32_to_cpu(l), priv->device + offset + sizeof(l));
172                 break;
173         default:
174                 WARN_ON(true);
175         }
176
177         return 0;
178 }
179
180 static int virtio_pci_generation(struct udevice *udev, u32 *counter)
181 {
182         struct virtio_pci_priv *priv = dev_get_priv(udev);
183
184         *counter = ioread8(&priv->common->config_generation);
185
186         return 0;
187 }
188
189 static int virtio_pci_get_status(struct udevice *udev, u8 *status)
190 {
191         struct virtio_pci_priv *priv = dev_get_priv(udev);
192
193         *status = ioread8(&priv->common->device_status);
194
195         return 0;
196 }
197
198 static int virtio_pci_set_status(struct udevice *udev, u8 status)
199 {
200         struct virtio_pci_priv *priv = dev_get_priv(udev);
201
202         /* We should never be setting status to 0 */
203         WARN_ON(status == 0);
204
205         iowrite8(status, &priv->common->device_status);
206
207         return 0;
208 }
209
210 static int virtio_pci_reset(struct udevice *udev)
211 {
212         struct virtio_pci_priv *priv = dev_get_priv(udev);
213
214         /* 0 status means a reset */
215         iowrite8(0, &priv->common->device_status);
216
217         /*
218          * After writing 0 to device_status, the driver MUST wait for a read
219          * of device_status to return 0 before reinitializing the device.
220          * This will flush out the status write, and flush in device writes,
221          * including MSI-X interrupts, if any.
222          */
223         while (ioread8(&priv->common->device_status))
224                 udelay(1000);
225
226         return 0;
227 }
228
229 static int virtio_pci_get_features(struct udevice *udev, u64 *features)
230 {
231         struct virtio_pci_priv *priv = dev_get_priv(udev);
232
233         iowrite32(0, &priv->common->device_feature_select);
234         *features = ioread32(&priv->common->device_feature);
235         iowrite32(1, &priv->common->device_feature_select);
236         *features |= ((u64)ioread32(&priv->common->device_feature) << 32);
237
238         return 0;
239 }
240
241 static int virtio_pci_set_features(struct udevice *udev)
242 {
243         struct virtio_pci_priv *priv = dev_get_priv(udev);
244         struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
245
246         if (!__virtio_test_bit(udev, VIRTIO_F_VERSION_1)) {
247                 debug("virtio: device uses modern interface but does not have VIRTIO_F_VERSION_1\n");
248                 return -EINVAL;
249         }
250
251         iowrite32(0, &priv->common->guest_feature_select);
252         iowrite32((u32)uc_priv->features, &priv->common->guest_feature);
253         iowrite32(1, &priv->common->guest_feature_select);
254         iowrite32(uc_priv->features >> 32, &priv->common->guest_feature);
255
256         return 0;
257 }
258
259 static struct virtqueue *virtio_pci_setup_vq(struct udevice *udev,
260                                              unsigned int index)
261 {
262         struct virtio_pci_priv *priv = dev_get_priv(udev);
263         struct virtio_pci_common_cfg __iomem *cfg = priv->common;
264         struct virtqueue *vq;
265         u16 num;
266         u64 addr;
267         int err;
268
269         if (index >= ioread16(&cfg->num_queues))
270                 return ERR_PTR(-ENOENT);
271
272         /* Select the queue we're interested in */
273         iowrite16(index, &cfg->queue_select);
274
275         /* Check if queue is either not available or already active */
276         num = ioread16(&cfg->queue_size);
277         if (!num || ioread16(&cfg->queue_enable))
278                 return ERR_PTR(-ENOENT);
279
280         if (num & (num - 1)) {
281                 printf("(%s): bad queue size %u", udev->name, num);
282                 return ERR_PTR(-EINVAL);
283         }
284
285         /* Create the vring */
286         vq = vring_create_virtqueue(index, num, VIRTIO_PCI_VRING_ALIGN, udev);
287         if (!vq) {
288                 err = -ENOMEM;
289                 goto error_available;
290         }
291
292         /* Activate the queue */
293         iowrite16(virtqueue_get_vring_size(vq), &cfg->queue_size);
294
295         addr = virtqueue_get_desc_addr(vq);
296         iowrite32((u32)addr, &cfg->queue_desc_lo);
297         iowrite32(addr >> 32, &cfg->queue_desc_hi);
298
299         addr = virtqueue_get_avail_addr(vq);
300         iowrite32((u32)addr, &cfg->queue_avail_lo);
301         iowrite32(addr >> 32, &cfg->queue_avail_hi);
302
303         addr = virtqueue_get_used_addr(vq);
304         iowrite32((u32)addr, &cfg->queue_used_lo);
305         iowrite32(addr >> 32, &cfg->queue_used_hi);
306
307         iowrite16(1, &cfg->queue_enable);
308
309         return vq;
310
311 error_available:
312         return ERR_PTR(err);
313 }
314
315 static void virtio_pci_del_vq(struct virtqueue *vq)
316 {
317         struct virtio_pci_priv *priv = dev_get_priv(vq->vdev);
318         unsigned int index = vq->index;
319
320         iowrite16(index, &priv->common->queue_select);
321
322         /* Select and deactivate the queue */
323         iowrite16(0, &priv->common->queue_enable);
324
325         vring_del_virtqueue(vq);
326 }
327
328 static int virtio_pci_del_vqs(struct udevice *udev)
329 {
330         struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
331         struct virtqueue *vq, *n;
332
333         list_for_each_entry_safe(vq, n, &uc_priv->vqs, list)
334                 virtio_pci_del_vq(vq);
335
336         return 0;
337 }
338
339 static int virtio_pci_find_vqs(struct udevice *udev, unsigned int nvqs,
340                                struct virtqueue *vqs[])
341 {
342         int i;
343
344         for (i = 0; i < nvqs; ++i) {
345                 vqs[i] = virtio_pci_setup_vq(udev, i);
346                 if (IS_ERR(vqs[i])) {
347                         virtio_pci_del_vqs(udev);
348                         return PTR_ERR(vqs[i]);
349                 }
350         }
351
352         return 0;
353 }
354
355 static int virtio_pci_notify(struct udevice *udev, struct virtqueue *vq)
356 {
357         struct virtio_pci_priv *priv = dev_get_priv(udev);
358         u16 off;
359
360         /* Select the queue we're interested in */
361         iowrite16(vq->index, &priv->common->queue_select);
362
363         /* get offset of notification word for this vq */
364         off = ioread16(&priv->common->queue_notify_off);
365
366         /*
367          * We write the queue's selector into the notification register
368          * to signal the other end
369          */
370         iowrite16(vq->index,
371                   priv->notify_base + off * priv->notify_offset_multiplier);
372
373         return 0;
374 }
375
376 /**
377  * virtio_pci_find_capability - walk capabilities to find device info
378  *
379  * @udev:       the transport device
380  * @cfg_type:   the VIRTIO_PCI_CAP_* value we seek
381  *
382  * @return offset of the configuration structure
383  */
384 static int virtio_pci_find_capability(struct udevice *udev, u8 cfg_type)
385 {
386         int pos;
387         int offset;
388         u8 type, bar;
389
390         for (pos = dm_pci_find_capability(udev, PCI_CAP_ID_VNDR);
391              pos > 0;
392              pos = dm_pci_find_next_capability(udev, pos, PCI_CAP_ID_VNDR)) {
393                 offset = pos + offsetof(struct virtio_pci_cap, cfg_type);
394                 dm_pci_read_config8(udev, offset, &type);
395                 offset = pos + offsetof(struct virtio_pci_cap, bar);
396                 dm_pci_read_config8(udev, offset, &bar);
397
398                 /* Ignore structures with reserved BAR values */
399                 if (bar > 0x5)
400                         continue;
401
402                 if (type == cfg_type)
403                         return pos;
404         }
405
406         return 0;
407 }
408
409 /**
410  * virtio_pci_map_capability - map base address of the capability
411  *
412  * @udev:       the transport device
413  * @off:        offset of the configuration structure
414  *
415  * @return base address of the capability
416  */
417 static void __iomem *virtio_pci_map_capability(struct udevice *udev, int off)
418 {
419         u8 bar;
420         u32 offset;
421         ulong base;
422         void __iomem *p;
423
424         if (!off)
425                 return NULL;
426
427         offset = off + offsetof(struct virtio_pci_cap, bar);
428         dm_pci_read_config8(udev, offset, &bar);
429         offset = off + offsetof(struct virtio_pci_cap, offset);
430         dm_pci_read_config32(udev, offset, &offset);
431
432         /*
433          * TODO: adding 64-bit BAR support
434          *
435          * Per spec, the BAR is permitted to be either 32-bit or 64-bit.
436          * For simplicity, only read the BAR address as 32-bit.
437          */
438         base = dm_pci_read_bar32(udev, bar);
439         p = (void __iomem *)base + offset;
440
441         return p;
442 }
443
444 static int virtio_pci_bind(struct udevice *udev)
445 {
446         static int num_devs;
447         char name[20];
448
449         /* Create a unique device name  */
450         sprintf(name, "%s#%u", VIRTIO_PCI_DRV_NAME, num_devs++);
451         device_set_name(udev, name);
452
453         return 0;
454 }
455
456 static int virtio_pci_probe(struct udevice *udev)
457 {
458         struct pci_child_platdata *pplat = dev_get_parent_platdata(udev);
459         struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
460         struct virtio_pci_priv *priv = dev_get_priv(udev);
461         u16 subvendor;
462         u8 revision;
463         int common, notify, device;
464         int offset;
465
466         /* We only own devices >= 0x1040 and <= 0x107f: leave the rest. */
467         if (pplat->device < 0x1040 || pplat->device > 0x107f)
468                 return -ENODEV;
469
470         /* Transitional devices must not have a PCI revision ID of 0 */
471         dm_pci_read_config8(udev, PCI_REVISION_ID, &revision);
472
473         /* Modern devices: simply use PCI device id, but start from 0x1040. */
474         uc_priv->device = pplat->device - 0x1040;
475         dm_pci_read_config16(udev, PCI_SUBSYSTEM_VENDOR_ID, &subvendor);
476         uc_priv->vendor = subvendor;
477
478         /* Check for a common config: if not, use legacy mode (bar 0) */
479         common = virtio_pci_find_capability(udev, VIRTIO_PCI_CAP_COMMON_CFG);
480         if (!common) {
481                 printf("(%s): leaving for legacy driver\n", udev->name);
482                 return -ENODEV;
483         }
484
485         /* If common is there, notify should be too */
486         notify = virtio_pci_find_capability(udev, VIRTIO_PCI_CAP_NOTIFY_CFG);
487         if (!notify) {
488                 printf("(%s): missing capabilities %i/%i\n", udev->name,
489                        common, notify);
490                 return -EINVAL;
491         }
492
493         /*
494          * Device capability is only mandatory for devices that have
495          * device-specific configuration.
496          */
497         device = virtio_pci_find_capability(udev, VIRTIO_PCI_CAP_DEVICE_CFG);
498         if (device) {
499                 offset = notify + offsetof(struct virtio_pci_cap, length);
500                 dm_pci_read_config32(udev, offset, &priv->device_len);
501         }
502
503         /* Map configuration structures */
504         priv->common = virtio_pci_map_capability(udev, common);
505         priv->notify_base = virtio_pci_map_capability(udev, notify);
506         priv->device = virtio_pci_map_capability(udev, device);
507         debug("(%p): common @ %p, notify base @ %p, device @ %p\n",
508               udev, priv->common, priv->notify_base, priv->device);
509
510         /* Read notify_off_multiplier from config space */
511         offset = notify + offsetof(struct virtio_pci_notify_cap,
512                                    notify_off_multiplier);
513         dm_pci_read_config32(udev, offset, &priv->notify_offset_multiplier);
514
515         debug("(%s): device (%d) vendor (%08x) version (%d)\n", udev->name,
516               uc_priv->device, uc_priv->vendor, revision);
517
518         return 0;
519 }
520
521 static const struct dm_virtio_ops virtio_pci_ops = {
522         .get_config     = virtio_pci_get_config,
523         .set_config     = virtio_pci_set_config,
524         .generation     = virtio_pci_generation,
525         .get_status     = virtio_pci_get_status,
526         .set_status     = virtio_pci_set_status,
527         .reset          = virtio_pci_reset,
528         .get_features   = virtio_pci_get_features,
529         .set_features   = virtio_pci_set_features,
530         .find_vqs       = virtio_pci_find_vqs,
531         .del_vqs        = virtio_pci_del_vqs,
532         .notify         = virtio_pci_notify,
533 };
534
535 U_BOOT_DRIVER(virtio_pci_modern) = {
536         .name   = VIRTIO_PCI_DRV_NAME,
537         .id     = UCLASS_VIRTIO,
538         .ops    = &virtio_pci_ops,
539         .bind   = virtio_pci_bind,
540         .probe  = virtio_pci_probe,
541         .priv_auto_alloc_size = sizeof(struct virtio_pci_priv),
542 };
543
544 static struct pci_device_id virtio_pci_supported[] = {
545         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID00) },
546         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID01) },
547         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID02) },
548         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID03) },
549         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID04) },
550         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID05) },
551         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID06) },
552         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID07) },
553         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID08) },
554         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID09) },
555         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0A) },
556         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0B) },
557         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0C) },
558         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0D) },
559         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0E) },
560         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID0F) },
561         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID10) },
562         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID11) },
563         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID12) },
564         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID13) },
565         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID14) },
566         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID15) },
567         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID16) },
568         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID17) },
569         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID18) },
570         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID19) },
571         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1A) },
572         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1B) },
573         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1C) },
574         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1D) },
575         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1E) },
576         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID1F) },
577         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID20) },
578         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID21) },
579         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID22) },
580         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID23) },
581         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID24) },
582         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID25) },
583         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID26) },
584         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID27) },
585         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID28) },
586         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID29) },
587         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2A) },
588         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2B) },
589         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2C) },
590         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2D) },
591         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2E) },
592         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID2F) },
593         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID30) },
594         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID31) },
595         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID32) },
596         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID33) },
597         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID34) },
598         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID35) },
599         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID36) },
600         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID37) },
601         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID38) },
602         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID39) },
603         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3A) },
604         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3B) },
605         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3C) },
606         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3D) },
607         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3E) },
608         { PCI_DEVICE(VIRTIO_PCI_VENDOR_ID, VIRTIO_PCI_DEVICE_ID3F) },
609         {},
610 };
611
612 U_BOOT_PCI_DEVICE(virtio_pci_modern, virtio_pci_supported);