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 <[email protected]>
Reviewed by:	wulf
Differential Revision:	https://reviews.freebsd.org/D60200
This commit is contained in:
Denis Borovikov authored and Vladimir Kondratyev committed 2026-10-17 22:55:17 +03:00
1 parent fce354b0e9
commit 8558dd61e6
1 file changed
+11
@@ -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)
{