i915_pci.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  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 <linux/console.h>
  25. #include <linux/vgaarb.h>
  26. #include <linux/vga_switcheroo.h>
  27. #include "i915_drv.h"
  28. #include "i915_selftest.h"
  29. #define GEN_DEFAULT_PIPEOFFSETS \
  30. .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
  31. PIPE_C_OFFSET, PIPE_EDP_OFFSET }, \
  32. .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \
  33. TRANSCODER_C_OFFSET, TRANSCODER_EDP_OFFSET }, \
  34. .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET }
  35. #define GEN_CHV_PIPEOFFSETS \
  36. .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
  37. CHV_PIPE_C_OFFSET }, \
  38. .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \
  39. CHV_TRANSCODER_C_OFFSET, }, \
  40. .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET, \
  41. CHV_PALETTE_C_OFFSET }
  42. #define CURSOR_OFFSETS \
  43. .cursor_offsets = { CURSOR_A_OFFSET, CURSOR_B_OFFSET, CHV_CURSOR_C_OFFSET }
  44. #define IVB_CURSOR_OFFSETS \
  45. .cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, IVB_CURSOR_C_OFFSET }
  46. #define BDW_COLORS \
  47. .color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
  48. #define CHV_COLORS \
  49. .color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
  50. #define GLK_COLORS \
  51. .color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
  52. /* Keep in gen based order, and chronological order within a gen */
  53. #define GEN_DEFAULT_PAGE_SIZES \
  54. .page_sizes = I915_GTT_PAGE_SIZE_4K
  55. #define GEN2_FEATURES \
  56. .gen = 2, .num_pipes = 1, \
  57. .has_overlay = 1, .overlay_needs_physical = 1, \
  58. .has_gmch_display = 1, \
  59. .hws_needs_physical = 1, \
  60. .unfenced_needs_alignment = 1, \
  61. .ring_mask = RENDER_RING, \
  62. .has_snoop = true, \
  63. GEN_DEFAULT_PIPEOFFSETS, \
  64. GEN_DEFAULT_PAGE_SIZES, \
  65. CURSOR_OFFSETS
  66. static const struct intel_device_info intel_i830_info __initconst = {
  67. GEN2_FEATURES,
  68. .platform = INTEL_I830,
  69. .is_mobile = 1, .cursor_needs_physical = 1,
  70. .num_pipes = 2, /* legal, last one wins */
  71. };
  72. static const struct intel_device_info intel_i845g_info __initconst = {
  73. GEN2_FEATURES,
  74. .platform = INTEL_I845G,
  75. };
  76. static const struct intel_device_info intel_i85x_info __initconst = {
  77. GEN2_FEATURES,
  78. .platform = INTEL_I85X, .is_mobile = 1,
  79. .num_pipes = 2, /* legal, last one wins */
  80. .cursor_needs_physical = 1,
  81. .has_fbc = 1,
  82. };
  83. static const struct intel_device_info intel_i865g_info __initconst = {
  84. GEN2_FEATURES,
  85. .platform = INTEL_I865G,
  86. };
  87. #define GEN3_FEATURES \
  88. .gen = 3, .num_pipes = 2, \
  89. .has_gmch_display = 1, \
  90. .ring_mask = RENDER_RING, \
  91. .has_snoop = true, \
  92. GEN_DEFAULT_PIPEOFFSETS, \
  93. GEN_DEFAULT_PAGE_SIZES, \
  94. CURSOR_OFFSETS
  95. static const struct intel_device_info intel_i915g_info __initconst = {
  96. GEN3_FEATURES,
  97. .platform = INTEL_I915G, .cursor_needs_physical = 1,
  98. .has_overlay = 1, .overlay_needs_physical = 1,
  99. .hws_needs_physical = 1,
  100. .unfenced_needs_alignment = 1,
  101. };
  102. static const struct intel_device_info intel_i915gm_info __initconst = {
  103. GEN3_FEATURES,
  104. .platform = INTEL_I915GM,
  105. .is_mobile = 1,
  106. .cursor_needs_physical = 1,
  107. .has_overlay = 1, .overlay_needs_physical = 1,
  108. .supports_tv = 1,
  109. .has_fbc = 1,
  110. .hws_needs_physical = 1,
  111. .unfenced_needs_alignment = 1,
  112. };
  113. static const struct intel_device_info intel_i945g_info __initconst = {
  114. GEN3_FEATURES,
  115. .platform = INTEL_I945G,
  116. .has_hotplug = 1, .cursor_needs_physical = 1,
  117. .has_overlay = 1, .overlay_needs_physical = 1,
  118. .hws_needs_physical = 1,
  119. .unfenced_needs_alignment = 1,
  120. };
  121. static const struct intel_device_info intel_i945gm_info __initconst = {
  122. GEN3_FEATURES,
  123. .platform = INTEL_I945GM, .is_mobile = 1,
  124. .has_hotplug = 1, .cursor_needs_physical = 1,
  125. .has_overlay = 1, .overlay_needs_physical = 1,
  126. .supports_tv = 1,
  127. .has_fbc = 1,
  128. .hws_needs_physical = 1,
  129. .unfenced_needs_alignment = 1,
  130. };
  131. static const struct intel_device_info intel_g33_info __initconst = {
  132. GEN3_FEATURES,
  133. .platform = INTEL_G33,
  134. .has_hotplug = 1,
  135. .has_overlay = 1,
  136. };
  137. static const struct intel_device_info intel_pineview_info __initconst = {
  138. GEN3_FEATURES,
  139. .platform = INTEL_PINEVIEW, .is_mobile = 1,
  140. .has_hotplug = 1,
  141. .has_overlay = 1,
  142. };
  143. #define GEN4_FEATURES \
  144. .gen = 4, .num_pipes = 2, \
  145. .has_hotplug = 1, \
  146. .has_gmch_display = 1, \
  147. .ring_mask = RENDER_RING, \
  148. .has_snoop = true, \
  149. GEN_DEFAULT_PIPEOFFSETS, \
  150. GEN_DEFAULT_PAGE_SIZES, \
  151. CURSOR_OFFSETS
  152. static const struct intel_device_info intel_i965g_info __initconst = {
  153. GEN4_FEATURES,
  154. .platform = INTEL_I965G,
  155. .has_overlay = 1,
  156. .hws_needs_physical = 1,
  157. .has_snoop = false,
  158. };
  159. static const struct intel_device_info intel_i965gm_info __initconst = {
  160. GEN4_FEATURES,
  161. .platform = INTEL_I965GM,
  162. .is_mobile = 1, .has_fbc = 1,
  163. .has_overlay = 1,
  164. .supports_tv = 1,
  165. .hws_needs_physical = 1,
  166. .has_snoop = false,
  167. };
  168. static const struct intel_device_info intel_g45_info __initconst = {
  169. GEN4_FEATURES,
  170. .platform = INTEL_G45,
  171. .ring_mask = RENDER_RING | BSD_RING,
  172. };
  173. static const struct intel_device_info intel_gm45_info __initconst = {
  174. GEN4_FEATURES,
  175. .platform = INTEL_GM45,
  176. .is_mobile = 1, .has_fbc = 1,
  177. .supports_tv = 1,
  178. .ring_mask = RENDER_RING | BSD_RING,
  179. };
  180. #define GEN5_FEATURES \
  181. .gen = 5, .num_pipes = 2, \
  182. .has_hotplug = 1, \
  183. .ring_mask = RENDER_RING | BSD_RING, \
  184. .has_snoop = true, \
  185. GEN_DEFAULT_PIPEOFFSETS, \
  186. GEN_DEFAULT_PAGE_SIZES, \
  187. CURSOR_OFFSETS
  188. static const struct intel_device_info intel_ironlake_d_info __initconst = {
  189. GEN5_FEATURES,
  190. .platform = INTEL_IRONLAKE,
  191. };
  192. static const struct intel_device_info intel_ironlake_m_info __initconst = {
  193. GEN5_FEATURES,
  194. .platform = INTEL_IRONLAKE,
  195. .is_mobile = 1, .has_fbc = 1,
  196. };
  197. #define GEN6_FEATURES \
  198. .gen = 6, .num_pipes = 2, \
  199. .has_hotplug = 1, \
  200. .has_fbc = 1, \
  201. .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
  202. .has_llc = 1, \
  203. .has_rc6 = 1, \
  204. .has_rc6p = 1, \
  205. .has_aliasing_ppgtt = 1, \
  206. GEN_DEFAULT_PIPEOFFSETS, \
  207. GEN_DEFAULT_PAGE_SIZES, \
  208. CURSOR_OFFSETS
  209. #define SNB_D_PLATFORM \
  210. GEN6_FEATURES, \
  211. .platform = INTEL_SANDYBRIDGE
  212. static const struct intel_device_info intel_sandybridge_d_gt1_info __initconst = {
  213. SNB_D_PLATFORM,
  214. .gt = 1,
  215. };
  216. static const struct intel_device_info intel_sandybridge_d_gt2_info __initconst = {
  217. SNB_D_PLATFORM,
  218. .gt = 2,
  219. };
  220. #define SNB_M_PLATFORM \
  221. GEN6_FEATURES, \
  222. .platform = INTEL_SANDYBRIDGE, \
  223. .is_mobile = 1
  224. static const struct intel_device_info intel_sandybridge_m_gt1_info __initconst = {
  225. SNB_M_PLATFORM,
  226. .gt = 1,
  227. };
  228. static const struct intel_device_info intel_sandybridge_m_gt2_info __initconst = {
  229. SNB_M_PLATFORM,
  230. .gt = 2,
  231. };
  232. #define GEN7_FEATURES \
  233. .gen = 7, .num_pipes = 3, \
  234. .has_hotplug = 1, \
  235. .has_fbc = 1, \
  236. .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
  237. .has_llc = 1, \
  238. .has_rc6 = 1, \
  239. .has_rc6p = 1, \
  240. .has_aliasing_ppgtt = 1, \
  241. .has_full_ppgtt = 1, \
  242. GEN_DEFAULT_PIPEOFFSETS, \
  243. GEN_DEFAULT_PAGE_SIZES, \
  244. IVB_CURSOR_OFFSETS
  245. #define IVB_D_PLATFORM \
  246. GEN7_FEATURES, \
  247. .platform = INTEL_IVYBRIDGE, \
  248. .has_l3_dpf = 1
  249. static const struct intel_device_info intel_ivybridge_d_gt1_info __initconst = {
  250. IVB_D_PLATFORM,
  251. .gt = 1,
  252. };
  253. static const struct intel_device_info intel_ivybridge_d_gt2_info __initconst = {
  254. IVB_D_PLATFORM,
  255. .gt = 2,
  256. };
  257. #define IVB_M_PLATFORM \
  258. GEN7_FEATURES, \
  259. .platform = INTEL_IVYBRIDGE, \
  260. .is_mobile = 1, \
  261. .has_l3_dpf = 1
  262. static const struct intel_device_info intel_ivybridge_m_gt1_info __initconst = {
  263. IVB_M_PLATFORM,
  264. .gt = 1,
  265. };
  266. static const struct intel_device_info intel_ivybridge_m_gt2_info __initconst = {
  267. IVB_M_PLATFORM,
  268. .gt = 2,
  269. };
  270. static const struct intel_device_info intel_ivybridge_q_info __initconst = {
  271. GEN7_FEATURES,
  272. .platform = INTEL_IVYBRIDGE,
  273. .gt = 2,
  274. .num_pipes = 0, /* legal, last one wins */
  275. .has_l3_dpf = 1,
  276. };
  277. static const struct intel_device_info intel_valleyview_info __initconst = {
  278. .platform = INTEL_VALLEYVIEW,
  279. .gen = 7,
  280. .is_lp = 1,
  281. .num_pipes = 2,
  282. .has_psr = 1,
  283. .has_runtime_pm = 1,
  284. .has_rc6 = 1,
  285. .has_gmch_display = 1,
  286. .has_hotplug = 1,
  287. .has_aliasing_ppgtt = 1,
  288. .has_full_ppgtt = 1,
  289. .has_snoop = true,
  290. .ring_mask = RENDER_RING | BSD_RING | BLT_RING,
  291. .display_mmio_offset = VLV_DISPLAY_BASE,
  292. GEN_DEFAULT_PAGE_SIZES,
  293. GEN_DEFAULT_PIPEOFFSETS,
  294. CURSOR_OFFSETS
  295. };
  296. #define G75_FEATURES \
  297. GEN7_FEATURES, \
  298. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
  299. .has_ddi = 1, \
  300. .has_fpga_dbg = 1, \
  301. .has_psr = 1, \
  302. .has_resource_streamer = 1, \
  303. .has_dp_mst = 1, \
  304. .has_rc6p = 0 /* RC6p removed-by HSW */, \
  305. .has_runtime_pm = 1
  306. #define HSW_PLATFORM \
  307. G75_FEATURES, \
  308. .platform = INTEL_HASWELL, \
  309. .has_l3_dpf = 1
  310. static const struct intel_device_info intel_haswell_gt1_info __initconst = {
  311. HSW_PLATFORM,
  312. .gt = 1,
  313. };
  314. static const struct intel_device_info intel_haswell_gt2_info __initconst = {
  315. HSW_PLATFORM,
  316. .gt = 2,
  317. };
  318. static const struct intel_device_info intel_haswell_gt3_info __initconst = {
  319. HSW_PLATFORM,
  320. .gt = 3,
  321. };
  322. #define GEN8_FEATURES \
  323. G75_FEATURES, \
  324. BDW_COLORS, \
  325. .page_sizes = I915_GTT_PAGE_SIZE_4K | \
  326. I915_GTT_PAGE_SIZE_2M, \
  327. .has_logical_ring_contexts = 1, \
  328. .has_full_48bit_ppgtt = 1, \
  329. .has_64bit_reloc = 1, \
  330. .has_reset_engine = 1
  331. #define BDW_PLATFORM \
  332. GEN8_FEATURES, \
  333. .gen = 8, \
  334. .platform = INTEL_BROADWELL
  335. static const struct intel_device_info intel_broadwell_gt1_info __initconst = {
  336. BDW_PLATFORM,
  337. .gt = 1,
  338. };
  339. static const struct intel_device_info intel_broadwell_gt2_info __initconst = {
  340. BDW_PLATFORM,
  341. .gt = 2,
  342. };
  343. static const struct intel_device_info intel_broadwell_rsvd_info __initconst = {
  344. BDW_PLATFORM,
  345. .gt = 3,
  346. /* According to the device ID those devices are GT3, they were
  347. * previously treated as not GT3, keep it like that.
  348. */
  349. };
  350. static const struct intel_device_info intel_broadwell_gt3_info __initconst = {
  351. BDW_PLATFORM,
  352. .gt = 3,
  353. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  354. };
  355. static const struct intel_device_info intel_cherryview_info __initconst = {
  356. .gen = 8, .num_pipes = 3,
  357. .has_hotplug = 1,
  358. .is_lp = 1,
  359. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
  360. .platform = INTEL_CHERRYVIEW,
  361. .has_64bit_reloc = 1,
  362. .has_psr = 1,
  363. .has_runtime_pm = 1,
  364. .has_resource_streamer = 1,
  365. .has_rc6 = 1,
  366. .has_logical_ring_contexts = 1,
  367. .has_gmch_display = 1,
  368. .has_aliasing_ppgtt = 1,
  369. .has_full_ppgtt = 1,
  370. .has_reset_engine = 1,
  371. .has_snoop = true,
  372. .display_mmio_offset = VLV_DISPLAY_BASE,
  373. GEN_DEFAULT_PAGE_SIZES,
  374. GEN_CHV_PIPEOFFSETS,
  375. CURSOR_OFFSETS,
  376. CHV_COLORS,
  377. };
  378. #define GEN9_DEFAULT_PAGE_SIZES \
  379. .page_sizes = I915_GTT_PAGE_SIZE_4K | \
  380. I915_GTT_PAGE_SIZE_64K | \
  381. I915_GTT_PAGE_SIZE_2M
  382. #define GEN9_FEATURES \
  383. GEN8_FEATURES, \
  384. GEN9_DEFAULT_PAGE_SIZES, \
  385. .has_logical_ring_preemption = 1, \
  386. .has_csr = 1, \
  387. .has_guc = 1, \
  388. .has_ipc = 1, \
  389. .ddb_size = 896
  390. #define SKL_PLATFORM \
  391. GEN9_FEATURES, \
  392. .gen = 9, \
  393. .platform = INTEL_SKYLAKE
  394. static const struct intel_device_info intel_skylake_gt1_info __initconst = {
  395. SKL_PLATFORM,
  396. .gt = 1,
  397. };
  398. static const struct intel_device_info intel_skylake_gt2_info __initconst = {
  399. SKL_PLATFORM,
  400. .gt = 2,
  401. };
  402. #define SKL_GT3_PLUS_PLATFORM \
  403. SKL_PLATFORM, \
  404. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING
  405. static const struct intel_device_info intel_skylake_gt3_info __initconst = {
  406. SKL_GT3_PLUS_PLATFORM,
  407. .gt = 3,
  408. };
  409. static const struct intel_device_info intel_skylake_gt4_info __initconst = {
  410. SKL_GT3_PLUS_PLATFORM,
  411. .gt = 4,
  412. };
  413. #define GEN9_LP_FEATURES \
  414. .gen = 9, \
  415. .is_lp = 1, \
  416. .has_hotplug = 1, \
  417. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
  418. .num_pipes = 3, \
  419. .has_64bit_reloc = 1, \
  420. .has_ddi = 1, \
  421. .has_fpga_dbg = 1, \
  422. .has_fbc = 1, \
  423. .has_psr = 1, \
  424. .has_runtime_pm = 1, \
  425. .has_pooled_eu = 0, \
  426. .has_csr = 1, \
  427. .has_resource_streamer = 1, \
  428. .has_rc6 = 1, \
  429. .has_dp_mst = 1, \
  430. .has_logical_ring_contexts = 1, \
  431. .has_logical_ring_preemption = 1, \
  432. .has_guc = 1, \
  433. .has_aliasing_ppgtt = 1, \
  434. .has_full_ppgtt = 1, \
  435. .has_full_48bit_ppgtt = 1, \
  436. .has_reset_engine = 1, \
  437. .has_snoop = true, \
  438. .has_ipc = 1, \
  439. GEN9_DEFAULT_PAGE_SIZES, \
  440. GEN_DEFAULT_PIPEOFFSETS, \
  441. IVB_CURSOR_OFFSETS, \
  442. BDW_COLORS
  443. static const struct intel_device_info intel_broxton_info __initconst = {
  444. GEN9_LP_FEATURES,
  445. .platform = INTEL_BROXTON,
  446. .ddb_size = 512,
  447. };
  448. static const struct intel_device_info intel_geminilake_info __initconst = {
  449. GEN9_LP_FEATURES,
  450. .platform = INTEL_GEMINILAKE,
  451. .ddb_size = 1024,
  452. GLK_COLORS,
  453. };
  454. #define KBL_PLATFORM \
  455. GEN9_FEATURES, \
  456. .gen = 9, \
  457. .platform = INTEL_KABYLAKE
  458. static const struct intel_device_info intel_kabylake_gt1_info __initconst = {
  459. KBL_PLATFORM,
  460. .gt = 1,
  461. };
  462. static const struct intel_device_info intel_kabylake_gt2_info __initconst = {
  463. KBL_PLATFORM,
  464. .gt = 2,
  465. };
  466. static const struct intel_device_info intel_kabylake_gt3_info __initconst = {
  467. KBL_PLATFORM,
  468. .gt = 3,
  469. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  470. };
  471. #define CFL_PLATFORM \
  472. GEN9_FEATURES, \
  473. .gen = 9, \
  474. .platform = INTEL_COFFEELAKE
  475. static const struct intel_device_info intel_coffeelake_gt1_info __initconst = {
  476. CFL_PLATFORM,
  477. .gt = 1,
  478. };
  479. static const struct intel_device_info intel_coffeelake_gt2_info __initconst = {
  480. CFL_PLATFORM,
  481. .gt = 2,
  482. };
  483. static const struct intel_device_info intel_coffeelake_gt3_info __initconst = {
  484. CFL_PLATFORM,
  485. .gt = 3,
  486. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  487. };
  488. #define GEN10_FEATURES \
  489. GEN9_FEATURES, \
  490. .ddb_size = 1024, \
  491. GLK_COLORS
  492. static const struct intel_device_info intel_cannonlake_gt2_info __initconst = {
  493. GEN10_FEATURES,
  494. .is_alpha_support = 1,
  495. .platform = INTEL_CANNONLAKE,
  496. .gen = 10,
  497. .gt = 2,
  498. };
  499. /*
  500. * Make sure any device matches here are from most specific to most
  501. * general. For example, since the Quanta match is based on the subsystem
  502. * and subvendor IDs, we need it to come before the more general IVB
  503. * PCI ID matches, otherwise we'll use the wrong info struct above.
  504. */
  505. static const struct pci_device_id pciidlist[] = {
  506. INTEL_I830_IDS(&intel_i830_info),
  507. INTEL_I845G_IDS(&intel_i845g_info),
  508. INTEL_I85X_IDS(&intel_i85x_info),
  509. INTEL_I865G_IDS(&intel_i865g_info),
  510. INTEL_I915G_IDS(&intel_i915g_info),
  511. INTEL_I915GM_IDS(&intel_i915gm_info),
  512. INTEL_I945G_IDS(&intel_i945g_info),
  513. INTEL_I945GM_IDS(&intel_i945gm_info),
  514. INTEL_I965G_IDS(&intel_i965g_info),
  515. INTEL_G33_IDS(&intel_g33_info),
  516. INTEL_I965GM_IDS(&intel_i965gm_info),
  517. INTEL_GM45_IDS(&intel_gm45_info),
  518. INTEL_G45_IDS(&intel_g45_info),
  519. INTEL_PINEVIEW_IDS(&intel_pineview_info),
  520. INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info),
  521. INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),
  522. INTEL_SNB_D_GT1_IDS(&intel_sandybridge_d_gt1_info),
  523. INTEL_SNB_D_GT2_IDS(&intel_sandybridge_d_gt2_info),
  524. INTEL_SNB_M_GT1_IDS(&intel_sandybridge_m_gt1_info),
  525. INTEL_SNB_M_GT2_IDS(&intel_sandybridge_m_gt2_info),
  526. INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */
  527. INTEL_IVB_M_GT1_IDS(&intel_ivybridge_m_gt1_info),
  528. INTEL_IVB_M_GT2_IDS(&intel_ivybridge_m_gt2_info),
  529. INTEL_IVB_D_GT1_IDS(&intel_ivybridge_d_gt1_info),
  530. INTEL_IVB_D_GT2_IDS(&intel_ivybridge_d_gt2_info),
  531. INTEL_HSW_GT1_IDS(&intel_haswell_gt1_info),
  532. INTEL_HSW_GT2_IDS(&intel_haswell_gt2_info),
  533. INTEL_HSW_GT3_IDS(&intel_haswell_gt3_info),
  534. INTEL_VLV_IDS(&intel_valleyview_info),
  535. INTEL_BDW_GT1_IDS(&intel_broadwell_gt1_info),
  536. INTEL_BDW_GT2_IDS(&intel_broadwell_gt2_info),
  537. INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info),
  538. INTEL_BDW_RSVD_IDS(&intel_broadwell_rsvd_info),
  539. INTEL_CHV_IDS(&intel_cherryview_info),
  540. INTEL_SKL_GT1_IDS(&intel_skylake_gt1_info),
  541. INTEL_SKL_GT2_IDS(&intel_skylake_gt2_info),
  542. INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),
  543. INTEL_SKL_GT4_IDS(&intel_skylake_gt4_info),
  544. INTEL_BXT_IDS(&intel_broxton_info),
  545. INTEL_GLK_IDS(&intel_geminilake_info),
  546. INTEL_KBL_GT1_IDS(&intel_kabylake_gt1_info),
  547. INTEL_KBL_GT2_IDS(&intel_kabylake_gt2_info),
  548. INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),
  549. INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info),
  550. INTEL_CFL_S_GT1_IDS(&intel_coffeelake_gt1_info),
  551. INTEL_CFL_S_GT2_IDS(&intel_coffeelake_gt2_info),
  552. INTEL_CFL_H_GT2_IDS(&intel_coffeelake_gt2_info),
  553. INTEL_CFL_U_GT3_IDS(&intel_coffeelake_gt3_info),
  554. INTEL_CNL_U_GT2_IDS(&intel_cannonlake_gt2_info),
  555. INTEL_CNL_Y_GT2_IDS(&intel_cannonlake_gt2_info),
  556. {0, 0, 0}
  557. };
  558. MODULE_DEVICE_TABLE(pci, pciidlist);
  559. static void i915_pci_remove(struct pci_dev *pdev)
  560. {
  561. struct drm_device *dev = pci_get_drvdata(pdev);
  562. i915_driver_unload(dev);
  563. drm_dev_put(dev);
  564. }
  565. static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  566. {
  567. struct intel_device_info *intel_info =
  568. (struct intel_device_info *) ent->driver_data;
  569. int err;
  570. if (IS_ALPHA_SUPPORT(intel_info) && !i915_modparams.alpha_support) {
  571. DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n"
  572. "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n"
  573. "to enable support in this kernel version, or check for kernel updates.\n");
  574. return -ENODEV;
  575. }
  576. /* Only bind to function 0 of the device. Early generations
  577. * used function 1 as a placeholder for multi-head. This causes
  578. * us confusion instead, especially on the systems where both
  579. * functions have the same PCI-ID!
  580. */
  581. if (PCI_FUNC(pdev->devfn))
  582. return -ENODEV;
  583. /*
  584. * apple-gmux is needed on dual GPU MacBook Pro
  585. * to probe the panel if we're the inactive GPU.
  586. */
  587. if (vga_switcheroo_client_probe_defer(pdev))
  588. return -EPROBE_DEFER;
  589. err = i915_driver_load(pdev, ent);
  590. if (err)
  591. return err;
  592. err = i915_live_selftests(pdev);
  593. if (err) {
  594. i915_pci_remove(pdev);
  595. return err > 0 ? -ENOTTY : err;
  596. }
  597. return 0;
  598. }
  599. static struct pci_driver i915_pci_driver = {
  600. .name = DRIVER_NAME,
  601. .id_table = pciidlist,
  602. .probe = i915_pci_probe,
  603. .remove = i915_pci_remove,
  604. .driver.pm = &i915_pm_ops,
  605. };
  606. static int __init i915_init(void)
  607. {
  608. bool use_kms = true;
  609. int err;
  610. err = i915_mock_selftests();
  611. if (err)
  612. return err > 0 ? 0 : err;
  613. /*
  614. * Enable KMS by default, unless explicitly overriden by
  615. * either the i915.modeset prarameter or by the
  616. * vga_text_mode_force boot option.
  617. */
  618. if (i915_modparams.modeset == 0)
  619. use_kms = false;
  620. if (vgacon_text_force() && i915_modparams.modeset == -1)
  621. use_kms = false;
  622. if (!use_kms) {
  623. /* Silently fail loading to not upset userspace. */
  624. DRM_DEBUG_DRIVER("KMS disabled.\n");
  625. return 0;
  626. }
  627. return pci_register_driver(&i915_pci_driver);
  628. }
  629. static void __exit i915_exit(void)
  630. {
  631. if (!i915_pci_driver.driver.owner)
  632. return;
  633. pci_unregister_driver(&i915_pci_driver);
  634. }
  635. module_init(i915_init);
  636. module_exit(i915_exit);
  637. MODULE_AUTHOR("Tungsten Graphics, Inc.");
  638. MODULE_AUTHOR("Intel Corporation");
  639. MODULE_DESCRIPTION(DRIVER_DESC);
  640. MODULE_LICENSE("GPL and additional rights");