aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 15:43:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 15:43:49 -0400
commita45fbc33137b11e479ea8b7d478a1d7e6488971b (patch)
tree947b39b8d39acd5db2d3a966921ec76443b9b5eb /drivers
parentc813b4e16ead3c3df98ac84419d4df2adf33fe01 (diff)
parenta64d2b37c2259e169759c1701ac565f0a11dc0ea (diff)
Merge branch 'agp-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6
* 'agp-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6: agp/nvidia: Support agp user-memory on nvidia agp. agp/amd-k7: Suspend support for AMD K7 GART driver agp/intel: Reduce extraneous PCI posting reads during init agp: Fix stolen memory counting on G4X.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/agp/amd-k7-agp.c38
-rw-r--r--drivers/char/agp/intel-agp.c18
-rw-r--r--drivers/char/agp/nvidia-agp.c22
3 files changed, 60 insertions, 18 deletions
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 603a986e96af..3f98254b911f 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -223,12 +223,14 @@ static int amd_irongate_configure(void)
223 223
224 current_size = A_SIZE_LVL2(agp_bridge->current_size); 224 current_size = A_SIZE_LVL2(agp_bridge->current_size);
225 225
226 /* Get the memory mapped registers */ 226 if (!amd_irongate_private.registers) {
227 pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp); 227 /* Get the memory mapped registers */
228 temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); 228 pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp);
229 amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); 229 temp = (temp & PCI_BASE_ADDRESS_MEM_MASK);
230 if (!amd_irongate_private.registers) 230 amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
231 return -ENOMEM; 231 if (!amd_irongate_private.registers)
232 return -ENOMEM;
233 }
232 234
233 /* Write out the address of the gatt table */ 235 /* Write out the address of the gatt table */
234 writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE); 236 writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE);
@@ -492,6 +494,26 @@ static void __devexit agp_amdk7_remove(struct pci_dev *pdev)
492 agp_put_bridge(bridge); 494 agp_put_bridge(bridge);
493} 495}
494 496
497#ifdef CONFIG_PM
498
499static int agp_amdk7_suspend(struct pci_dev *pdev, pm_message_t state)
500{
501 pci_save_state(pdev);
502 pci_set_power_state(pdev, pci_choose_state(pdev, state));
503
504 return 0;
505}
506
507static int agp_amdk7_resume(struct pci_dev *pdev)
508{
509 pci_set_power_state(pdev, PCI_D0);
510 pci_restore_state(pdev);
511
512 return amd_irongate_driver.configure();
513}
514
515#endif /* CONFIG_PM */
516
495/* must be the same order as name table above */ 517/* must be the same order as name table above */
496static struct pci_device_id agp_amdk7_pci_table[] = { 518static struct pci_device_id agp_amdk7_pci_table[] = {
497 { 519 {
@@ -528,6 +550,10 @@ static struct pci_driver agp_amdk7_pci_driver = {
528 .id_table = agp_amdk7_pci_table, 550 .id_table = agp_amdk7_pci_table,
529 .probe = agp_amdk7_probe, 551 .probe = agp_amdk7_probe,
530 .remove = agp_amdk7_remove, 552 .remove = agp_amdk7_remove,
553#ifdef CONFIG_PM
554 .suspend = agp_amdk7_suspend,
555 .resume = agp_amdk7_resume,
556#endif
531}; 557};
532 558
533static int __init agp_amdk7_init(void) 559static int __init agp_amdk7_init(void)
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 043e36628d6d..1108665913e2 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -54,8 +54,7 @@
54 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ 54 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \
55 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ 55 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
56 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \ 56 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \
57 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB || \ 57 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB)
58 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
59 58
60#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \ 59#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \
61 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \ 60 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \
@@ -63,7 +62,8 @@
63 62
64#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_E_HB || \ 63#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_E_HB || \
65 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \ 64 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \
66 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB) 65 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \
66 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
67 67
68extern int agp_memory_reserved; 68extern int agp_memory_reserved;
69 69
@@ -214,8 +214,8 @@ static int intel_i810_configure(void)
214 if (agp_bridge->driver->needs_scratch_page) { 214 if (agp_bridge->driver->needs_scratch_page) {
215 for (i = 0; i < current_size->num_entries; i++) { 215 for (i = 0; i < current_size->num_entries; i++) {
216 writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); 216 writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
217 readl(intel_private.registers+I810_PTE_BASE+(i*4)); /* PCI posting. */
218 } 217 }
218 readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI posting. */
219 } 219 }
220 global_cache_flush(); 220 global_cache_flush();
221 return 0; 221 return 0;
@@ -525,8 +525,10 @@ static void intel_i830_init_gtt_entries(void)
525 size += 4; 525 size += 4;
526 } else if (IS_G4X) { 526 } else if (IS_G4X) {
527 /* On 4 series hardware, GTT stolen is separate from graphics 527 /* On 4 series hardware, GTT stolen is separate from graphics
528 * stolen, ignore it in stolen gtt entries counting */ 528 * stolen, ignore it in stolen gtt entries counting. However,
529 size = 0; 529 * 4KB of the stolen memory doesn't get mapped to the GTT.
530 */
531 size = 4;
530 } else { 532 } else {
531 /* On previous hardware, the GTT size was just what was 533 /* On previous hardware, the GTT size was just what was
532 * required to map the aperture. 534 * required to map the aperture.
@@ -773,8 +775,8 @@ static int intel_i830_configure(void)
773 if (agp_bridge->driver->needs_scratch_page) { 775 if (agp_bridge->driver->needs_scratch_page) {
774 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { 776 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
775 writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); 777 writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
776 readl(intel_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */
777 } 778 }
779 readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI Posting. */
778 } 780 }
779 781
780 global_cache_flush(); 782 global_cache_flush();
@@ -989,8 +991,8 @@ static int intel_i915_configure(void)
989 if (agp_bridge->driver->needs_scratch_page) { 991 if (agp_bridge->driver->needs_scratch_page) {
990 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { 992 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
991 writel(agp_bridge->scratch_page, intel_private.gtt+i); 993 writel(agp_bridge->scratch_page, intel_private.gtt+i);
992 readl(intel_private.gtt+i); /* PCI Posting. */
993 } 994 }
995 readl(intel_private.gtt+i-1); /* PCI Posting. */
994 } 996 }
995 997
996 global_cache_flush(); 998 global_cache_flush();
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index dc70d3771811..5bbed3d79db9 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -201,10 +201,15 @@ extern int agp_memory_reserved;
201static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type) 201static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
202{ 202{
203 int i, j; 203 int i, j;
204 int mask_type;
204 205
205 if ((type != 0) || (mem->type != 0)) 206 mask_type = agp_generic_type_to_mask_type(mem->bridge, type);
207 if (mask_type != 0 || type != mem->type)
206 return -EINVAL; 208 return -EINVAL;
207 209
210 if (mem->page_count == 0)
211 return 0;
212
208 if ((pg_start + mem->page_count) > 213 if ((pg_start + mem->page_count) >
209 (nvidia_private.num_active_entries - agp_memory_reserved/PAGE_SIZE)) 214 (nvidia_private.num_active_entries - agp_memory_reserved/PAGE_SIZE))
210 return -EINVAL; 215 return -EINVAL;
@@ -220,10 +225,13 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type
220 } 225 }
221 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 226 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
222 writel(agp_bridge->driver->mask_memory(agp_bridge, 227 writel(agp_bridge->driver->mask_memory(agp_bridge,
223 mem->memory[i], mem->type), 228 mem->memory[i], mask_type),
224 agp_bridge->gatt_table+nvidia_private.pg_offset+j); 229 agp_bridge->gatt_table+nvidia_private.pg_offset+j);
225 readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j); /* PCI Posting. */
226 } 230 }
231
232 /* PCI Posting. */
233 readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j - 1);
234
227 agp_bridge->driver->tlb_flush(mem); 235 agp_bridge->driver->tlb_flush(mem);
228 return 0; 236 return 0;
229} 237}
@@ -233,9 +241,15 @@ static int nvidia_remove_memory(struct agp_memory *mem, off_t pg_start, int type
233{ 241{
234 int i; 242 int i;
235 243
236 if ((type != 0) || (mem->type != 0)) 244 int mask_type;
245
246 mask_type = agp_generic_type_to_mask_type(mem->bridge, type);
247 if (mask_type != 0 || type != mem->type)
237 return -EINVAL; 248 return -EINVAL;
238 249
250 if (mem->page_count == 0)
251 return 0;
252
239 for (i = pg_start; i < (mem->page_count + pg_start); i++) 253 for (i = pg_start; i < (mem->page_count + pg_start); i++)
240 writel(agp_bridge->scratch_page, agp_bridge->gatt_table+nvidia_private.pg_offset+i); 254 writel(agp_bridge->scratch_page, agp_bridge->gatt_table+nvidia_private.pg_offset+i);
241 255