diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-23 09:24:24 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-23 10:43:18 -0500 |
commit | c64f7ba5f1006d8c20eacafecf98d4d00a6902a0 (patch) | |
tree | 0309e263e05be06e718d6a07169802ac026aef68 /drivers/char/agp/intel-gtt.c | |
parent | 1b6064d79b9a1c5e5aa6fcc6855f3da5e639ff73 (diff) |
agp/intel: Remove confusion of stolen entries not stolen memory
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/char/agp/intel-gtt.c')
-rw-r--r-- | drivers/char/agp/intel-gtt.c | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 19919ef9d661..d2733e526a68 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -477,26 +477,17 @@ static const struct aper_size_info_fixed const intel_fake_agp_sizes[] = { | |||
477 | {512, 131072, 7}, | 477 | {512, 131072, 7}, |
478 | }; | 478 | }; |
479 | 479 | ||
480 | static unsigned int intel_gtt_stolen_entries(void) | 480 | static unsigned int intel_gtt_stolen_size(void) |
481 | { | 481 | { |
482 | u16 gmch_ctrl; | 482 | u16 gmch_ctrl; |
483 | u8 rdct; | 483 | u8 rdct; |
484 | int local = 0; | 484 | int local = 0; |
485 | static const int ddt[4] = { 0, 16, 32, 64 }; | 485 | static const int ddt[4] = { 0, 16, 32, 64 }; |
486 | unsigned int overhead_entries; | ||
487 | unsigned int stolen_size = 0; | 486 | unsigned int stolen_size = 0; |
488 | 487 | ||
489 | pci_read_config_word(intel_private.bridge_dev, | 488 | pci_read_config_word(intel_private.bridge_dev, |
490 | I830_GMCH_CTRL, &gmch_ctrl); | 489 | I830_GMCH_CTRL, &gmch_ctrl); |
491 | 490 | ||
492 | if (INTEL_GTT_GEN > 4 || IS_PINEVIEW) | ||
493 | overhead_entries = 0; | ||
494 | else | ||
495 | overhead_entries = intel_private.base.gtt_mappable_entries | ||
496 | / 1024; | ||
497 | |||
498 | overhead_entries += 1; /* BIOS popup */ | ||
499 | |||
500 | if (intel_private.bridge_dev->device == PCI_DEVICE_ID_INTEL_82830_HB || | 491 | if (intel_private.bridge_dev->device == PCI_DEVICE_ID_INTEL_82830_HB || |
501 | intel_private.bridge_dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { | 492 | intel_private.bridge_dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { |
502 | switch (gmch_ctrl & I830_GMCH_GMS_MASK) { | 493 | switch (gmch_ctrl & I830_GMCH_GMS_MASK) { |
@@ -631,7 +622,7 @@ static unsigned int intel_gtt_stolen_entries(void) | |||
631 | stolen_size = 0; | 622 | stolen_size = 0; |
632 | } | 623 | } |
633 | 624 | ||
634 | return stolen_size/KB(4) - overhead_entries; | 625 | return stolen_size; |
635 | } | 626 | } |
636 | 627 | ||
637 | static void i965_adjust_pgetbl_size(unsigned int size_flag) | 628 | static void i965_adjust_pgetbl_size(unsigned int size_flag) |
@@ -817,8 +808,8 @@ static int intel_gtt_init(void) | |||
817 | global_cache_flush(); /* FIXME: ? */ | 808 | global_cache_flush(); /* FIXME: ? */ |
818 | 809 | ||
819 | /* we have to call this as early as possible after the MMIO base address is known */ | 810 | /* we have to call this as early as possible after the MMIO base address is known */ |
820 | intel_private.base.gtt_stolen_entries = intel_gtt_stolen_entries(); | 811 | intel_private.base.stolen_size = intel_gtt_stolen_size(); |
821 | if (intel_private.base.gtt_stolen_entries == 0) { | 812 | if (intel_private.base.stolen_size == 0) { |
822 | intel_private.driver->cleanup(); | 813 | intel_private.driver->cleanup(); |
823 | iounmap(intel_private.registers); | 814 | iounmap(intel_private.registers); |
824 | iounmap(intel_private.gtt); | 815 | iounmap(intel_private.gtt); |
@@ -1006,8 +997,7 @@ static int intel_fake_agp_configure(void) | |||
1006 | 997 | ||
1007 | agp_bridge->gart_bus_addr = intel_private.gma_bus_addr; | 998 | agp_bridge->gart_bus_addr = intel_private.gma_bus_addr; |
1008 | 999 | ||
1009 | for (i = intel_private.base.gtt_stolen_entries; | 1000 | for (i = 0; i < intel_private.base.gtt_total_entries; i++) { |
1010 | i < intel_private.base.gtt_total_entries; i++) { | ||
1011 | intel_private.driver->write_entry(intel_private.scratch_page_dma, | 1001 | intel_private.driver->write_entry(intel_private.scratch_page_dma, |
1012 | i, 0); | 1002 | i, 0); |
1013 | } | 1003 | } |
@@ -1065,17 +1055,7 @@ static int intel_fake_agp_insert_entries(struct agp_memory *mem, | |||
1065 | if (mem->page_count == 0) | 1055 | if (mem->page_count == 0) |
1066 | goto out; | 1056 | goto out; |
1067 | 1057 | ||
1068 | if (pg_start < intel_private.base.gtt_stolen_entries) { | 1058 | if (pg_start + mem->page_count > intel_private.base.gtt_total_entries) |
1069 | dev_printk(KERN_DEBUG, &intel_private.pcidev->dev, | ||
1070 | "pg_start == 0x%.8lx, gtt_stolen_entries == 0x%.8x\n", | ||
1071 | pg_start, intel_private.base.gtt_stolen_entries); | ||
1072 | |||
1073 | dev_info(&intel_private.pcidev->dev, | ||
1074 | "trying to insert into local/stolen memory\n"); | ||
1075 | goto out_err; | ||
1076 | } | ||
1077 | |||
1078 | if ((pg_start + mem->page_count) > intel_private.base.gtt_total_entries) | ||
1079 | goto out_err; | 1059 | goto out_err; |
1080 | 1060 | ||
1081 | if (type != mem->type) | 1061 | if (type != mem->type) |
@@ -1118,12 +1098,6 @@ static int intel_fake_agp_remove_entries(struct agp_memory *mem, | |||
1118 | if (mem->page_count == 0) | 1098 | if (mem->page_count == 0) |
1119 | return 0; | 1099 | return 0; |
1120 | 1100 | ||
1121 | if (pg_start < intel_private.base.gtt_stolen_entries) { | ||
1122 | dev_info(&intel_private.pcidev->dev, | ||
1123 | "trying to disable local/stolen memory\n"); | ||
1124 | return -EINVAL; | ||
1125 | } | ||
1126 | |||
1127 | if (USE_PCI_DMA_API && INTEL_GTT_GEN > 2) | 1101 | if (USE_PCI_DMA_API && INTEL_GTT_GEN > 2) |
1128 | intel_agp_unmap_memory(mem); | 1102 | intel_agp_unmap_memory(mem); |
1129 | 1103 | ||
@@ -1629,7 +1603,7 @@ int intel_gmch_probe(struct pci_dev *pdev, | |||
1629 | } | 1603 | } |
1630 | EXPORT_SYMBOL(intel_gmch_probe); | 1604 | EXPORT_SYMBOL(intel_gmch_probe); |
1631 | 1605 | ||
1632 | struct intel_gtt *intel_gtt_get(void) | 1606 | const struct intel_gtt *intel_gtt_get(void) |
1633 | { | 1607 | { |
1634 | return &intel_private.base; | 1608 | return &intel_private.base; |
1635 | } | 1609 | } |