x86, ia64: Move EFI_FB vga_default_device() initialization to pci_vga_fixup()
Commitb4aa016305
("efifb: Implement vga_default_device() (v2)") added efifb vga_default_device() so EFI systems that do not load shadow VBIOS or setup VGA get proper value for boot_vga PCI sysfs attribute on the corresponding PCI device. Xorg doesn't detect devices when boot_vga=0, e.g., on some EFI systems such as MacBookAir2,1. Xorg detects the GPU and finds the DRI device but then bails out with "no devices detected". Note: When vga_default_device() is set boot_vga PCI sysfs attribute reflects its state. When unset this attribute is 1 whenever IORESOURCE_ROM_SHADOW flag is set. With introduction of sysfb/simplefb/simpledrm efifb is getting obsolete while having native drivers for the GPU also makes selecting sysfb/efifb optional. Remove the efifb implementation of vga_default_device() and initialize vgaarb's vga_default_device() with the PCI GPU that matches boot screen_info in pci_fixup_video(). [bhelgaas: remove unused "dev" in efifb_setup()] Fixes:b4aa016305
("efifb: Implement vga_default_device() (v2)") Tested-by: Anibal Francisco Martinez Cortina <linuxkid.zeuz@gmail.com> Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Matthew Garrett <matthew.garrett@nebula.com> CC: stable@vger.kernel.org # v3.5+
This commit is contained in:

committed by
Bjorn Helgaas

parent
dcfa9be838
commit
20cde69402
@@ -6,6 +6,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/vgaarb.h>
|
||||
#include <linux/screen_info.h>
|
||||
|
||||
#include <asm/machvec.h>
|
||||
|
||||
@@ -37,6 +38,27 @@ static void pci_fixup_video(struct pci_dev *pdev)
|
||||
return;
|
||||
/* Maybe, this machine supports legacy memory map. */
|
||||
|
||||
if (!vga_default_device()) {
|
||||
resource_size_t start, end;
|
||||
int i;
|
||||
|
||||
/* Does firmware framebuffer belong to us? */
|
||||
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
|
||||
if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
|
||||
continue;
|
||||
|
||||
start = pci_resource_start(pdev, i);
|
||||
end = pci_resource_end(pdev, i);
|
||||
|
||||
if (!start || !end)
|
||||
continue;
|
||||
|
||||
if (screen_info.lfb_base >= start &&
|
||||
(screen_info.lfb_base + screen_info.lfb_size) < end)
|
||||
vga_set_default_device(pdev);
|
||||
}
|
||||
}
|
||||
|
||||
/* Is VGA routed to us? */
|
||||
bus = pdev->bus;
|
||||
while (bus) {
|
||||
|
Reference in New Issue
Block a user