i915_pci.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  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. GEN_DEFAULT_PIPEOFFSETS, \
  59. CURSOR_OFFSETS
  60. static const struct intel_device_info intel_i830_info = {
  61. GEN2_FEATURES,
  62. .platform = INTEL_I830,
  63. .is_mobile = 1, .cursor_needs_physical = 1,
  64. .num_pipes = 2, /* legal, last one wins */
  65. };
  66. static const struct intel_device_info intel_i845g_info = {
  67. GEN2_FEATURES,
  68. .platform = INTEL_I845G,
  69. };
  70. static const struct intel_device_info intel_i85x_info = {
  71. GEN2_FEATURES,
  72. .platform = INTEL_I85X, .is_mobile = 1,
  73. .num_pipes = 2, /* legal, last one wins */
  74. .cursor_needs_physical = 1,
  75. .has_fbc = 1,
  76. };
  77. static const struct intel_device_info intel_i865g_info = {
  78. GEN2_FEATURES,
  79. .platform = INTEL_I865G,
  80. };
  81. #define GEN3_FEATURES \
  82. .gen = 3, .num_pipes = 2, \
  83. .has_gmch_display = 1, \
  84. .ring_mask = RENDER_RING, \
  85. GEN_DEFAULT_PIPEOFFSETS, \
  86. CURSOR_OFFSETS
  87. static const struct intel_device_info intel_i915g_info = {
  88. GEN3_FEATURES,
  89. .platform = INTEL_I915G, .cursor_needs_physical = 1,
  90. .has_overlay = 1, .overlay_needs_physical = 1,
  91. .hws_needs_physical = 1,
  92. .unfenced_needs_alignment = 1,
  93. };
  94. static const struct intel_device_info intel_i915gm_info = {
  95. GEN3_FEATURES,
  96. .platform = INTEL_I915GM,
  97. .is_mobile = 1,
  98. .cursor_needs_physical = 1,
  99. .has_overlay = 1, .overlay_needs_physical = 1,
  100. .supports_tv = 1,
  101. .has_fbc = 1,
  102. .hws_needs_physical = 1,
  103. .unfenced_needs_alignment = 1,
  104. };
  105. static const struct intel_device_info intel_i945g_info = {
  106. GEN3_FEATURES,
  107. .platform = INTEL_I945G,
  108. .has_hotplug = 1, .cursor_needs_physical = 1,
  109. .has_overlay = 1, .overlay_needs_physical = 1,
  110. .hws_needs_physical = 1,
  111. .unfenced_needs_alignment = 1,
  112. };
  113. static const struct intel_device_info intel_i945gm_info = {
  114. GEN3_FEATURES,
  115. .platform = INTEL_I945GM, .is_mobile = 1,
  116. .has_hotplug = 1, .cursor_needs_physical = 1,
  117. .has_overlay = 1, .overlay_needs_physical = 1,
  118. .supports_tv = 1,
  119. .has_fbc = 1,
  120. .hws_needs_physical = 1,
  121. .unfenced_needs_alignment = 1,
  122. };
  123. static const struct intel_device_info intel_g33_info = {
  124. GEN3_FEATURES,
  125. .platform = INTEL_G33,
  126. .has_hotplug = 1,
  127. .has_overlay = 1,
  128. };
  129. static const struct intel_device_info intel_pineview_info = {
  130. GEN3_FEATURES,
  131. .platform = INTEL_PINEVIEW, .is_mobile = 1,
  132. .has_hotplug = 1,
  133. .has_overlay = 1,
  134. };
  135. #define GEN4_FEATURES \
  136. .gen = 4, .num_pipes = 2, \
  137. .has_hotplug = 1, \
  138. .has_gmch_display = 1, \
  139. .ring_mask = RENDER_RING, \
  140. GEN_DEFAULT_PIPEOFFSETS, \
  141. CURSOR_OFFSETS
  142. static const struct intel_device_info intel_i965g_info = {
  143. GEN4_FEATURES,
  144. .platform = INTEL_I965G,
  145. .has_overlay = 1,
  146. .hws_needs_physical = 1,
  147. };
  148. static const struct intel_device_info intel_i965gm_info = {
  149. GEN4_FEATURES,
  150. .platform = INTEL_I965GM,
  151. .is_mobile = 1, .has_fbc = 1,
  152. .has_overlay = 1,
  153. .supports_tv = 1,
  154. .hws_needs_physical = 1,
  155. };
  156. static const struct intel_device_info intel_g45_info = {
  157. GEN4_FEATURES,
  158. .platform = INTEL_G45,
  159. .has_pipe_cxsr = 1,
  160. .ring_mask = RENDER_RING | BSD_RING,
  161. };
  162. static const struct intel_device_info intel_gm45_info = {
  163. GEN4_FEATURES,
  164. .platform = INTEL_GM45,
  165. .is_mobile = 1, .has_fbc = 1,
  166. .has_pipe_cxsr = 1,
  167. .supports_tv = 1,
  168. .ring_mask = RENDER_RING | BSD_RING,
  169. };
  170. #define GEN5_FEATURES \
  171. .gen = 5, .num_pipes = 2, \
  172. .has_hotplug = 1, \
  173. .has_gmbus_irq = 1, \
  174. .ring_mask = RENDER_RING | BSD_RING, \
  175. GEN_DEFAULT_PIPEOFFSETS, \
  176. CURSOR_OFFSETS
  177. static const struct intel_device_info intel_ironlake_d_info = {
  178. GEN5_FEATURES,
  179. .platform = INTEL_IRONLAKE,
  180. };
  181. static const struct intel_device_info intel_ironlake_m_info = {
  182. GEN5_FEATURES,
  183. .platform = INTEL_IRONLAKE,
  184. .is_mobile = 1,
  185. };
  186. #define GEN6_FEATURES \
  187. .gen = 6, .num_pipes = 2, \
  188. .has_hotplug = 1, \
  189. .has_fbc = 1, \
  190. .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
  191. .has_llc = 1, \
  192. .has_rc6 = 1, \
  193. .has_rc6p = 1, \
  194. .has_gmbus_irq = 1, \
  195. .has_hw_contexts = 1, \
  196. .has_aliasing_ppgtt = 1, \
  197. GEN_DEFAULT_PIPEOFFSETS, \
  198. CURSOR_OFFSETS
  199. static const struct intel_device_info intel_sandybridge_d_info = {
  200. GEN6_FEATURES,
  201. .platform = INTEL_SANDYBRIDGE,
  202. };
  203. static const struct intel_device_info intel_sandybridge_m_info = {
  204. GEN6_FEATURES,
  205. .platform = INTEL_SANDYBRIDGE,
  206. .is_mobile = 1,
  207. };
  208. #define GEN7_FEATURES \
  209. .gen = 7, .num_pipes = 3, \
  210. .has_hotplug = 1, \
  211. .has_fbc = 1, \
  212. .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
  213. .has_llc = 1, \
  214. .has_rc6 = 1, \
  215. .has_rc6p = 1, \
  216. .has_gmbus_irq = 1, \
  217. .has_hw_contexts = 1, \
  218. .has_aliasing_ppgtt = 1, \
  219. .has_full_ppgtt = 1, \
  220. GEN_DEFAULT_PIPEOFFSETS, \
  221. IVB_CURSOR_OFFSETS
  222. static const struct intel_device_info intel_ivybridge_d_info = {
  223. GEN7_FEATURES,
  224. .platform = INTEL_IVYBRIDGE,
  225. .has_l3_dpf = 1,
  226. };
  227. static const struct intel_device_info intel_ivybridge_m_info = {
  228. GEN7_FEATURES,
  229. .platform = INTEL_IVYBRIDGE,
  230. .is_mobile = 1,
  231. .has_l3_dpf = 1,
  232. };
  233. static const struct intel_device_info intel_ivybridge_q_info = {
  234. GEN7_FEATURES,
  235. .platform = INTEL_IVYBRIDGE,
  236. .num_pipes = 0, /* legal, last one wins */
  237. .has_l3_dpf = 1,
  238. };
  239. static const struct intel_device_info intel_valleyview_info = {
  240. .platform = INTEL_VALLEYVIEW,
  241. .gen = 7,
  242. .is_lp = 1,
  243. .num_pipes = 2,
  244. .has_psr = 1,
  245. .has_runtime_pm = 1,
  246. .has_rc6 = 1,
  247. .has_gmbus_irq = 1,
  248. .has_hw_contexts = 1,
  249. .has_gmch_display = 1,
  250. .has_hotplug = 1,
  251. .has_aliasing_ppgtt = 1,
  252. .has_full_ppgtt = 1,
  253. .ring_mask = RENDER_RING | BSD_RING | BLT_RING,
  254. .display_mmio_offset = VLV_DISPLAY_BASE,
  255. GEN_DEFAULT_PIPEOFFSETS,
  256. CURSOR_OFFSETS
  257. };
  258. #define HSW_FEATURES \
  259. GEN7_FEATURES, \
  260. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
  261. .has_ddi = 1, \
  262. .has_fpga_dbg = 1, \
  263. .has_psr = 1, \
  264. .has_resource_streamer = 1, \
  265. .has_dp_mst = 1, \
  266. .has_rc6p = 0 /* RC6p removed-by HSW */, \
  267. .has_runtime_pm = 1
  268. static const struct intel_device_info intel_haswell_info = {
  269. HSW_FEATURES,
  270. .platform = INTEL_HASWELL,
  271. .has_l3_dpf = 1,
  272. };
  273. #define BDW_FEATURES \
  274. HSW_FEATURES, \
  275. BDW_COLORS, \
  276. .has_logical_ring_contexts = 1, \
  277. .has_full_48bit_ppgtt = 1, \
  278. .has_64bit_reloc = 1
  279. static const struct intel_device_info intel_broadwell_info = {
  280. BDW_FEATURES,
  281. .gen = 8,
  282. .platform = INTEL_BROADWELL,
  283. };
  284. static const struct intel_device_info intel_broadwell_gt3_info = {
  285. BDW_FEATURES,
  286. .gen = 8,
  287. .platform = INTEL_BROADWELL,
  288. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  289. };
  290. static const struct intel_device_info intel_cherryview_info = {
  291. .gen = 8, .num_pipes = 3,
  292. .has_hotplug = 1,
  293. .is_lp = 1,
  294. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
  295. .platform = INTEL_CHERRYVIEW,
  296. .has_64bit_reloc = 1,
  297. .has_psr = 1,
  298. .has_runtime_pm = 1,
  299. .has_resource_streamer = 1,
  300. .has_rc6 = 1,
  301. .has_gmbus_irq = 1,
  302. .has_hw_contexts = 1,
  303. .has_logical_ring_contexts = 1,
  304. .has_gmch_display = 1,
  305. .has_aliasing_ppgtt = 1,
  306. .has_full_ppgtt = 1,
  307. .display_mmio_offset = VLV_DISPLAY_BASE,
  308. GEN_CHV_PIPEOFFSETS,
  309. CURSOR_OFFSETS,
  310. CHV_COLORS,
  311. };
  312. static const struct intel_device_info intel_skylake_info = {
  313. BDW_FEATURES,
  314. .platform = INTEL_SKYLAKE,
  315. .gen = 9,
  316. .has_csr = 1,
  317. .has_guc = 1,
  318. .ddb_size = 896,
  319. };
  320. static const struct intel_device_info intel_skylake_gt3_info = {
  321. BDW_FEATURES,
  322. .platform = INTEL_SKYLAKE,
  323. .gen = 9,
  324. .has_csr = 1,
  325. .has_guc = 1,
  326. .ddb_size = 896,
  327. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  328. };
  329. #define GEN9_LP_FEATURES \
  330. .gen = 9, \
  331. .is_lp = 1, \
  332. .has_hotplug = 1, \
  333. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
  334. .num_pipes = 3, \
  335. .has_64bit_reloc = 1, \
  336. .has_ddi = 1, \
  337. .has_fpga_dbg = 1, \
  338. .has_fbc = 1, \
  339. .has_runtime_pm = 1, \
  340. .has_pooled_eu = 0, \
  341. .has_csr = 1, \
  342. .has_resource_streamer = 1, \
  343. .has_rc6 = 1, \
  344. .has_dp_mst = 1, \
  345. .has_gmbus_irq = 1, \
  346. .has_hw_contexts = 1, \
  347. .has_logical_ring_contexts = 1, \
  348. .has_guc = 1, \
  349. .has_decoupled_mmio = 1, \
  350. .has_aliasing_ppgtt = 1, \
  351. .has_full_ppgtt = 1, \
  352. .has_full_48bit_ppgtt = 1, \
  353. GEN_DEFAULT_PIPEOFFSETS, \
  354. IVB_CURSOR_OFFSETS, \
  355. BDW_COLORS
  356. static const struct intel_device_info intel_broxton_info = {
  357. GEN9_LP_FEATURES,
  358. .platform = INTEL_BROXTON,
  359. .ddb_size = 512,
  360. };
  361. static const struct intel_device_info intel_geminilake_info = {
  362. GEN9_LP_FEATURES,
  363. .platform = INTEL_GEMINILAKE,
  364. .is_alpha_support = 1,
  365. .ddb_size = 1024,
  366. .color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
  367. };
  368. static const struct intel_device_info intel_kabylake_info = {
  369. BDW_FEATURES,
  370. .platform = INTEL_KABYLAKE,
  371. .gen = 9,
  372. .has_csr = 1,
  373. .has_guc = 1,
  374. .ddb_size = 896,
  375. };
  376. static const struct intel_device_info intel_kabylake_gt3_info = {
  377. BDW_FEATURES,
  378. .platform = INTEL_KABYLAKE,
  379. .gen = 9,
  380. .has_csr = 1,
  381. .has_guc = 1,
  382. .ddb_size = 896,
  383. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  384. };
  385. /*
  386. * Make sure any device matches here are from most specific to most
  387. * general. For example, since the Quanta match is based on the subsystem
  388. * and subvendor IDs, we need it to come before the more general IVB
  389. * PCI ID matches, otherwise we'll use the wrong info struct above.
  390. */
  391. static const struct pci_device_id pciidlist[] = {
  392. INTEL_I830_IDS(&intel_i830_info),
  393. INTEL_I845G_IDS(&intel_i845g_info),
  394. INTEL_I85X_IDS(&intel_i85x_info),
  395. INTEL_I865G_IDS(&intel_i865g_info),
  396. INTEL_I915G_IDS(&intel_i915g_info),
  397. INTEL_I915GM_IDS(&intel_i915gm_info),
  398. INTEL_I945G_IDS(&intel_i945g_info),
  399. INTEL_I945GM_IDS(&intel_i945gm_info),
  400. INTEL_I965G_IDS(&intel_i965g_info),
  401. INTEL_G33_IDS(&intel_g33_info),
  402. INTEL_I965GM_IDS(&intel_i965gm_info),
  403. INTEL_GM45_IDS(&intel_gm45_info),
  404. INTEL_G45_IDS(&intel_g45_info),
  405. INTEL_PINEVIEW_IDS(&intel_pineview_info),
  406. INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info),
  407. INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),
  408. INTEL_SNB_D_IDS(&intel_sandybridge_d_info),
  409. INTEL_SNB_M_IDS(&intel_sandybridge_m_info),
  410. INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */
  411. INTEL_IVB_M_IDS(&intel_ivybridge_m_info),
  412. INTEL_IVB_D_IDS(&intel_ivybridge_d_info),
  413. INTEL_HSW_IDS(&intel_haswell_info),
  414. INTEL_VLV_IDS(&intel_valleyview_info),
  415. INTEL_BDW_GT12_IDS(&intel_broadwell_info),
  416. INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info),
  417. INTEL_BDW_RSVD_IDS(&intel_broadwell_info),
  418. INTEL_CHV_IDS(&intel_cherryview_info),
  419. INTEL_SKL_GT1_IDS(&intel_skylake_info),
  420. INTEL_SKL_GT2_IDS(&intel_skylake_info),
  421. INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),
  422. INTEL_SKL_GT4_IDS(&intel_skylake_gt3_info),
  423. INTEL_BXT_IDS(&intel_broxton_info),
  424. INTEL_GLK_IDS(&intel_geminilake_info),
  425. INTEL_KBL_GT1_IDS(&intel_kabylake_info),
  426. INTEL_KBL_GT2_IDS(&intel_kabylake_info),
  427. INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),
  428. INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info),
  429. {0, 0, 0}
  430. };
  431. MODULE_DEVICE_TABLE(pci, pciidlist);
  432. static void i915_pci_remove(struct pci_dev *pdev)
  433. {
  434. struct drm_device *dev = pci_get_drvdata(pdev);
  435. i915_driver_unload(dev);
  436. drm_dev_unref(dev);
  437. }
  438. static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  439. {
  440. struct intel_device_info *intel_info =
  441. (struct intel_device_info *) ent->driver_data;
  442. int err;
  443. if (IS_ALPHA_SUPPORT(intel_info) && !i915.alpha_support) {
  444. DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n"
  445. "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n"
  446. "to enable support in this kernel version, or check for kernel updates.\n");
  447. return -ENODEV;
  448. }
  449. /* Only bind to function 0 of the device. Early generations
  450. * used function 1 as a placeholder for multi-head. This causes
  451. * us confusion instead, especially on the systems where both
  452. * functions have the same PCI-ID!
  453. */
  454. if (PCI_FUNC(pdev->devfn))
  455. return -ENODEV;
  456. /*
  457. * apple-gmux is needed on dual GPU MacBook Pro
  458. * to probe the panel if we're the inactive GPU.
  459. */
  460. if (vga_switcheroo_client_probe_defer(pdev))
  461. return -EPROBE_DEFER;
  462. err = i915_driver_load(pdev, ent);
  463. if (err)
  464. return err;
  465. err = i915_live_selftests(pdev);
  466. if (err) {
  467. i915_pci_remove(pdev);
  468. return err > 0 ? -ENOTTY : err;
  469. }
  470. return 0;
  471. }
  472. static struct pci_driver i915_pci_driver = {
  473. .name = DRIVER_NAME,
  474. .id_table = pciidlist,
  475. .probe = i915_pci_probe,
  476. .remove = i915_pci_remove,
  477. .driver.pm = &i915_pm_ops,
  478. };
  479. static int __init i915_init(void)
  480. {
  481. bool use_kms = true;
  482. int err;
  483. err = i915_mock_selftests();
  484. if (err)
  485. return err > 0 ? 0 : err;
  486. /*
  487. * Enable KMS by default, unless explicitly overriden by
  488. * either the i915.modeset prarameter or by the
  489. * vga_text_mode_force boot option.
  490. */
  491. if (i915.modeset == 0)
  492. use_kms = false;
  493. if (vgacon_text_force() && i915.modeset == -1)
  494. use_kms = false;
  495. if (!use_kms) {
  496. /* Silently fail loading to not upset userspace. */
  497. DRM_DEBUG_DRIVER("KMS disabled.\n");
  498. return 0;
  499. }
  500. return pci_register_driver(&i915_pci_driver);
  501. }
  502. static void __exit i915_exit(void)
  503. {
  504. if (!i915_pci_driver.driver.owner)
  505. return;
  506. pci_unregister_driver(&i915_pci_driver);
  507. }
  508. module_init(i915_init);
  509. module_exit(i915_exit);
  510. MODULE_AUTHOR("Tungsten Graphics, Inc.");
  511. MODULE_AUTHOR("Intel Corporation");
  512. MODULE_DESCRIPTION(DRIVER_DESC);
  513. MODULE_LICENSE("GPL and additional rights");