diff options
-rw-r--r-- | drivers/char/agp/intel-gtt.c | 42 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 1 | ||||
-rw-r--r-- | include/drm/intel-gtt.h | 18 |
4 files changed, 38 insertions, 25 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 72f937615056..0a3e91ba0f2b 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "agp.h" | 25 | #include "agp.h" |
26 | #include "intel-agp.h" | 26 | #include "intel-agp.h" |
27 | #include <linux/intel-gtt.h> | 27 | #include <linux/intel-gtt.h> |
28 | #include <drm/intel-gtt.h> | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * If we have Intel graphics, we're not going to have anything other than | 31 | * If we have Intel graphics, we're not going to have anything other than |
@@ -81,17 +82,11 @@ static struct gatt_mask intel_gen6_masks[] = | |||
81 | }; | 82 | }; |
82 | 83 | ||
83 | static struct _intel_private { | 84 | static struct _intel_private { |
85 | struct intel_gtt base; | ||
84 | struct pci_dev *pcidev; /* device one */ | 86 | struct pci_dev *pcidev; /* device one */ |
85 | u8 __iomem *registers; | 87 | u8 __iomem *registers; |
86 | u32 __iomem *gtt; /* I915G */ | 88 | u32 __iomem *gtt; /* I915G */ |
87 | int num_dcache_entries; | 89 | int num_dcache_entries; |
88 | /* gtt_entries is the number of gtt entries that are already mapped | ||
89 | * to stolen memory. Stolen memory is larger than the memory mapped | ||
90 | * through gtt_entries, as it includes some reserved space for the BIOS | ||
91 | * popup and for the GTT. | ||
92 | */ | ||
93 | int gtt_entries; /* i830+ */ | ||
94 | int gtt_total_size; | ||
95 | union { | 90 | union { |
96 | void __iomem *i9xx_flush_page; | 91 | void __iomem *i9xx_flush_page; |
97 | void *i8xx_flush_page; | 92 | void *i8xx_flush_page; |
@@ -772,7 +767,7 @@ static void intel_i830_init_gtt_entries(void) | |||
772 | gtt_entries = 0; | 767 | gtt_entries = 0; |
773 | } | 768 | } |
774 | 769 | ||
775 | intel_private.gtt_entries = gtt_entries; | 770 | intel_private.base.gtt_stolen_entries = gtt_entries; |
776 | } | 771 | } |
777 | 772 | ||
778 | static void intel_i830_fini_flush(void) | 773 | static void intel_i830_fini_flush(void) |
@@ -849,7 +844,7 @@ static int intel_i830_create_gatt_table(struct agp_bridge_data *bridge) | |||
849 | 844 | ||
850 | /* we have to call this as early as possible after the MMIO base address is known */ | 845 | /* we have to call this as early as possible after the MMIO base address is known */ |
851 | intel_i830_init_gtt_entries(); | 846 | intel_i830_init_gtt_entries(); |
852 | if (intel_private.gtt_entries == 0) { | 847 | if (intel_private.base.gtt_stolen_entries == 0) { |
853 | iounmap(intel_private.registers); | 848 | iounmap(intel_private.registers); |
854 | return -ENOMEM; | 849 | return -ENOMEM; |
855 | } | 850 | } |
@@ -919,7 +914,7 @@ static int intel_i830_configure(void) | |||
919 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ | 914 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ |
920 | 915 | ||
921 | if (agp_bridge->driver->needs_scratch_page) { | 916 | if (agp_bridge->driver->needs_scratch_page) { |
922 | for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { | 917 | for (i = intel_private.base.gtt_stolen_entries; i < current_size->num_entries; i++) { |
923 | writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); | 918 | writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); |
924 | } | 919 | } |
925 | readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI Posting. */ | 920 | readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI Posting. */ |
@@ -950,10 +945,10 @@ static int intel_i830_insert_entries(struct agp_memory *mem, off_t pg_start, | |||
950 | temp = agp_bridge->current_size; | 945 | temp = agp_bridge->current_size; |
951 | num_entries = A_SIZE_FIX(temp)->num_entries; | 946 | num_entries = A_SIZE_FIX(temp)->num_entries; |
952 | 947 | ||
953 | if (pg_start < intel_private.gtt_entries) { | 948 | if (pg_start < intel_private.base.gtt_stolen_entries) { |
954 | dev_printk(KERN_DEBUG, &intel_private.pcidev->dev, | 949 | dev_printk(KERN_DEBUG, &intel_private.pcidev->dev, |
955 | "pg_start == 0x%.8lx, intel_private.gtt_entries == 0x%.8x\n", | 950 | "pg_start == 0x%.8lx, gtt_stolen_entries == 0x%.8x\n", |
956 | pg_start, intel_private.gtt_entries); | 951 | pg_start, intel_private.base.gtt_stolen_entries); |
957 | 952 | ||
958 | dev_info(&intel_private.pcidev->dev, | 953 | dev_info(&intel_private.pcidev->dev, |
959 | "trying to insert into local/stolen memory\n"); | 954 | "trying to insert into local/stolen memory\n"); |
@@ -1001,7 +996,7 @@ static int intel_i830_remove_entries(struct agp_memory *mem, off_t pg_start, | |||
1001 | if (mem->page_count == 0) | 996 | if (mem->page_count == 0) |
1002 | return 0; | 997 | return 0; |
1003 | 998 | ||
1004 | if (pg_start < intel_private.gtt_entries) { | 999 | if (pg_start < intel_private.base.gtt_stolen_entries) { |
1005 | dev_info(&intel_private.pcidev->dev, | 1000 | dev_info(&intel_private.pcidev->dev, |
1006 | "trying to disable local/stolen memory\n"); | 1001 | "trying to disable local/stolen memory\n"); |
1007 | return -EINVAL; | 1002 | return -EINVAL; |
@@ -1136,7 +1131,8 @@ static int intel_i9xx_configure(void) | |||
1136 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ | 1131 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ |
1137 | 1132 | ||
1138 | if (agp_bridge->driver->needs_scratch_page) { | 1133 | if (agp_bridge->driver->needs_scratch_page) { |
1139 | for (i = intel_private.gtt_entries; i < intel_private.gtt_total_size; i++) { | 1134 | for (i = intel_private.base.gtt_stolen_entries; i < |
1135 | intel_private.base.gtt_total_entries; i++) { | ||
1140 | writel(agp_bridge->scratch_page, intel_private.gtt+i); | 1136 | writel(agp_bridge->scratch_page, intel_private.gtt+i); |
1141 | } | 1137 | } |
1142 | readl(intel_private.gtt+i-1); /* PCI Posting. */ | 1138 | readl(intel_private.gtt+i-1); /* PCI Posting. */ |
@@ -1181,10 +1177,10 @@ static int intel_i915_insert_entries(struct agp_memory *mem, off_t pg_start, | |||
1181 | temp = agp_bridge->current_size; | 1177 | temp = agp_bridge->current_size; |
1182 | num_entries = A_SIZE_FIX(temp)->num_entries; | 1178 | num_entries = A_SIZE_FIX(temp)->num_entries; |
1183 | 1179 | ||
1184 | if (pg_start < intel_private.gtt_entries) { | 1180 | if (pg_start < intel_private.base.gtt_stolen_entries) { |
1185 | dev_printk(KERN_DEBUG, &intel_private.pcidev->dev, | 1181 | dev_printk(KERN_DEBUG, &intel_private.pcidev->dev, |
1186 | "pg_start == 0x%.8lx, intel_private.gtt_entries == 0x%.8x\n", | 1182 | "pg_start == 0x%.8lx, gtt_stolen_entries == 0x%.8x\n", |
1187 | pg_start, intel_private.gtt_entries); | 1183 | pg_start, intel_private.base.gtt_stolen_entries); |
1188 | 1184 | ||
1189 | dev_info(&intel_private.pcidev->dev, | 1185 | dev_info(&intel_private.pcidev->dev, |
1190 | "trying to insert into local/stolen memory\n"); | 1186 | "trying to insert into local/stolen memory\n"); |
@@ -1227,7 +1223,7 @@ static int intel_i915_remove_entries(struct agp_memory *mem, off_t pg_start, | |||
1227 | if (mem->page_count == 0) | 1223 | if (mem->page_count == 0) |
1228 | return 0; | 1224 | return 0; |
1229 | 1225 | ||
1230 | if (pg_start < intel_private.gtt_entries) { | 1226 | if (pg_start < intel_private.base.gtt_stolen_entries) { |
1231 | dev_info(&intel_private.pcidev->dev, | 1227 | dev_info(&intel_private.pcidev->dev, |
1232 | "trying to disable local/stolen memory\n"); | 1228 | "trying to disable local/stolen memory\n"); |
1233 | return -EINVAL; | 1229 | return -EINVAL; |
@@ -1323,7 +1319,7 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
1323 | if (!intel_private.gtt) | 1319 | if (!intel_private.gtt) |
1324 | return -ENOMEM; | 1320 | return -ENOMEM; |
1325 | 1321 | ||
1326 | intel_private.gtt_total_size = gtt_map_size / 4; | 1322 | intel_private.base.gtt_total_entries = gtt_map_size / 4; |
1327 | 1323 | ||
1328 | temp &= 0xfff80000; | 1324 | temp &= 0xfff80000; |
1329 | 1325 | ||
@@ -1338,7 +1334,7 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
1338 | 1334 | ||
1339 | /* we have to call this as early as possible after the MMIO base address is known */ | 1335 | /* we have to call this as early as possible after the MMIO base address is known */ |
1340 | intel_i830_init_gtt_entries(); | 1336 | intel_i830_init_gtt_entries(); |
1341 | if (intel_private.gtt_entries == 0) { | 1337 | if (intel_private.base.gtt_stolen_entries == 0) { |
1342 | iounmap(intel_private.gtt); | 1338 | iounmap(intel_private.gtt); |
1343 | iounmap(intel_private.registers); | 1339 | iounmap(intel_private.registers); |
1344 | return -ENOMEM; | 1340 | return -ENOMEM; |
@@ -1449,7 +1445,7 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge) | |||
1449 | if (!intel_private.gtt) | 1445 | if (!intel_private.gtt) |
1450 | return -ENOMEM; | 1446 | return -ENOMEM; |
1451 | 1447 | ||
1452 | intel_private.gtt_total_size = gtt_size / 4; | 1448 | intel_private.base.gtt_total_entries = gtt_size / 4; |
1453 | 1449 | ||
1454 | intel_private.registers = ioremap(temp, 128 * 4096); | 1450 | intel_private.registers = ioremap(temp, 128 * 4096); |
1455 | if (!intel_private.registers) { | 1451 | if (!intel_private.registers) { |
@@ -1462,7 +1458,7 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge) | |||
1462 | 1458 | ||
1463 | /* we have to call this as early as possible after the MMIO base address is known */ | 1459 | /* we have to call this as early as possible after the MMIO base address is known */ |
1464 | intel_i830_init_gtt_entries(); | 1460 | intel_i830_init_gtt_entries(); |
1465 | if (intel_private.gtt_entries == 0) { | 1461 | if (intel_private.base.gtt_stolen_entries == 0) { |
1466 | iounmap(intel_private.gtt); | 1462 | iounmap(intel_private.gtt); |
1467 | iounmap(intel_private.registers); | 1463 | iounmap(intel_private.registers); |
1468 | return -ENOMEM; | 1464 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 8d52f01a6d90..47228cb16901 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -42,8 +42,6 @@ | |||
42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
43 | #include <acpi/video.h> | 43 | #include <acpi/video.h> |
44 | 44 | ||
45 | extern int intel_max_stolen; /* from AGP driver */ | ||
46 | |||
47 | /** | 45 | /** |
48 | * Sets up the hardware status page for devices that need a physical address | 46 | * Sets up the hardware status page for devices that need a physical address |
49 | * in the register. | 47 | * in the register. |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index cfc8bfd0fd7e..d825ef207b2c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "intel_bios.h" | 34 | #include "intel_bios.h" |
35 | #include "intel_ringbuffer.h" | 35 | #include "intel_ringbuffer.h" |
36 | #include <linux/io-mapping.h> | 36 | #include <linux/io-mapping.h> |
37 | #include <drm/intel-gtt.h> | ||
37 | 38 | ||
38 | /* General customization: | 39 | /* General customization: |
39 | */ | 40 | */ |
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h new file mode 100644 index 000000000000..6769cb704e9b --- /dev/null +++ b/include/drm/intel-gtt.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* Common header for intel-gtt.ko and i915.ko */ | ||
2 | |||
3 | #ifndef _DRM_INTEL_GTT_H | ||
4 | #define _DRM_INTEL_GTT_H | ||
5 | extern int intel_max_stolen; /* from AGP driver */ | ||
6 | |||
7 | struct intel_gtt { | ||
8 | /* Number of stolen gtt entries at the beginning. */ | ||
9 | unsigned int gtt_stolen_entries; | ||
10 | /* Total number of gtt entries. */ | ||
11 | unsigned int gtt_total_entries; | ||
12 | /* Part of the gtt that is mappable by the cpu, for those chips where | ||
13 | * this is not the full gtt. */ | ||
14 | unsigned int gtt_mappable_entries; | ||
15 | }; | ||
16 | |||
17 | #endif | ||
18 | |||