Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Make sandybridge_pcode_read() deal with the second data register

The pcode mailbox has two data registers. So far we've only ever used
the one, but that's about to change. Expose the second data register to
the callers of sandybridge_pcode_read().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Clint Taylor <Clinton.A.Taylor@intel.com>
Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190521164025.30225-1-ville.syrjala@linux.intel.com

+20 -14
+2 -2
drivers/gpu/drm/i915/i915_debugfs.c
··· 1500 1500 1501 1501 if (INTEL_GEN(dev_priv) <= 7) 1502 1502 sandybridge_pcode_read(dev_priv, GEN6_PCODE_READ_RC6VIDS, 1503 - &rc6vids); 1503 + &rc6vids, NULL); 1504 1504 1505 1505 seq_printf(m, "RC1e Enabled: %s\n", 1506 1506 yesno(rcctl1 & GEN6_RC_CTL_RC1e_ENABLE)); ··· 1783 1783 ia_freq = gpu_freq; 1784 1784 sandybridge_pcode_read(dev_priv, 1785 1785 GEN6_PCODE_READ_MIN_FREQ_TABLE, 1786 - &ia_freq); 1786 + &ia_freq, NULL); 1787 1787 seq_printf(m, "%d\t\t%d\t\t\t\t%d\n", 1788 1788 intel_gpu_freq(dev_priv, (gpu_freq * 1789 1789 (IS_GEN9_BC(dev_priv) ||
+7 -5
drivers/gpu/drm/i915/intel_pm.c
··· 2822 2822 val = 0; /* data0 to be programmed to 0 for first set */ 2823 2823 ret = sandybridge_pcode_read(dev_priv, 2824 2824 GEN9_PCODE_READ_MEM_LATENCY, 2825 - &val); 2825 + &val, NULL); 2826 2826 2827 2827 if (ret) { 2828 2828 DRM_ERROR("SKL Mailbox read error = %d\n", ret); ··· 2841 2841 val = 1; /* data0 to be programmed to 1 for second set */ 2842 2842 ret = sandybridge_pcode_read(dev_priv, 2843 2843 GEN9_PCODE_READ_MEM_LATENCY, 2844 - &val); 2844 + &val, NULL); 2845 2845 if (ret) { 2846 2846 DRM_ERROR("SKL Mailbox read error = %d\n", ret); 2847 2847 return; ··· 7072 7072 7073 7073 if (sandybridge_pcode_read(dev_priv, 7074 7074 HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL, 7075 - &ddcc_status) == 0) 7075 + &ddcc_status, NULL) == 0) 7076 7076 rps->efficient_freq = 7077 7077 clamp_t(u8, 7078 7078 ((ddcc_status >> 8) & 0xff), ··· 7419 7419 GEN6_RC_CTL_HW_ENABLE); 7420 7420 7421 7421 rc6vids = 0; 7422 - ret = sandybridge_pcode_read(dev_priv, GEN6_PCODE_READ_RC6VIDS, &rc6vids); 7422 + ret = sandybridge_pcode_read(dev_priv, GEN6_PCODE_READ_RC6VIDS, 7423 + &rc6vids, NULL); 7423 7424 if (IS_GEN(dev_priv, 6) && ret) { 7424 7425 DRM_DEBUG_DRIVER("Couldn't check for BIOS workaround\n"); 7425 7426 } else if (IS_GEN(dev_priv, 6) && (GEN6_DECODE_RC6_VID(rc6vids & 0xff) < 450)) { ··· 8567 8566 IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) { 8568 8567 u32 params = 0; 8569 8568 8570 - sandybridge_pcode_read(dev_priv, GEN6_READ_OC_PARAMS, &params); 8569 + sandybridge_pcode_read(dev_priv, GEN6_READ_OC_PARAMS, 8570 + &params, NULL); 8571 8571 if (params & BIT(31)) { /* OC supported */ 8572 8572 DRM_DEBUG_DRIVER("Overclocking supported, max: %dMHz, overclock: %dMHz\n", 8573 8573 (rps->max_freq & 0xff) * 50,
+9 -6
drivers/gpu/drm/i915/intel_sideband.c
··· 374 374 } 375 375 376 376 static int __sandybridge_pcode_rw(struct drm_i915_private *i915, 377 - u32 mbox, u32 *val, 377 + u32 mbox, u32 *val, u32 *val1, 378 378 int fast_timeout_us, 379 379 int slow_timeout_ms, 380 380 bool is_read) ··· 393 393 return -EAGAIN; 394 394 395 395 intel_uncore_write_fw(uncore, GEN6_PCODE_DATA, *val); 396 - intel_uncore_write_fw(uncore, GEN6_PCODE_DATA1, 0); 396 + intel_uncore_write_fw(uncore, GEN6_PCODE_DATA1, val1 ? *val1 : 0); 397 397 intel_uncore_write_fw(uncore, 398 398 GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox); 399 399 ··· 407 407 408 408 if (is_read) 409 409 *val = intel_uncore_read_fw(uncore, GEN6_PCODE_DATA); 410 + if (is_read && val1) 411 + *val1 = intel_uncore_read_fw(uncore, GEN6_PCODE_DATA1); 410 412 411 413 if (INTEL_GEN(i915) > 6) 412 414 return gen7_check_mailbox_status(mbox); ··· 416 414 return gen6_check_mailbox_status(mbox); 417 415 } 418 416 419 - int sandybridge_pcode_read(struct drm_i915_private *i915, u32 mbox, u32 *val) 417 + int sandybridge_pcode_read(struct drm_i915_private *i915, u32 mbox, 418 + u32 *val, u32 *val1) 420 419 { 421 420 int err; 422 421 423 422 mutex_lock(&i915->sb_lock); 424 - err = __sandybridge_pcode_rw(i915, mbox, val, 423 + err = __sandybridge_pcode_rw(i915, mbox, val, val1, 425 424 500, 0, 426 425 true); 427 426 mutex_unlock(&i915->sb_lock); ··· 443 440 int err; 444 441 445 442 mutex_lock(&i915->sb_lock); 446 - err = __sandybridge_pcode_rw(i915, mbox, &val, 443 + err = __sandybridge_pcode_rw(i915, mbox, &val, NULL, 447 444 fast_timeout_us, slow_timeout_ms, 448 445 false); 449 446 mutex_unlock(&i915->sb_lock); ··· 460 457 u32 request, u32 reply_mask, u32 reply, 461 458 u32 *status) 462 459 { 463 - *status = __sandybridge_pcode_rw(i915, mbox, &request, 460 + *status = __sandybridge_pcode_rw(i915, mbox, &request, NULL, 464 461 500, 0, 465 462 true); 466 463
+2 -1
drivers/gpu/drm/i915/intel_sideband.h
··· 127 127 void intel_sbi_write(struct drm_i915_private *i915, u16 reg, u32 value, 128 128 enum intel_sbi_destination destination); 129 129 130 - int sandybridge_pcode_read(struct drm_i915_private *i915, u32 mbox, u32 *val); 130 + int sandybridge_pcode_read(struct drm_i915_private *i915, u32 mbox, 131 + u32 *val, u32 *val1); 131 132 int sandybridge_pcode_write_timeout(struct drm_i915_private *i915, u32 mbox, 132 133 u32 val, int fast_timeout_us, 133 134 int slow_timeout_ms);