5 #include <linux/types.h>
6 #include <linux/module.h>
13 #define ALI_AGPCTRL 0xb8
14 #define ALI_ATTBASE 0xbc
15 #define ALI_TLBCTRL 0xc0
16 #define ALI_TAGCTRL 0xc4
17 #define ALI_CACHE_FLUSH_CTRL 0xD0
18 #define ALI_CACHE_FLUSH_ADDR_MASK 0xFFFFF000
19 #define ALI_CACHE_FLUSH_EN 0x100
21 static int ali_fetch_size(
void)
28 temp &= ~(0xfffffff0);
31 for (i = 0; i <
agp_bridge->driver->num_aperture_sizes; i++) {
34 agp_bridge->current_size = (
void *) (values + i);
36 return values[
i].
size;
49 temp |= (1<<0 | 1<<1);
53 static void ali_cleanup(
void)
63 ((temp & 0xffffff00) | 0x00000001|0x00000002));
67 ((temp & 0x00000ff0) | previous_size->
size_value));
70 static int ali_configure(
void)
79 temp = (((temp & 0x00000ff0) | (
agp_bridge->gatt_bus_addr & 0xfffff000))
97 case 1: nlvm_addr = 0x100000;
break;
98 case 2: nlvm_addr = 0x200000;
break;
99 case 3: nlvm_addr = 0x400000;
break;
100 case 4: nlvm_addr = 0x800000;
break;
101 case 6: nlvm_addr = 0x1000000;
break;
102 case 7: nlvm_addr = 0x2000000;
break;
103 case 8: nlvm_addr = 0x4000000;
break;
104 case 9: nlvm_addr = 0x8000000;
break;
105 case 10: nlvm_addr = 0x10000000;
break;
109 nlvm_addr&=0xfff00000;
126 static void m1541_cache_flush(
void)
159 static void ali_destroy_page(
struct page *page,
int flags)
170 static void m1541_destroy_page(
struct page *page,
int flags)
204 .aperture_sizes = ali_generic_sizes,
206 .num_aperture_sizes = 7,
207 .needs_scratch_page =
true,
208 .configure = ali_configure,
209 .fetch_size = ali_fetch_size,
210 .cleanup = ali_cleanup,
211 .tlb_flush = ali_tlbflush,
223 .agp_destroy_page = ali_destroy_page,
229 .aperture_sizes = ali_generic_sizes,
231 .num_aperture_sizes = 7,
232 .configure = ali_configure,
233 .fetch_size = ali_fetch_size,
234 .cleanup = ali_cleanup,
235 .tlb_flush = ali_tlbflush,
239 .cache_flush = m1541_cache_flush,
246 .agp_alloc_page = m1541_alloc_page,
247 .agp_destroy_page = m1541_destroy_page,
256 .chipset_name =
"M1541",
260 .chipset_name =
"M1621",
264 .chipset_name =
"M1631",
268 .chipset_name =
"M1632",
272 .chipset_name =
"M1641",
276 .chipset_name =
"M1644",
280 .chipset_name =
"M1647",
284 .chipset_name =
"M1651",
288 .chipset_name =
"M1671",
292 .chipset_name =
"M1681",
296 .chipset_name =
"M1683",
320 dev_err(&pdev->
dev,
"unsupported ALi chipset [%04x/%04x])\n",
335 bridge->
driver = &ali_m1541_bridge;
338 pci_read_config_byte(pdev, 0xFB, &hidden_1621_id);
339 switch (hidden_1621_id) {
363 bridge->
driver = &ali_generic_bridge;
369 pci_read_config_dword(pdev,
373 pci_set_drvdata(pdev, bridge);
399 static struct pci_driver agp_ali_pci_driver = {
400 .name =
"agpgart-ali",
401 .id_table = agp_ali_pci_table,
402 .probe = agp_ali_probe,
403 .remove = agp_ali_remove,
406 static int __init agp_ali_init(
void)
410 return pci_register_driver(&agp_ali_pci_driver);
413 static void __exit agp_ali_cleanup(
void)