Module Name: src Committed By: uwe Date: Mon Mar 14 12:22:02 UTC 2022
Modified Files: src/sys/dev/pci: virtio_pci.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/virtio_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/virtio_pci.c diff -u src/sys/dev/pci/virtio_pci.c:1.33 src/sys/dev/pci/virtio_pci.c:1.34 --- src/sys/dev/pci/virtio_pci.c:1.33 Thu Oct 28 01:36:43 2021 +++ src/sys/dev/pci/virtio_pci.c Mon Mar 14 12:22:02 2022 @@ -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 @@ virtio_pci_match(device_t parent, cfdata 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;