store root bridge data in softc before calling intel_init_stolen_res()
authorjsg <jsg@openbsd.org>
Thu, 3 Feb 2022 22:24:09 +0000 (22:24 +0000)
committerjsg <jsg@openbsd.org>
Thu, 3 Feb 2022 22:24:09 +0000 (22:24 +0000)
should fix panic on boot on x41 reported by Fred Crowson

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

index 735908e..99c4744 100644 (file)
@@ -107,6 +107,10 @@ int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
 {
        struct drm_device *dev = &dev_priv->drm;
 
+       /* may be already called from attach */
+       if (dev_priv->bridge_dev != NULL)
+               return 0;
+
        dev_priv->bridge_dev = malloc(sizeof(*dev_priv->bridge_dev),
                                      M_DEVBUF, M_WAITOK);
        dev_priv->bridge_dev->pc = dev->pdev->pc;
@@ -2470,6 +2474,7 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux)
                return;
        }
        dev->pdev->irq = -1;
+       i915_get_bridge_dev(dev_priv);
        intel_init_stolen_res(dev_priv);
 
        config_mountroot(self, inteldrm_attachhook);