git: 8558dd61e674 - main - linuxkpi: add pci_is_vga()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Oct 2026 19:56:03 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=8558dd61e6747fef424ef924b19f4095072fc2f3
commit 8558dd61e6747fef424ef924b19f4095072fc2f3
Author: Denis Borovikov <denis.borovikov@gmail.com>
AuthorDate: 2026-10-17 19:55:17 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-10-17 19:55:17 +0000
linuxkpi: add pci_is_vga()
Returns true for a VGA-compatible display controller and for the
pre-PCI 2.0 VGA class (base 0x00, subclass 0x01), as Linux's
pci_is_vga() does. Used by drm/virtio to decide whether to remove
the firmware framebuffer on virtio-vga.
Signed-off-by: Denis Borovikov <denis.borovikov@gmail.com>
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D60200
---
sys/compat/linuxkpi/common/include/linux/pci.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index b46bb99612c8..a68fd6b13254 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -408,6 +408,17 @@ pci_dev_id(struct pci_dev *pdev)
return (PCI_DEVID(pdev->bus->number, pdev->devfn));
}
+static inline bool
+pci_is_vga(struct pci_dev *pdev)
+{
+ /* pdev->class holds only the base class. */
+ uint8_t class = pci_get_class(pdev->dev.bsddev);
+ uint8_t subclass = pci_get_subclass(pdev->dev.bsddev);
+
+ return ((class == PCIC_DISPLAY && subclass == PCIS_DISPLAY_VGA) ||
+ (class == PCIC_OLD && subclass == PCIS_OLD_VGA));
+}
+
static inline int
pci_resource_type(struct pci_dev *pdev, int bar)
{