freebsd-dev/sys/dev/pci
Jean-Sébastien Pédron 2b22d5cc07 vga_pci: Improve boot display detection
The previous code was checking the "VGA Enable" bit on the video card's
parent PCI-to-PCI bridge only. This didn't work for the case where the
video card is attached to the root PCI bus (ie. the card has no parent
PCI-to-PCI bridge).

Now, the new code:
    1. checks the "VGA Enable" bit on the parent bridge only if it's a
       PCI-to-PCI bridge;
    2. always checks the "I/O" and "Memory address space decoding" bits
       on the video card itself.

However, vendor-specific bits are not used.

This fixes the use of many integrated Radeon cards: without this patch,
we fail to detect them as the boot display and, when radeonkms looks for
the Video BIOS, it skips the shadow copy made by the System BIOS. It
then fails to fully initialize the card, because the shadow copy is the
only way to read the Video BIOS in these situations. A workaround was to
force the boot display selection using the "hw.pci.default_vgapci_unit"
tunable.

A previous version of this patch added a new function doing the checks.
Now, the vga_pci_is_boot_display() function is used to perform the
checks (only until the boot display is found) and return if the given
device is the boot display or not.

Furthermore, vga_pci_attach() logs "Boot video device" if the card being
attached it the Chosen One:
    vgapci0: <VGA-compatible display> [...]
    vgapci0: Boot video device

Reviewed by:	kib@, jhb@ (both a previous version)
Tested by:	lunatic_ (#freebsd-xorg, integrated Radeon card,
		xmj (#freebsd-xorg, i915+NVIDIA cards)
2013-12-21 12:55:42 +00:00
..
eisa_pci.c - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
fixup_pci.c Use device_printf(). 2013-08-11 06:57:57 +00:00
hostb_pci.c Expand the set of APIs available for locating PCI capabilities: 2012-03-03 18:08:57 +00:00
ignore_pci.c
isa_pci.c Implement BUS_ADD_CHILD() for the isab(4) driver. It already calls 2011-12-14 12:34:02 +00:00
pci_if.m Expand the set of APIs available for locating PCI capabilities: 2012-03-03 18:08:57 +00:00
pci_pci.c Properly handle I/O windows in bridges with the ISA enable bit set. These 2013-07-18 15:17:11 +00:00
pci_private.h Make pci_get_dma_tag() non-static. Since the function is only 2013-10-24 20:29:29 +00:00
pci_subr.c Respect the BIOS/firmware's notion of acceptable address ranges for PCI 2011-07-15 21:08:58 +00:00
pci_user.c Always initialize pattern_buf pointers to NULL, otherwise AMD64 machine 2012-12-26 13:07:17 +00:00
pci.c Make pci_get_dma_tag() non-static. Since the function is only 2013-10-24 20:29:29 +00:00
pcib_if.m
pcib_private.h Properly handle I/O windows in bridges with the ISA enable bit set. These 2013-07-18 15:17:11 +00:00
pcireg.h Add some definitions for the bits in root control and status PCIe cap 2013-10-24 20:25:29 +00:00
pcivar.h Move the PCI_DMA_BOUNDARY definition into the pcivar.h. 2013-10-24 20:21:37 +00:00
vga_pci.c vga_pci: Improve boot display detection 2013-12-21 12:55:42 +00:00