intel_device_info.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. /*
  2. * Copyright © 2016 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. * IN THE SOFTWARE.
  22. *
  23. */
  24. #include <drm/drm_print.h>
  25. #include "intel_device_info.h"
  26. #include "i915_drv.h"
  27. #define PLATFORM_NAME(x) [INTEL_##x] = #x
  28. static const char * const platform_names[] = {
  29. PLATFORM_NAME(I830),
  30. PLATFORM_NAME(I845G),
  31. PLATFORM_NAME(I85X),
  32. PLATFORM_NAME(I865G),
  33. PLATFORM_NAME(I915G),
  34. PLATFORM_NAME(I915GM),
  35. PLATFORM_NAME(I945G),
  36. PLATFORM_NAME(I945GM),
  37. PLATFORM_NAME(G33),
  38. PLATFORM_NAME(PINEVIEW),
  39. PLATFORM_NAME(I965G),
  40. PLATFORM_NAME(I965GM),
  41. PLATFORM_NAME(G45),
  42. PLATFORM_NAME(GM45),
  43. PLATFORM_NAME(IRONLAKE),
  44. PLATFORM_NAME(SANDYBRIDGE),
  45. PLATFORM_NAME(IVYBRIDGE),
  46. PLATFORM_NAME(VALLEYVIEW),
  47. PLATFORM_NAME(HASWELL),
  48. PLATFORM_NAME(BROADWELL),
  49. PLATFORM_NAME(CHERRYVIEW),
  50. PLATFORM_NAME(SKYLAKE),
  51. PLATFORM_NAME(BROXTON),
  52. PLATFORM_NAME(KABYLAKE),
  53. PLATFORM_NAME(GEMINILAKE),
  54. PLATFORM_NAME(COFFEELAKE),
  55. PLATFORM_NAME(CANNONLAKE),
  56. };
  57. #undef PLATFORM_NAME
  58. const char *intel_platform_name(enum intel_platform platform)
  59. {
  60. BUILD_BUG_ON(ARRAY_SIZE(platform_names) != INTEL_MAX_PLATFORMS);
  61. if (WARN_ON_ONCE(platform >= ARRAY_SIZE(platform_names) ||
  62. platform_names[platform] == NULL))
  63. return "<unknown>";
  64. return platform_names[platform];
  65. }
  66. void intel_device_info_dump_flags(const struct intel_device_info *info,
  67. struct drm_printer *p)
  68. {
  69. #define PRINT_FLAG(name) drm_printf(p, "%s: %s\n", #name, yesno(info->name));
  70. DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
  71. #undef PRINT_FLAG
  72. }
  73. static void sseu_dump(const struct sseu_dev_info *sseu, struct drm_printer *p)
  74. {
  75. drm_printf(p, "slice mask: %04x\n", sseu->slice_mask);
  76. drm_printf(p, "slice total: %u\n", hweight8(sseu->slice_mask));
  77. drm_printf(p, "subslice total: %u\n", sseu_subslice_total(sseu));
  78. drm_printf(p, "subslice mask %04x\n", sseu->subslice_mask);
  79. drm_printf(p, "subslice per slice: %u\n",
  80. hweight8(sseu->subslice_mask));
  81. drm_printf(p, "EU total: %u\n", sseu->eu_total);
  82. drm_printf(p, "EU per subslice: %u\n", sseu->eu_per_subslice);
  83. drm_printf(p, "has slice power gating: %s\n",
  84. yesno(sseu->has_slice_pg));
  85. drm_printf(p, "has subslice power gating: %s\n",
  86. yesno(sseu->has_subslice_pg));
  87. drm_printf(p, "has EU power gating: %s\n", yesno(sseu->has_eu_pg));
  88. }
  89. void intel_device_info_dump_runtime(const struct intel_device_info *info,
  90. struct drm_printer *p)
  91. {
  92. sseu_dump(&info->sseu, p);
  93. drm_printf(p, "CS timestamp frequency: %u kHz\n",
  94. info->cs_timestamp_frequency_khz);
  95. }
  96. void intel_device_info_dump(const struct intel_device_info *info,
  97. struct drm_printer *p)
  98. {
  99. struct drm_i915_private *dev_priv =
  100. container_of(info, struct drm_i915_private, info);
  101. drm_printf(p, "pciid=0x%04x rev=0x%02x platform=%s gen=%i\n",
  102. INTEL_DEVID(dev_priv),
  103. INTEL_REVID(dev_priv),
  104. intel_platform_name(info->platform),
  105. info->gen);
  106. intel_device_info_dump_flags(info, p);
  107. }
  108. static void gen10_sseu_info_init(struct drm_i915_private *dev_priv)
  109. {
  110. struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
  111. const u32 fuse2 = I915_READ(GEN8_FUSE2);
  112. sseu->slice_mask = (fuse2 & GEN10_F2_S_ENA_MASK) >>
  113. GEN10_F2_S_ENA_SHIFT;
  114. sseu->subslice_mask = (1 << 4) - 1;
  115. sseu->subslice_mask &= ~((fuse2 & GEN10_F2_SS_DIS_MASK) >>
  116. GEN10_F2_SS_DIS_SHIFT);
  117. sseu->eu_total = hweight32(~I915_READ(GEN8_EU_DISABLE0));
  118. sseu->eu_total += hweight32(~I915_READ(GEN8_EU_DISABLE1));
  119. sseu->eu_total += hweight32(~I915_READ(GEN8_EU_DISABLE2));
  120. sseu->eu_total += hweight8(~(I915_READ(GEN10_EU_DISABLE3) &
  121. GEN10_EU_DIS_SS_MASK));
  122. /*
  123. * CNL is expected to always have a uniform distribution
  124. * of EU across subslices with the exception that any one
  125. * EU in any one subslice may be fused off for die
  126. * recovery.
  127. */
  128. sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
  129. DIV_ROUND_UP(sseu->eu_total,
  130. sseu_subslice_total(sseu)) : 0;
  131. /* No restrictions on Power Gating */
  132. sseu->has_slice_pg = 1;
  133. sseu->has_subslice_pg = 1;
  134. sseu->has_eu_pg = 1;
  135. }
  136. static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv)
  137. {
  138. struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
  139. u32 fuse, eu_dis;
  140. fuse = I915_READ(CHV_FUSE_GT);
  141. sseu->slice_mask = BIT(0);
  142. if (!(fuse & CHV_FGT_DISABLE_SS0)) {
  143. sseu->subslice_mask |= BIT(0);
  144. eu_dis = fuse & (CHV_FGT_EU_DIS_SS0_R0_MASK |
  145. CHV_FGT_EU_DIS_SS0_R1_MASK);
  146. sseu->eu_total += 8 - hweight32(eu_dis);
  147. }
  148. if (!(fuse & CHV_FGT_DISABLE_SS1)) {
  149. sseu->subslice_mask |= BIT(1);
  150. eu_dis = fuse & (CHV_FGT_EU_DIS_SS1_R0_MASK |
  151. CHV_FGT_EU_DIS_SS1_R1_MASK);
  152. sseu->eu_total += 8 - hweight32(eu_dis);
  153. }
  154. /*
  155. * CHV expected to always have a uniform distribution of EU
  156. * across subslices.
  157. */
  158. sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
  159. sseu->eu_total / sseu_subslice_total(sseu) :
  160. 0;
  161. /*
  162. * CHV supports subslice power gating on devices with more than
  163. * one subslice, and supports EU power gating on devices with
  164. * more than one EU pair per subslice.
  165. */
  166. sseu->has_slice_pg = 0;
  167. sseu->has_subslice_pg = sseu_subslice_total(sseu) > 1;
  168. sseu->has_eu_pg = (sseu->eu_per_subslice > 2);
  169. }
  170. static void gen9_sseu_info_init(struct drm_i915_private *dev_priv)
  171. {
  172. struct intel_device_info *info = mkwrite_device_info(dev_priv);
  173. struct sseu_dev_info *sseu = &info->sseu;
  174. int s_max = 3, ss_max = 4, eu_max = 8;
  175. int s, ss;
  176. u32 fuse2, eu_disable;
  177. u8 eu_mask = 0xff;
  178. fuse2 = I915_READ(GEN8_FUSE2);
  179. sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
  180. /*
  181. * The subslice disable field is global, i.e. it applies
  182. * to each of the enabled slices.
  183. */
  184. sseu->subslice_mask = (1 << ss_max) - 1;
  185. sseu->subslice_mask &= ~((fuse2 & GEN9_F2_SS_DIS_MASK) >>
  186. GEN9_F2_SS_DIS_SHIFT);
  187. /*
  188. * Iterate through enabled slices and subslices to
  189. * count the total enabled EU.
  190. */
  191. for (s = 0; s < s_max; s++) {
  192. if (!(sseu->slice_mask & BIT(s)))
  193. /* skip disabled slice */
  194. continue;
  195. eu_disable = I915_READ(GEN9_EU_DISABLE(s));
  196. for (ss = 0; ss < ss_max; ss++) {
  197. int eu_per_ss;
  198. if (!(sseu->subslice_mask & BIT(ss)))
  199. /* skip disabled subslice */
  200. continue;
  201. eu_per_ss = eu_max - hweight8((eu_disable >> (ss*8)) &
  202. eu_mask);
  203. /*
  204. * Record which subslice(s) has(have) 7 EUs. we
  205. * can tune the hash used to spread work among
  206. * subslices if they are unbalanced.
  207. */
  208. if (eu_per_ss == 7)
  209. sseu->subslice_7eu[s] |= BIT(ss);
  210. sseu->eu_total += eu_per_ss;
  211. }
  212. }
  213. /*
  214. * SKL is expected to always have a uniform distribution
  215. * of EU across subslices with the exception that any one
  216. * EU in any one subslice may be fused off for die
  217. * recovery. BXT is expected to be perfectly uniform in EU
  218. * distribution.
  219. */
  220. sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
  221. DIV_ROUND_UP(sseu->eu_total,
  222. sseu_subslice_total(sseu)) : 0;
  223. /*
  224. * SKL+ supports slice power gating on devices with more than
  225. * one slice, and supports EU power gating on devices with
  226. * more than one EU pair per subslice. BXT+ supports subslice
  227. * power gating on devices with more than one subslice, and
  228. * supports EU power gating on devices with more than one EU
  229. * pair per subslice.
  230. */
  231. sseu->has_slice_pg =
  232. !IS_GEN9_LP(dev_priv) && hweight8(sseu->slice_mask) > 1;
  233. sseu->has_subslice_pg =
  234. IS_GEN9_LP(dev_priv) && sseu_subslice_total(sseu) > 1;
  235. sseu->has_eu_pg = sseu->eu_per_subslice > 2;
  236. if (IS_GEN9_LP(dev_priv)) {
  237. #define IS_SS_DISABLED(ss) (!(sseu->subslice_mask & BIT(ss)))
  238. info->has_pooled_eu = hweight8(sseu->subslice_mask) == 3;
  239. sseu->min_eu_in_pool = 0;
  240. if (info->has_pooled_eu) {
  241. if (IS_SS_DISABLED(2) || IS_SS_DISABLED(0))
  242. sseu->min_eu_in_pool = 3;
  243. else if (IS_SS_DISABLED(1))
  244. sseu->min_eu_in_pool = 6;
  245. else
  246. sseu->min_eu_in_pool = 9;
  247. }
  248. #undef IS_SS_DISABLED
  249. }
  250. }
  251. static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
  252. {
  253. struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
  254. const int s_max = 3, ss_max = 3, eu_max = 8;
  255. int s, ss;
  256. u32 fuse2, eu_disable[3]; /* s_max */
  257. fuse2 = I915_READ(GEN8_FUSE2);
  258. sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
  259. /*
  260. * The subslice disable field is global, i.e. it applies
  261. * to each of the enabled slices.
  262. */
  263. sseu->subslice_mask = GENMASK(ss_max - 1, 0);
  264. sseu->subslice_mask &= ~((fuse2 & GEN8_F2_SS_DIS_MASK) >>
  265. GEN8_F2_SS_DIS_SHIFT);
  266. eu_disable[0] = I915_READ(GEN8_EU_DISABLE0) & GEN8_EU_DIS0_S0_MASK;
  267. eu_disable[1] = (I915_READ(GEN8_EU_DISABLE0) >> GEN8_EU_DIS0_S1_SHIFT) |
  268. ((I915_READ(GEN8_EU_DISABLE1) & GEN8_EU_DIS1_S1_MASK) <<
  269. (32 - GEN8_EU_DIS0_S1_SHIFT));
  270. eu_disable[2] = (I915_READ(GEN8_EU_DISABLE1) >> GEN8_EU_DIS1_S2_SHIFT) |
  271. ((I915_READ(GEN8_EU_DISABLE2) & GEN8_EU_DIS2_S2_MASK) <<
  272. (32 - GEN8_EU_DIS1_S2_SHIFT));
  273. /*
  274. * Iterate through enabled slices and subslices to
  275. * count the total enabled EU.
  276. */
  277. for (s = 0; s < s_max; s++) {
  278. if (!(sseu->slice_mask & BIT(s)))
  279. /* skip disabled slice */
  280. continue;
  281. for (ss = 0; ss < ss_max; ss++) {
  282. u32 n_disabled;
  283. if (!(sseu->subslice_mask & BIT(ss)))
  284. /* skip disabled subslice */
  285. continue;
  286. n_disabled = hweight8(eu_disable[s] >> (ss * eu_max));
  287. /*
  288. * Record which subslices have 7 EUs.
  289. */
  290. if (eu_max - n_disabled == 7)
  291. sseu->subslice_7eu[s] |= 1 << ss;
  292. sseu->eu_total += eu_max - n_disabled;
  293. }
  294. }
  295. /*
  296. * BDW is expected to always have a uniform distribution of EU across
  297. * subslices with the exception that any one EU in any one subslice may
  298. * be fused off for die recovery.
  299. */
  300. sseu->eu_per_subslice = sseu_subslice_total(sseu) ?
  301. DIV_ROUND_UP(sseu->eu_total,
  302. sseu_subslice_total(sseu)) : 0;
  303. /*
  304. * BDW supports slice power gating on devices with more than
  305. * one slice.
  306. */
  307. sseu->has_slice_pg = hweight8(sseu->slice_mask) > 1;
  308. sseu->has_subslice_pg = 0;
  309. sseu->has_eu_pg = 0;
  310. }
  311. static u32 read_reference_ts_freq(struct drm_i915_private *dev_priv)
  312. {
  313. u32 ts_override = I915_READ(GEN9_TIMESTAMP_OVERRIDE);
  314. u32 base_freq, frac_freq;
  315. base_freq = ((ts_override & GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_MASK) >>
  316. GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_SHIFT) + 1;
  317. base_freq *= 1000;
  318. frac_freq = ((ts_override &
  319. GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_MASK) >>
  320. GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_SHIFT);
  321. frac_freq = 1000 / (frac_freq + 1);
  322. return base_freq + frac_freq;
  323. }
  324. static u32 read_timestamp_frequency(struct drm_i915_private *dev_priv)
  325. {
  326. u32 f12_5_mhz = 12500;
  327. u32 f19_2_mhz = 19200;
  328. u32 f24_mhz = 24000;
  329. if (INTEL_GEN(dev_priv) <= 4) {
  330. /* PRMs say:
  331. *
  332. * "The value in this register increments once every 16
  333. * hclks." (through the “Clocking Configuration”
  334. * (“CLKCFG”) MCHBAR register)
  335. */
  336. return dev_priv->rawclk_freq / 16;
  337. } else if (INTEL_GEN(dev_priv) <= 8) {
  338. /* PRMs say:
  339. *
  340. * "The PCU TSC counts 10ns increments; this timestamp
  341. * reflects bits 38:3 of the TSC (i.e. 80ns granularity,
  342. * rolling over every 1.5 hours).
  343. */
  344. return f12_5_mhz;
  345. } else if (INTEL_GEN(dev_priv) <= 9) {
  346. u32 ctc_reg = I915_READ(CTC_MODE);
  347. u32 freq = 0;
  348. if ((ctc_reg & CTC_SOURCE_PARAMETER_MASK) == CTC_SOURCE_DIVIDE_LOGIC) {
  349. freq = read_reference_ts_freq(dev_priv);
  350. } else {
  351. freq = IS_GEN9_LP(dev_priv) ? f19_2_mhz : f24_mhz;
  352. /* Now figure out how the command stream's timestamp
  353. * register increments from this frequency (it might
  354. * increment only every few clock cycle).
  355. */
  356. freq >>= 3 - ((ctc_reg & CTC_SHIFT_PARAMETER_MASK) >>
  357. CTC_SHIFT_PARAMETER_SHIFT);
  358. }
  359. return freq;
  360. } else if (INTEL_GEN(dev_priv) <= 10) {
  361. u32 ctc_reg = I915_READ(CTC_MODE);
  362. u32 freq = 0;
  363. u32 rpm_config_reg = 0;
  364. /* First figure out the reference frequency. There are 2 ways
  365. * we can compute the frequency, either through the
  366. * TIMESTAMP_OVERRIDE register or through RPM_CONFIG. CTC_MODE
  367. * tells us which one we should use.
  368. */
  369. if ((ctc_reg & CTC_SOURCE_PARAMETER_MASK) == CTC_SOURCE_DIVIDE_LOGIC) {
  370. freq = read_reference_ts_freq(dev_priv);
  371. } else {
  372. u32 crystal_clock;
  373. rpm_config_reg = I915_READ(RPM_CONFIG0);
  374. crystal_clock = (rpm_config_reg &
  375. GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK) >>
  376. GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT;
  377. switch (crystal_clock) {
  378. case GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ:
  379. freq = f19_2_mhz;
  380. break;
  381. case GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ:
  382. freq = f24_mhz;
  383. break;
  384. }
  385. /* Now figure out how the command stream's timestamp
  386. * register increments from this frequency (it might
  387. * increment only every few clock cycle).
  388. */
  389. freq >>= 3 - ((rpm_config_reg &
  390. GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK) >>
  391. GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT);
  392. }
  393. return freq;
  394. }
  395. MISSING_CASE("Unknown gen, unable to read command streamer timestamp frequency\n");
  396. return 0;
  397. }
  398. /**
  399. * intel_device_info_runtime_init - initialize runtime info
  400. * @info: intel device info struct
  401. *
  402. * Determine various intel_device_info fields at runtime.
  403. *
  404. * Use it when either:
  405. * - it's judged too laborious to fill n static structures with the limit
  406. * when a simple if statement does the job,
  407. * - run-time checks (eg read fuse/strap registers) are needed.
  408. *
  409. * This function needs to be called:
  410. * - after the MMIO has been setup as we are reading registers,
  411. * - after the PCH has been detected,
  412. * - before the first usage of the fields it can tweak.
  413. */
  414. void intel_device_info_runtime_init(struct intel_device_info *info)
  415. {
  416. struct drm_i915_private *dev_priv =
  417. container_of(info, struct drm_i915_private, info);
  418. enum pipe pipe;
  419. if (INTEL_GEN(dev_priv) >= 10) {
  420. for_each_pipe(dev_priv, pipe)
  421. info->num_scalers[pipe] = 2;
  422. } else if (INTEL_GEN(dev_priv) == 9) {
  423. info->num_scalers[PIPE_A] = 2;
  424. info->num_scalers[PIPE_B] = 2;
  425. info->num_scalers[PIPE_C] = 1;
  426. }
  427. /*
  428. * Skylake and Broxton currently don't expose the topmost plane as its
  429. * use is exclusive with the legacy cursor and we only want to expose
  430. * one of those, not both. Until we can safely expose the topmost plane
  431. * as a DRM_PLANE_TYPE_CURSOR with all the features exposed/supported,
  432. * we don't expose the topmost plane at all to prevent ABI breakage
  433. * down the line.
  434. */
  435. if (IS_GEN10(dev_priv) || IS_GEMINILAKE(dev_priv))
  436. for_each_pipe(dev_priv, pipe)
  437. info->num_sprites[pipe] = 3;
  438. else if (IS_BROXTON(dev_priv)) {
  439. info->num_sprites[PIPE_A] = 2;
  440. info->num_sprites[PIPE_B] = 2;
  441. info->num_sprites[PIPE_C] = 1;
  442. } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
  443. for_each_pipe(dev_priv, pipe)
  444. info->num_sprites[pipe] = 2;
  445. } else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) {
  446. for_each_pipe(dev_priv, pipe)
  447. info->num_sprites[pipe] = 1;
  448. }
  449. if (i915_modparams.disable_display) {
  450. DRM_INFO("Display disabled (module parameter)\n");
  451. info->num_pipes = 0;
  452. } else if (info->num_pipes > 0 &&
  453. (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
  454. HAS_PCH_SPLIT(dev_priv)) {
  455. u32 fuse_strap = I915_READ(FUSE_STRAP);
  456. u32 sfuse_strap = I915_READ(SFUSE_STRAP);
  457. /*
  458. * SFUSE_STRAP is supposed to have a bit signalling the display
  459. * is fused off. Unfortunately it seems that, at least in
  460. * certain cases, fused off display means that PCH display
  461. * reads don't land anywhere. In that case, we read 0s.
  462. *
  463. * On CPT/PPT, we can detect this case as SFUSE_STRAP_FUSE_LOCK
  464. * should be set when taking over after the firmware.
  465. */
  466. if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE ||
  467. sfuse_strap & SFUSE_STRAP_DISPLAY_DISABLED ||
  468. (HAS_PCH_CPT(dev_priv) &&
  469. !(sfuse_strap & SFUSE_STRAP_FUSE_LOCK))) {
  470. DRM_INFO("Display fused off, disabling\n");
  471. info->num_pipes = 0;
  472. } else if (fuse_strap & IVB_PIPE_C_DISABLE) {
  473. DRM_INFO("PipeC fused off\n");
  474. info->num_pipes -= 1;
  475. }
  476. } else if (info->num_pipes > 0 && IS_GEN9(dev_priv)) {
  477. u32 dfsm = I915_READ(SKL_DFSM);
  478. u8 disabled_mask = 0;
  479. bool invalid;
  480. int num_bits;
  481. if (dfsm & SKL_DFSM_PIPE_A_DISABLE)
  482. disabled_mask |= BIT(PIPE_A);
  483. if (dfsm & SKL_DFSM_PIPE_B_DISABLE)
  484. disabled_mask |= BIT(PIPE_B);
  485. if (dfsm & SKL_DFSM_PIPE_C_DISABLE)
  486. disabled_mask |= BIT(PIPE_C);
  487. num_bits = hweight8(disabled_mask);
  488. switch (disabled_mask) {
  489. case BIT(PIPE_A):
  490. case BIT(PIPE_B):
  491. case BIT(PIPE_A) | BIT(PIPE_B):
  492. case BIT(PIPE_A) | BIT(PIPE_C):
  493. invalid = true;
  494. break;
  495. default:
  496. invalid = false;
  497. }
  498. if (num_bits > info->num_pipes || invalid)
  499. DRM_ERROR("invalid pipe fuse configuration: 0x%x\n",
  500. disabled_mask);
  501. else
  502. info->num_pipes -= num_bits;
  503. }
  504. /* Initialize slice/subslice/EU info */
  505. if (IS_CHERRYVIEW(dev_priv))
  506. cherryview_sseu_info_init(dev_priv);
  507. else if (IS_BROADWELL(dev_priv))
  508. broadwell_sseu_info_init(dev_priv);
  509. else if (INTEL_GEN(dev_priv) == 9)
  510. gen9_sseu_info_init(dev_priv);
  511. else if (INTEL_GEN(dev_priv) >= 10)
  512. gen10_sseu_info_init(dev_priv);
  513. /* Initialize command stream timestamp frequency */
  514. info->cs_timestamp_frequency_khz = read_timestamp_frequency(dev_priv);
  515. }