i915_pci.c 19 KB

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