aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2013-11-05 07:00:08 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-11-08 12:37:32 -0500
commit00fe639a56b40930bf27eabeef9a826344d8f4c4 (patch)
tree6b2d682242d0c6d651189290a4b5a5e27dbacf4c /drivers/char
parentab3c759a0461528fcfab155b97da69edbc24b5d0 (diff)
drm/i915: Make AGP support optional
We only depend on the intel-gtt module for GTT frobbign on older gens. The intel_agp module is optional, except for UMS and some old XvMC userland on gen3. So make AGP support optional. As before, we will fail the i915 init for UMS and gen3 KMS the same as before if intel_agp isn't around. intel-gtt.c is left with a somewhat ugly ifdef mess, but I'm going to save that for a later cleaning. At least my gen2 still works with the patch and CONFIG_AGP=n. v2: Make i915 depend on X86 and PCI, and intel-gtt depend on PCI Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Makefile2
-rw-r--r--drivers/char/agp/Kconfig5
-rw-r--r--drivers/char/agp/Makefile2
-rw-r--r--drivers/char/agp/intel-gtt.c18
4 files changed, 25 insertions, 2 deletions
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 7ff1d0d208a7..2d68054f9795 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -50,7 +50,7 @@ obj-$(CONFIG_GPIO_TB0219) += tb0219.o
50obj-$(CONFIG_TELCLOCK) += tlclk.o 50obj-$(CONFIG_TELCLOCK) += tlclk.o
51 51
52obj-$(CONFIG_MWAVE) += mwave/ 52obj-$(CONFIG_MWAVE) += mwave/
53obj-$(CONFIG_AGP) += agp/ 53obj-y += agp/
54obj-$(CONFIG_PCMCIA) += pcmcia/ 54obj-$(CONFIG_PCMCIA) += pcmcia/
55 55
56obj-$(CONFIG_HANGCHECK_TIMER) += hangcheck-timer.o 56obj-$(CONFIG_HANGCHECK_TIMER) += hangcheck-timer.o
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index d8b1b576556c..c528f96ee204 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -68,6 +68,7 @@ config AGP_AMD64
68config AGP_INTEL 68config AGP_INTEL
69 tristate "Intel 440LX/BX/GX, I8xx and E7x05 chipset support" 69 tristate "Intel 440LX/BX/GX, I8xx and E7x05 chipset support"
70 depends on AGP && X86 70 depends on AGP && X86
71 select INTEL_GTT
71 help 72 help
72 This option gives you AGP support for the GLX component of X 73 This option gives you AGP support for the GLX component of X
73 on Intel 440LX/BX/GX, 815, 820, 830, 840, 845, 850, 860, 875, 74 on Intel 440LX/BX/GX, 815, 820, 830, 840, 845, 850, 860, 875,
@@ -155,3 +156,7 @@ config AGP_SGI_TIOCA
155 This option gives you AGP GART support for the SGI TIO chipset 156 This option gives you AGP GART support for the SGI TIO chipset
156 for IA64 processors. 157 for IA64 processors.
157 158
159config INTEL_GTT
160 tristate
161 depends on X86 && PCI
162
diff --git a/drivers/char/agp/Makefile b/drivers/char/agp/Makefile
index 8eb56e273e75..604489bcdbf9 100644
--- a/drivers/char/agp/Makefile
+++ b/drivers/char/agp/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_AGP_HP_ZX1) += hp-agp.o
13obj-$(CONFIG_AGP_PARISC) += parisc-agp.o 13obj-$(CONFIG_AGP_PARISC) += parisc-agp.o
14obj-$(CONFIG_AGP_I460) += i460-agp.o 14obj-$(CONFIG_AGP_I460) += i460-agp.o
15obj-$(CONFIG_AGP_INTEL) += intel-agp.o 15obj-$(CONFIG_AGP_INTEL) += intel-agp.o
16obj-$(CONFIG_AGP_INTEL) += intel-gtt.o 16obj-$(CONFIG_INTEL_GTT) += intel-gtt.o
17obj-$(CONFIG_AGP_NVIDIA) += nvidia-agp.o 17obj-$(CONFIG_AGP_NVIDIA) += nvidia-agp.o
18obj-$(CONFIG_AGP_SGI_TIOCA) += sgi-agp.o 18obj-$(CONFIG_AGP_SGI_TIOCA) += sgi-agp.o
19obj-$(CONFIG_AGP_SIS) += sis-agp.o 19obj-$(CONFIG_AGP_SIS) += sis-agp.o
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index b8e2014cb9cb..078968d8d07d 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -94,6 +94,7 @@ static struct _intel_private {
94#define IS_IRONLAKE intel_private.driver->is_ironlake 94#define IS_IRONLAKE intel_private.driver->is_ironlake
95#define HAS_PGTBL_EN intel_private.driver->has_pgtbl_enable 95#define HAS_PGTBL_EN intel_private.driver->has_pgtbl_enable
96 96
97#if IS_ENABLED(CONFIG_AGP_INTEL)
97static int intel_gtt_map_memory(struct page **pages, 98static int intel_gtt_map_memory(struct page **pages,
98 unsigned int num_entries, 99 unsigned int num_entries,
99 struct sg_table *st) 100 struct sg_table *st)
@@ -168,6 +169,7 @@ static void i8xx_destroy_pages(struct page *page)
168 __free_pages(page, 2); 169 __free_pages(page, 2);
169 atomic_dec(&agp_bridge->current_memory_agp); 170 atomic_dec(&agp_bridge->current_memory_agp);
170} 171}
172#endif
171 173
172#define I810_GTT_ORDER 4 174#define I810_GTT_ORDER 4
173static int i810_setup(void) 175static int i810_setup(void)
@@ -209,6 +211,7 @@ static void i810_cleanup(void)
209 free_gatt_pages(intel_private.i81x_gtt_table, I810_GTT_ORDER); 211 free_gatt_pages(intel_private.i81x_gtt_table, I810_GTT_ORDER);
210} 212}
211 213
214#if IS_ENABLED(CONFIG_AGP_INTEL)
212static int i810_insert_dcache_entries(struct agp_memory *mem, off_t pg_start, 215static int i810_insert_dcache_entries(struct agp_memory *mem, off_t pg_start,
213 int type) 216 int type)
214{ 217{
@@ -289,6 +292,7 @@ static void intel_i810_free_by_type(struct agp_memory *curr)
289 } 292 }
290 kfree(curr); 293 kfree(curr);
291} 294}
295#endif
292 296
293static int intel_gtt_setup_scratch_page(void) 297static int intel_gtt_setup_scratch_page(void)
294{ 298{
@@ -647,7 +651,9 @@ static int intel_gtt_init(void)
647 return -ENOMEM; 651 return -ENOMEM;
648 } 652 }
649 653
654#if IS_ENABLED(CONFIG_AGP_INTEL)
650 global_cache_flush(); /* FIXME: ? */ 655 global_cache_flush(); /* FIXME: ? */
656#endif
651 657
652 intel_private.stolen_size = intel_gtt_stolen_size(); 658 intel_private.stolen_size = intel_gtt_stolen_size();
653 659
@@ -671,6 +677,7 @@ static int intel_gtt_init(void)
671 return 0; 677 return 0;
672} 678}
673 679
680#if IS_ENABLED(CONFIG_AGP_INTEL)
674static int intel_fake_agp_fetch_size(void) 681static int intel_fake_agp_fetch_size(void)
675{ 682{
676 int num_sizes = ARRAY_SIZE(intel_fake_agp_sizes); 683 int num_sizes = ARRAY_SIZE(intel_fake_agp_sizes);
@@ -689,6 +696,7 @@ static int intel_fake_agp_fetch_size(void)
689 696
690 return 0; 697 return 0;
691} 698}
699#endif
692 700
693static void i830_cleanup(void) 701static void i830_cleanup(void)
694{ 702{
@@ -801,6 +809,7 @@ static int i830_setup(void)
801 return 0; 809 return 0;
802} 810}
803 811
812#if IS_ENABLED(CONFIG_AGP_INTEL)
804static int intel_fake_agp_create_gatt_table(struct agp_bridge_data *bridge) 813static int intel_fake_agp_create_gatt_table(struct agp_bridge_data *bridge)
805{ 814{
806 agp_bridge->gatt_table_real = NULL; 815 agp_bridge->gatt_table_real = NULL;
@@ -825,6 +834,7 @@ static int intel_fake_agp_configure(void)
825 834
826 return 0; 835 return 0;
827} 836}
837#endif
828 838
829static bool i830_check_flags(unsigned int flags) 839static bool i830_check_flags(unsigned int flags)
830{ 840{
@@ -863,6 +873,7 @@ void intel_gtt_insert_sg_entries(struct sg_table *st,
863} 873}
864EXPORT_SYMBOL(intel_gtt_insert_sg_entries); 874EXPORT_SYMBOL(intel_gtt_insert_sg_entries);
865 875
876#if IS_ENABLED(CONFIG_AGP_INTEL)
866static void intel_gtt_insert_pages(unsigned int first_entry, 877static void intel_gtt_insert_pages(unsigned int first_entry,
867 unsigned int num_entries, 878 unsigned int num_entries,
868 struct page **pages, 879 struct page **pages,
@@ -928,6 +939,7 @@ out_err:
928 mem->is_flushed = true; 939 mem->is_flushed = true;
929 return ret; 940 return ret;
930} 941}
942#endif
931 943
932void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries) 944void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries)
933{ 945{
@@ -941,6 +953,7 @@ void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries)
941} 953}
942EXPORT_SYMBOL(intel_gtt_clear_range); 954EXPORT_SYMBOL(intel_gtt_clear_range);
943 955
956#if IS_ENABLED(CONFIG_AGP_INTEL)
944static int intel_fake_agp_remove_entries(struct agp_memory *mem, 957static int intel_fake_agp_remove_entries(struct agp_memory *mem,
945 off_t pg_start, int type) 958 off_t pg_start, int type)
946{ 959{
@@ -982,6 +995,7 @@ static struct agp_memory *intel_fake_agp_alloc_by_type(size_t pg_count,
982 /* always return NULL for other allocation types for now */ 995 /* always return NULL for other allocation types for now */
983 return NULL; 996 return NULL;
984} 997}
998#endif
985 999
986static int intel_alloc_chipset_flush_resource(void) 1000static int intel_alloc_chipset_flush_resource(void)
987{ 1001{
@@ -1138,6 +1152,7 @@ static int i9xx_setup(void)
1138 return 0; 1152 return 0;
1139} 1153}
1140 1154
1155#if IS_ENABLED(CONFIG_AGP_INTEL)
1141static const struct agp_bridge_driver intel_fake_agp_driver = { 1156static const struct agp_bridge_driver intel_fake_agp_driver = {
1142 .owner = THIS_MODULE, 1157 .owner = THIS_MODULE,
1143 .size_type = FIXED_APER_SIZE, 1158 .size_type = FIXED_APER_SIZE,
@@ -1159,6 +1174,7 @@ static const struct agp_bridge_driver intel_fake_agp_driver = {
1159 .agp_destroy_page = agp_generic_destroy_page, 1174 .agp_destroy_page = agp_generic_destroy_page,
1160 .agp_destroy_pages = agp_generic_destroy_pages, 1175 .agp_destroy_pages = agp_generic_destroy_pages,
1161}; 1176};
1177#endif
1162 1178
1163static const struct intel_gtt_driver i81x_gtt_driver = { 1179static const struct intel_gtt_driver i81x_gtt_driver = {
1164 .gen = 1, 1180 .gen = 1,
@@ -1376,11 +1392,13 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
1376 1392
1377 intel_private.refcount++; 1393 intel_private.refcount++;
1378 1394
1395#if IS_ENABLED(CONFIG_AGP_INTEL)
1379 if (bridge) { 1396 if (bridge) {
1380 bridge->driver = &intel_fake_agp_driver; 1397 bridge->driver = &intel_fake_agp_driver;
1381 bridge->dev_private_data = &intel_private; 1398 bridge->dev_private_data = &intel_private;
1382 bridge->dev = bridge_pdev; 1399 bridge->dev = bridge_pdev;
1383 } 1400 }
1401#endif
1384 1402
1385 intel_private.bridge_dev = pci_dev_get(bridge_pdev); 1403 intel_private.bridge_dev = pci_dev_get(bridge_pdev);
1386 1404