Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci virtio_pci_match: add TODO about PCI Revision ID.



details:   https://anonhg.NetBSD.org/src/rev/e4a1f95cc8cf
branches:  trunk
changeset: 363511:e4a1f95cc8cf
user:      uwe <uwe%NetBSD.org@localhost>
date:      Mon Mar 14 12:22:02 2022 +0000

description:
virtio_pci_match: add TODO about PCI Revision ID.

The standard says:

  Transitional devices MUST have a PCI Revision ID of 0.

  Non-transitional devices SHOULD have a PCI Revision ID of 1 or higher.
  Drivers MUST match any PCI Revision ID value.

so we must not check the revision id for non-transitional devices.
The code in attach relies on the revision being specifically(NB!) 1 so
this calls for a revision, but I can't test this properly at the
moment, so just leave a reminder.  Comment change only.

diffstat:

 sys/dev/pci/virtio_pci.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r c604c36a9222 -r e4a1f95cc8cf sys/dev/pci/virtio_pci.c
--- a/sys/dev/pci/virtio_pci.c  Mon Mar 14 12:02:19 2022 +0000
+++ b/sys/dev/pci/virtio_pci.c  Mon Mar 14 12:22:02 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.33 2021/10/28 01:36:43 yamaguchi Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.34 2022/03/14 12:22:02 uwe Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.33 2021/10/28 01:36:43 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.34 2022/03/14 12:22:02 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -196,16 +196,23 @@
        pa = (struct pci_attach_args *)aux;
        switch (PCI_VENDOR(pa->pa_id)) {
        case PCI_VENDOR_QUMRANET:
+               /* Transitional devices MUST have a PCI Revision ID of 0. */
                if (((PCI_PRODUCT_QUMRANET_VIRTIO_1000 <=
                      PCI_PRODUCT(pa->pa_id)) &&
                     (PCI_PRODUCT(pa->pa_id) <=
                      PCI_PRODUCT_QUMRANET_VIRTIO_103F)) &&
                      PCI_REVISION(pa->pa_class) == 0)
                        return 1;
+               /*
+                * Non-transitional devices SHOULD have a PCI Revision
+                * ID of 1 or higher.  Drivers MUST match any PCI
+                * Revision ID value.
+                */
                if (((PCI_PRODUCT_QUMRANET_VIRTIO_1040 <=
                      PCI_PRODUCT(pa->pa_id)) &&
                     (PCI_PRODUCT(pa->pa_id) <=
                      PCI_PRODUCT_QUMRANET_VIRTIO_107F)) &&
+                     /* XXX: TODO */
                      PCI_REVISION(pa->pa_class) == 1)
                        return 1;
                break;



Home | Main Index | Thread Index | Old Index