diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-19 21:29:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-19 21:29:57 -0500 |
commit | 5d9c4a7de64d398604a978d267a6987f1f4025b7 (patch) | |
tree | e15ec482773e28babab19c0edc25bcb90a5f802b /drivers/char | |
parent | 3a93dc42f56c507d1034273d1e1d6f9b3ad94bb1 (diff) | |
parent | 44a207fc66c13c82f627178f9f858b8f3e76028f (diff) |
Merge branch 'agp-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6
* 'agp-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6:
agp: fix missing casts that produced a warning.
agp: add support for 662/671 to agp driver
fix historic ioremap() abuse in AGP
agp/sis: Suspend support for SiS AGP
agp/sis: Clear bit 2 from aperture size byte as well
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/agp/amd-k7-agp.c | 9 | ||||
-rw-r--r-- | drivers/char/agp/ati-agp.c | 16 | ||||
-rw-r--r-- | drivers/char/agp/generic.c | 9 | ||||
-rw-r--r-- | drivers/char/agp/sis-agp.c | 47 | ||||
-rw-r--r-- | drivers/char/agp/sworks-agp.c | 18 |
5 files changed, 71 insertions, 28 deletions
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index 87be46406da..d2866999214 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -41,6 +41,7 @@ static int amd_create_page_map(struct amd_page_map *page_map) | |||
41 | if (page_map->real == NULL) | 41 | if (page_map->real == NULL) |
42 | return -ENOMEM; | 42 | return -ENOMEM; |
43 | 43 | ||
44 | #ifndef CONFIG_X86 | ||
44 | SetPageReserved(virt_to_page(page_map->real)); | 45 | SetPageReserved(virt_to_page(page_map->real)); |
45 | global_cache_flush(); | 46 | global_cache_flush(); |
46 | page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), | 47 | page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), |
@@ -52,6 +53,10 @@ static int amd_create_page_map(struct amd_page_map *page_map) | |||
52 | return -ENOMEM; | 53 | return -ENOMEM; |
53 | } | 54 | } |
54 | global_cache_flush(); | 55 | global_cache_flush(); |
56 | #else | ||
57 | set_memory_uc((unsigned long)page_map->real, 1); | ||
58 | page_map->remapped = page_map->real; | ||
59 | #endif | ||
55 | 60 | ||
56 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { | 61 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { |
57 | writel(agp_bridge->scratch_page, page_map->remapped+i); | 62 | writel(agp_bridge->scratch_page, page_map->remapped+i); |
@@ -63,8 +68,12 @@ static int amd_create_page_map(struct amd_page_map *page_map) | |||
63 | 68 | ||
64 | static void amd_free_page_map(struct amd_page_map *page_map) | 69 | static void amd_free_page_map(struct amd_page_map *page_map) |
65 | { | 70 | { |
71 | #ifndef CONFIG_X86 | ||
66 | iounmap(page_map->remapped); | 72 | iounmap(page_map->remapped); |
67 | ClearPageReserved(virt_to_page(page_map->real)); | 73 | ClearPageReserved(virt_to_page(page_map->real)); |
74 | #else | ||
75 | set_memory_wb((unsigned long)page_map->real, 1); | ||
76 | #endif | ||
68 | free_page((unsigned long) page_map->real); | 77 | free_page((unsigned long) page_map->real); |
69 | } | 78 | } |
70 | 79 | ||
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 2d46b713c8f..55c97f62324 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c | |||
@@ -60,18 +60,9 @@ static int ati_create_page_map(struct ati_page_map *page_map) | |||
60 | if (page_map->real == NULL) | 60 | if (page_map->real == NULL) |
61 | return -ENOMEM; | 61 | return -ENOMEM; |
62 | 62 | ||
63 | SetPageReserved(virt_to_page(page_map->real)); | 63 | set_memory_uc((unsigned long)page_map->real, 1); |
64 | err = map_page_into_agp(virt_to_page(page_map->real)); | 64 | err = map_page_into_agp(virt_to_page(page_map->real)); |
65 | page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), | 65 | page_map->remapped = page_map->real; |
66 | PAGE_SIZE); | ||
67 | if (page_map->remapped == NULL || err) { | ||
68 | ClearPageReserved(virt_to_page(page_map->real)); | ||
69 | free_page((unsigned long) page_map->real); | ||
70 | page_map->real = NULL; | ||
71 | return -ENOMEM; | ||
72 | } | ||
73 | /*CACHE_FLUSH();*/ | ||
74 | global_cache_flush(); | ||
75 | 66 | ||
76 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { | 67 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { |
77 | writel(agp_bridge->scratch_page, page_map->remapped+i); | 68 | writel(agp_bridge->scratch_page, page_map->remapped+i); |
@@ -85,8 +76,7 @@ static int ati_create_page_map(struct ati_page_map *page_map) | |||
85 | static void ati_free_page_map(struct ati_page_map *page_map) | 76 | static void ati_free_page_map(struct ati_page_map *page_map) |
86 | { | 77 | { |
87 | unmap_page_from_agp(virt_to_page(page_map->real)); | 78 | unmap_page_from_agp(virt_to_page(page_map->real)); |
88 | iounmap(page_map->remapped); | 79 | set_memory_wb((unsigned long)page_map->real, 1); |
89 | ClearPageReserved(virt_to_page(page_map->real)); | ||
90 | free_page((unsigned long) page_map->real); | 80 | free_page((unsigned long) page_map->real); |
91 | } | 81 | } |
92 | 82 | ||
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index 7484bc759c4..7fc0c99a3a5 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -932,9 +932,14 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge) | |||
932 | agp_gatt_table = (void *)table; | 932 | agp_gatt_table = (void *)table; |
933 | 933 | ||
934 | bridge->driver->cache_flush(); | 934 | bridge->driver->cache_flush(); |
935 | #ifdef CONFIG_X86 | ||
936 | set_memory_uc((unsigned long)table, 1 << page_order); | ||
937 | bridge->gatt_table = (void *)table; | ||
938 | #else | ||
935 | bridge->gatt_table = ioremap_nocache(virt_to_gart(table), | 939 | bridge->gatt_table = ioremap_nocache(virt_to_gart(table), |
936 | (PAGE_SIZE * (1 << page_order))); | 940 | (PAGE_SIZE * (1 << page_order))); |
937 | bridge->driver->cache_flush(); | 941 | bridge->driver->cache_flush(); |
942 | #endif | ||
938 | 943 | ||
939 | if (bridge->gatt_table == NULL) { | 944 | if (bridge->gatt_table == NULL) { |
940 | for (page = virt_to_page(table); page <= virt_to_page(table_end); page++) | 945 | for (page = virt_to_page(table); page <= virt_to_page(table_end); page++) |
@@ -991,7 +996,11 @@ int agp_generic_free_gatt_table(struct agp_bridge_data *bridge) | |||
991 | * called, then all agp memory is deallocated and removed | 996 | * called, then all agp memory is deallocated and removed |
992 | * from the table. */ | 997 | * from the table. */ |
993 | 998 | ||
999 | #ifdef CONFIG_X86 | ||
1000 | set_memory_wb((unsigned long)bridge->gatt_table, 1 << page_order); | ||
1001 | #else | ||
994 | iounmap(bridge->gatt_table); | 1002 | iounmap(bridge->gatt_table); |
1003 | #endif | ||
995 | table = (char *) bridge->gatt_table_real; | 1004 | table = (char *) bridge->gatt_table_real; |
996 | table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1); | 1005 | table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1); |
997 | 1006 | ||
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c index eb1a1c73819..b6791846809 100644 --- a/drivers/char/agp/sis-agp.c +++ b/drivers/char/agp/sis-agp.c | |||
@@ -14,6 +14,9 @@ | |||
14 | #define SIS_TLBCNTRL 0x97 | 14 | #define SIS_TLBCNTRL 0x97 |
15 | #define SIS_TLBFLUSH 0x98 | 15 | #define SIS_TLBFLUSH 0x98 |
16 | 16 | ||
17 | #define PCI_DEVICE_ID_SI_662 0x0662 | ||
18 | #define PCI_DEVICE_ID_SI_671 0x0671 | ||
19 | |||
17 | static int __devinitdata agp_sis_force_delay = 0; | 20 | static int __devinitdata agp_sis_force_delay = 0; |
18 | static int __devinitdata agp_sis_agp_spec = -1; | 21 | static int __devinitdata agp_sis_agp_spec = -1; |
19 | 22 | ||
@@ -27,8 +30,8 @@ static int sis_fetch_size(void) | |||
27 | values = A_SIZE_8(agp_bridge->driver->aperture_sizes); | 30 | values = A_SIZE_8(agp_bridge->driver->aperture_sizes); |
28 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { | 31 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { |
29 | if ((temp_size == values[i].size_value) || | 32 | if ((temp_size == values[i].size_value) || |
30 | ((temp_size & ~(0x03)) == | 33 | ((temp_size & ~(0x07)) == |
31 | (values[i].size_value & ~(0x03)))) { | 34 | (values[i].size_value & ~(0x07)))) { |
32 | agp_bridge->previous_size = | 35 | agp_bridge->previous_size = |
33 | agp_bridge->current_size = (void *) (values + i); | 36 | agp_bridge->current_size = (void *) (values + i); |
34 | 37 | ||
@@ -214,6 +217,26 @@ static void __devexit agp_sis_remove(struct pci_dev *pdev) | |||
214 | agp_put_bridge(bridge); | 217 | agp_put_bridge(bridge); |
215 | } | 218 | } |
216 | 219 | ||
220 | #ifdef CONFIG_PM | ||
221 | |||
222 | static int agp_sis_suspend(struct pci_dev *pdev, pm_message_t state) | ||
223 | { | ||
224 | pci_save_state(pdev); | ||
225 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
226 | |||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static int agp_sis_resume(struct pci_dev *pdev) | ||
231 | { | ||
232 | pci_set_power_state(pdev, PCI_D0); | ||
233 | pci_restore_state(pdev); | ||
234 | |||
235 | return sis_driver.configure(); | ||
236 | } | ||
237 | |||
238 | #endif /* CONFIG_PM */ | ||
239 | |||
217 | static struct pci_device_id agp_sis_pci_table[] = { | 240 | static struct pci_device_id agp_sis_pci_table[] = { |
218 | { | 241 | { |
219 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | 242 | .class = (PCI_CLASS_BRIDGE_HOST << 8), |
@@ -331,6 +354,22 @@ static struct pci_device_id agp_sis_pci_table[] = { | |||
331 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | 354 | .class = (PCI_CLASS_BRIDGE_HOST << 8), |
332 | .class_mask = ~0, | 355 | .class_mask = ~0, |
333 | .vendor = PCI_VENDOR_ID_SI, | 356 | .vendor = PCI_VENDOR_ID_SI, |
357 | .device = PCI_DEVICE_ID_SI_662, | ||
358 | .subvendor = PCI_ANY_ID, | ||
359 | .subdevice = PCI_ANY_ID, | ||
360 | }, | ||
361 | { | ||
362 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | ||
363 | .class_mask = ~0, | ||
364 | .vendor = PCI_VENDOR_ID_SI, | ||
365 | .device = PCI_DEVICE_ID_SI_671, | ||
366 | .subvendor = PCI_ANY_ID, | ||
367 | .subdevice = PCI_ANY_ID, | ||
368 | }, | ||
369 | { | ||
370 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | ||
371 | .class_mask = ~0, | ||
372 | .vendor = PCI_VENDOR_ID_SI, | ||
334 | .device = PCI_DEVICE_ID_SI_730, | 373 | .device = PCI_DEVICE_ID_SI_730, |
335 | .subvendor = PCI_ANY_ID, | 374 | .subvendor = PCI_ANY_ID, |
336 | .subdevice = PCI_ANY_ID, | 375 | .subdevice = PCI_ANY_ID, |
@@ -393,6 +432,10 @@ static struct pci_driver agp_sis_pci_driver = { | |||
393 | .id_table = agp_sis_pci_table, | 432 | .id_table = agp_sis_pci_table, |
394 | .probe = agp_sis_probe, | 433 | .probe = agp_sis_probe, |
395 | .remove = agp_sis_remove, | 434 | .remove = agp_sis_remove, |
435 | #ifdef CONFIG_PM | ||
436 | .suspend = agp_sis_suspend, | ||
437 | .resume = agp_sis_resume, | ||
438 | #endif | ||
396 | }; | 439 | }; |
397 | 440 | ||
398 | static int __init agp_sis_init(void) | 441 | static int __init agp_sis_init(void) |
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c index 551ef25063e..e08934e58f3 100644 --- a/drivers/char/agp/sworks-agp.c +++ b/drivers/char/agp/sworks-agp.c | |||
@@ -52,28 +52,20 @@ static int serverworks_create_page_map(struct serverworks_page_map *page_map) | |||
52 | if (page_map->real == NULL) { | 52 | if (page_map->real == NULL) { |
53 | return -ENOMEM; | 53 | return -ENOMEM; |
54 | } | 54 | } |
55 | SetPageReserved(virt_to_page(page_map->real)); | 55 | |
56 | global_cache_flush(); | 56 | set_memory_uc((unsigned long)page_map->real, 1); |
57 | page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), | 57 | page_map->remapped = page_map->real; |
58 | PAGE_SIZE); | ||
59 | if (page_map->remapped == NULL) { | ||
60 | ClearPageReserved(virt_to_page(page_map->real)); | ||
61 | free_page((unsigned long) page_map->real); | ||
62 | page_map->real = NULL; | ||
63 | return -ENOMEM; | ||
64 | } | ||
65 | global_cache_flush(); | ||
66 | 58 | ||
67 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) | 59 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) |
68 | writel(agp_bridge->scratch_page, page_map->remapped+i); | 60 | writel(agp_bridge->scratch_page, page_map->remapped+i); |
61 | /* Red Pen: Everyone else does pci posting flush here */ | ||
69 | 62 | ||
70 | return 0; | 63 | return 0; |
71 | } | 64 | } |
72 | 65 | ||
73 | static void serverworks_free_page_map(struct serverworks_page_map *page_map) | 66 | static void serverworks_free_page_map(struct serverworks_page_map *page_map) |
74 | { | 67 | { |
75 | iounmap(page_map->remapped); | 68 | set_memory_wb((unsigned long)page_map->real, 1); |
76 | ClearPageReserved(virt_to_page(page_map->real)); | ||
77 | free_page((unsigned long) page_map->real); | 69 | free_page((unsigned long) page_map->real); |
78 | } | 70 | } |
79 | 71 | ||