diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-06-14 01:30:46 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-06-14 01:30:46 +0000 |
commit | 7f38c517538cf05f1c18187ae88cd080b7557ce9 (patch) | |
tree | cd8e07a873b42f6c02af3e393bb8f35946a172df /sys | |
parent | e7fa203a2a4a7f9a98f45eb208affc82e5eefb78 (diff) |
unstub probe_gmdid_display()
There is a temporary mapping of the first pci bar as this occurs before
the runtime info is setup and a generation specific bar is mapped based
on that.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/i915/display/intel_display_device.c | 22 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/i915_driver.c | 1 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/i915_drv.h | 1 |
3 files changed, 20 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/i915/display/intel_display_device.c b/sys/dev/pci/drm/i915/display/intel_display_device.c index 7a95caebe08..ab71ad64460 100644 --- a/sys/dev/pci/drm/i915/display/intel_display_device.c +++ b/sys/dev/pci/drm/i915/display/intel_display_device.c @@ -812,6 +812,10 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step void __iomem *addr; u32 val; int i; + int mmio_bar, mmio_size, mmio_type; + bus_space_tag_t bst; + bus_space_handle_t bsh; + bus_size_t memsize; /* The caller expects to ver, rel and step to be initialized * here, and there's no good way to check when there was a @@ -822,9 +826,7 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step *rel = 0; *step = 0; - STUB(); - return &no_display; -#ifdef notyet +#ifdef __linux__ addr = pci_iomap_range(pdev, 0, i915_mmio_reg_offset(GMD_ID_DISPLAY), sizeof(u32)); if (!addr) { drm_err(&i915->drm, "Cannot map MMIO BAR to read display GMD_ID\n"); @@ -833,6 +835,19 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step val = ioread32(addr); pci_iounmap(pdev, addr); +#else + mmio_bar = 0x10; + mmio_type = pci_mapreg_type(i915->pc, i915->tag, mmio_bar); + if (pci_mapreg_map(i915->pa, mmio_bar, mmio_type, 0, + &bst, &bsh, NULL, &memsize, 0)) { + drm_err(&i915->drm, "Cannot map MMIO BAR to read display GMD_ID\n"); + return &no_display; + } + + val = bus_space_read_4(bst, bsh, i915_mmio_reg_offset(GMD_ID_DISPLAY)); + + bus_space_unmap(bst, bsh, memsize); +#endif if (val == 0) { drm_dbg_kms(&i915->drm, "Device doesn't have display\n"); @@ -851,7 +866,6 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step drm_err(&i915->drm, "Unrecognized display IP version %d.%02d; disabling display.\n", *ver, *rel); return &no_display; -#endif } const struct intel_display_device_info * diff --git a/sys/dev/pci/drm/i915/i915_driver.c b/sys/dev/pci/drm/i915/i915_driver.c index 6d64c129114..8ba7b3f12fb 100644 --- a/sys/dev/pci/drm/i915/i915_driver.c +++ b/sys/dev/pci/drm/i915/i915_driver.c @@ -2258,6 +2258,7 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux) int mmio_bar, mmio_size, mmio_type; int ret; + dev_priv->pa = pa; dev_priv->pc = pa->pa_pc; dev_priv->tag = pa->pa_tag; dev_priv->iot = pa->pa_iot; diff --git a/sys/dev/pci/drm/i915/i915_drv.h b/sys/dev/pci/drm/i915/i915_drv.h index 577617eadb6..673a0164f7d 100644 --- a/sys/dev/pci/drm/i915/i915_drv.h +++ b/sys/dev/pci/drm/i915/i915_drv.h @@ -239,6 +239,7 @@ struct inteldrm_softc { struct i915_dsm dsm; #ifdef __OpenBSD__ + struct pci_attach_args *pa; pci_chipset_tag_t pc; pcitag_t tag; struct extent *memex; |