From: Ville Syrjälä <[email protected]> Add a place for upcoming mmio stuff in the form of a display->mmio struct and intel_de_init() to fill it up. For now we'll just stick the uncore pointer there, but it'll get replaced by something else eventually.
I originally wanted to call intel_de_init() just after intel_display_device_probe(), but i915 calls that before the uncore/mmio setup has been done. Right now that wouldn't matter since the &i915->uncore is valid nonetheless. But eventually I think we'll just want to get the 'void __iomem *' from the core driver and that of course need to be mapped before intel_de_init() is called. So put the init call into __intel_display_device_info_runtime_init() which should be the first place where we call any intel_de_*() stuff Signed-off-by: Ville Syrjälä <[email protected]> --- drivers/gpu/drm/i915/display/intel_de.c | 5 +++++ drivers/gpu/drm/i915/display/intel_de.h | 4 +++- drivers/gpu/drm/i915/display/intel_display_core.h | 5 +++++ drivers/gpu/drm/i915/display/intel_display_device.c | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_de.c b/drivers/gpu/drm/i915/display/intel_de.c index a7417905192d..6b3d06147e58 100644 --- a/drivers/gpu/drm/i915/display/intel_de.c +++ b/drivers/gpu/drm/i915/display/intel_de.c @@ -162,3 +162,8 @@ u16 intel_de_read16(struct intel_display *display, intel_reg_t reg) return intel_uncore_read16(__to_uncore(display), reg); } + +void intel_de_init(struct intel_display *display) +{ + display->mmio.uncore = to_intel_uncore(display->drm); +} diff --git a/drivers/gpu/drm/i915/display/intel_de.h b/drivers/gpu/drm/i915/display/intel_de.h index d0a239a36980..f1135ee5071b 100644 --- a/drivers/gpu/drm/i915/display/intel_de.h +++ b/drivers/gpu/drm/i915/display/intel_de.h @@ -14,9 +14,11 @@ static inline struct intel_uncore *__to_uncore(struct intel_display *display) { - return to_intel_uncore(display->drm); + return display->mmio.uncore; } +void intel_de_init(struct intel_display *display); + u8 intel_de_read8(struct intel_display *display, intel_reg_t reg); void intel_de_write8(struct intel_display *display, intel_reg_t reg, u8 val); u16 intel_de_read16(struct intel_display *display, intel_reg_t reg); diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h index c80b4a2f74f9..35409f9abb2f 100644 --- a/drivers/gpu/drm/i915/display/intel_display_core.h +++ b/drivers/gpu/drm/i915/display/intel_display_core.h @@ -51,6 +51,7 @@ struct intel_hotplug_irq_funcs; struct intel_initial_plane_config; struct intel_opregion; struct intel_overlay; +struct intel_uncore; struct task_struct; /* Amount of SAGV/QGV points, BSpec precisely defines this */ @@ -530,6 +531,10 @@ struct intel_display { const struct intel_modeset_funcs *funcs; } modeset; + struct { + struct intel_uncore *uncore; + } mmio; + struct { /* protected by wm.wm_mutex */ u16 linetime[I915_MAX_PIPES]; diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c index c74256359c25..f1bd1252a960 100644 --- a/drivers/gpu/drm/i915/display/intel_display_device.c +++ b/drivers/gpu/drm/i915/display/intel_display_device.c @@ -1798,6 +1798,13 @@ static void __intel_display_device_info_runtime_init(struct intel_display *displ struct intel_display_runtime_info *display_runtime = DISPLAY_RUNTIME_INFO(display); enum pipe pipe; + /* + * TODO end of intel_display_device_probe() would be a more + * logical place, but at the moment i915 calls that super + * early when things aren't fully set up yet. + */ + intel_de_init(display); + BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->pipe_mask) < I915_MAX_PIPES); BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->cpu_transcoder_mask) < I915_MAX_TRANSCODERS); BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->port_mask) < I915_MAX_PORTS); -- 2.56.0
