force primary and console on Meteor Lake
authorjsg <jsg@openbsd.org>
Tue, 13 Aug 2024 00:36:32 +0000 (00:36 +0000)
committerjsg <jsg@openbsd.org>
Tue, 13 Aug 2024 00:36:32 +0000 (00:36 +0000)
The GOP framebuffer doesn't match the PCI BAR ranges efifb tests.
discussed with kettenis@

sys/dev/pci/drm/i915/i915_driver.c

index d7d9946..6254eba 100644 (file)
@@ -2263,6 +2263,11 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux)
        dev_priv->memex = pa->pa_memex;
        dev_priv->vga_regs = &dev_priv->bar;
 
+       id = drm_find_description(PCI_VENDOR(pa->pa_id),
+           PCI_PRODUCT(pa->pa_id), pciidlist);
+       dev_priv->id = id;
+       info = (struct intel_device_info *)id->driver_data;
+
        if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY &&
            PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA &&
            (pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG)
@@ -2281,6 +2286,18 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux)
        }
 #endif
 
+       /*
+        * Meteor Lake GOP framebuffer doesn't pass efifb pci bar tests
+        * too early for IS_METEORLAKE which uses runtime info
+        */
+       if (info->platform == INTEL_METEORLAKE) {
+               dev_priv->primary = 1;
+               dev_priv->console = 1;
+#if NEFIFB > 0
+               efifb_detach();
+#endif
+       }
+
        printf("\n");
 
        dev = drm_attach_pci(&i915_drm_driver, pa, 0, dev_priv->primary,
@@ -2290,11 +2307,6 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux)
                return;
        }
 
-       id = drm_find_description(PCI_VENDOR(pa->pa_id),
-           PCI_PRODUCT(pa->pa_id), pciidlist);
-       dev_priv->id = id;
-       info = (struct intel_device_info *)id->driver_data;
-
        /* Device parameters start as a copy of module parameters. */
        i915_params_copy(&dev_priv->params, &i915_modparams);
        dev_priv->params.request_timeout_ms = 0;