@@ -6,6 +6,8 @@
#include <linux/pci.h>
#include <linux/vgaarb.h>
+#include <drm/drm_aperture.h>
+
#include <video/vga.h>
#include "soc/intel_gmch.h"
@@ -113,6 +115,32 @@ intel_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
}
+static bool intel_vga_is_default_boot_device(struct pci_dev *pdev)
+{
+ struct drm_i915_private *i915 = pdev_to_i915(pdev);
+ struct drm_device *drm = &i915->drm;
+ struct i915_gem_mm *mm = &i915->mm;
+ struct intel_memory_region *mr;
+ unsigned int i;
+ bool ret;
+
+ for (i = 0; i < ARRAY_SIZE(mm->regions); i++) {
+ mr = mm->regions[i];
+ if (mr) {
+ ret = drm_aperture_contain_firmware_fb(mr->io_start,
+ mr->io_size);
+
+ if (ret) {
+ drm_dbg(drm, "%s contains firmware fb\n",
+ mr->name);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
int intel_vga_register(struct drm_i915_private *i915)
{
struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
@@ -126,7 +154,8 @@ int intel_vga_register(struct drm_i915_private *i915)
* then we do not take part in VGA arbitration and the
* vga_client_register() fails with -ENODEV.
*/
- ret = vga_client_register(pdev, intel_vga_set_decode, NULL);
+ ret = vga_client_register(pdev, intel_vga_set_decode,
+ intel_vga_is_default_boot_device);
if (ret && ret != -ENODEV)
return ret;