2 * SPDX-License-Identifier: MIT
4 * Copyright © 2021 Intel Corporation
7 #include <linux/console.h>
9 #include "gem/i915_gem_context.h"
10 #include "gem/i915_gem_object.h"
11 #include "i915_active.h"
12 #include "i915_buddy.h"
13 #include "i915_params.h"
15 #include "i915_perf.h"
16 #include "i915_request.h"
17 #include "i915_scheduler.h"
18 #include "i915_selftest.h"
21 static int i915_check_nomodeset(void)
26 * Enable KMS by default, unless explicitly overriden by
27 * either the i915.modeset prarameter or by the
28 * vga_text_mode_force boot option.
31 if (i915_modparams.modeset == 0)
34 if (vgacon_text_force() && i915_modparams.modeset == -1)
38 /* Silently fail loading to not upset userspace. */
39 DRM_DEBUG_DRIVER("KMS disabled.\n");
50 { .init = i915_check_nomodeset },
51 { .init = i915_active_module_init,
52 .exit = i915_active_module_exit },
53 { .init = i915_buddy_module_init,
54 .exit = i915_buddy_module_exit },
55 { .init = i915_context_module_init,
56 .exit = i915_context_module_exit },
57 { .init = i915_gem_context_module_init,
58 .exit = i915_gem_context_module_exit },
59 { .init = i915_objects_module_init,
60 .exit = i915_objects_module_exit },
61 { .init = i915_request_module_init,
62 .exit = i915_request_module_exit },
63 { .init = i915_scheduler_module_init,
64 .exit = i915_scheduler_module_exit },
65 { .init = i915_vma_module_init,
66 .exit = i915_vma_module_exit },
67 { .init = i915_mock_selftests },
68 { .init = i915_pmu_init,
69 .exit = i915_pmu_exit },
70 { .init = i915_register_pci_driver,
71 .exit = i915_unregister_pci_driver },
72 { .init = i915_perf_sysctl_register,
73 .exit = i915_perf_sysctl_unregister },
75 static int init_progress;
77 static int __init i915_init(void)
81 for (i = 0; i < ARRAY_SIZE(init_funcs); i++) {
82 err = init_funcs[i].init();
85 if (init_funcs[i].exit)
91 * Early-exit success is reserved for things which
92 * don't have an exit() function because we have no
93 * idea how far they got or how to partially tear
96 WARN_ON(init_funcs[i].exit);
106 static void __exit i915_exit(void)
110 for (i = init_progress - 1; i >= 0; i--) {
111 GEM_BUG_ON(i >= ARRAY_SIZE(init_funcs));
112 if (init_funcs[i].exit)
113 init_funcs[i].exit();
117 module_init(i915_init);
118 module_exit(i915_exit);
120 MODULE_AUTHOR("Tungsten Graphics, Inc.");
121 MODULE_AUTHOR("Intel Corporation");
123 MODULE_DESCRIPTION(DRIVER_DESC);
124 MODULE_LICENSE("GPL and additional rights");