Beispiel #1
0
static void pci_fixup_video(struct pci_dev *pdev)
{
    struct pci_dev *bridge;
    struct pci_bus *bus;
    u16 config;

    /* Is VGA routed to us? */
    bus = pdev->bus;
    while (bus) {
        bridge = bus->self;

        /*
         * From information provided by
         * "David Miller" <*****@*****.**>
         * The bridge control register is valid for PCI header
         * type BRIDGE, or CARDBUS. Host to PCI controllers use
         * PCI header type NORMAL.
         */
        if (bridge && (pci_is_bridge(bridge))) {
            pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
                                 &config);
            if (!(config & PCI_BRIDGE_CTL_VGA))
                return;
        }
        bus = bus->parent;
    }
    if (!vga_default_device() || pdev == vga_default_device()) {
        pci_read_config_word(pdev, PCI_COMMAND, &config);
        if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
            pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
            dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
        }
    }
}
static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	struct intel_device_info *intel_info =
		(struct intel_device_info *) ent->driver_data;

	if (IS_PRELIMINARY_HW(intel_info) && !i915.preliminary_hw_support) {
		DRM_INFO("This hardware requires preliminary hardware support.\n"
			 "See CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT, and/or modparam preliminary_hw_support\n");
		return -ENODEV;
	}

	/* Only bind to function 0 of the device. Early generations
	 * used function 1 as a placeholder for multi-head. This causes
	 * us confusion instead, especially on the systems where both
	 * functions have the same PCI-ID!
	 */
	if (PCI_FUNC(pdev->devfn))
		return -ENODEV;

	/*
	 * apple-gmux is needed on dual GPU MacBook Pro
	 * to probe the panel if we're the inactive GPU.
	 */
	if (IS_ENABLED(CONFIG_VGA_ARB) && IS_ENABLED(CONFIG_VGA_SWITCHEROO) &&
	    apple_gmux_present() && pdev != vga_default_device() &&
	    !vga_switcheroo_handler_flags())
		return -EPROBE_DEFER;

	return drm_get_pci_dev(pdev, ent, &driver);
}
Beispiel #3
0
int fb_is_primary_device(struct fb_info *info)
{
	struct device *device = info->device;
	struct pci_dev *pci_dev = NULL;
	struct pci_dev *default_device = vga_default_device();
	struct resource *res = NULL;

	if (device)
		pci_dev = to_pci_dev(device);

	if (!pci_dev)
		return 0;

	if (default_device) {
		if (pci_dev == default_device)
			return 1;
		else
			return 0;
	}

	res = &pci_dev->resource[PCI_ROM_RESOURCE];
	if (res && res->flags & IORESOURCE_ROM_SHADOW)
		return 1;

	return 0;
}