diff -uprN linux-2.6.9-vanilla/drivers/char/agp/ali-agp.c linux-2.6.9/drivers/char/agp/ali-agp.c --- linux-2.6.9-vanilla/drivers/char/agp/ali-agp.c 2004-10-19 05:54:38.000000000 +0800 +++ linux-2.6.9/drivers/char/agp/ali-agp.c 2004-11-19 14:21:27.815734928 +0800 @@ -277,6 +277,14 @@ static struct agp_device_ids ali_agp_dev .device_id = PCI_DEVICE_ID_AL_M1671, .chipset_name = "M1671", }, + { + .device_id = PCI_DEVICE_ID_AL_M1681, + .chipset_name = "M1681", + }, + { + .device_id = PCI_DEVICE_ID_AL_M1683, + .chipset_name = "M1683", + }, { }, /* dummy final entry, always present */ }; diff -uprN linux-2.6.9-vanilla/drivers/char/agp/amd64-agp.c linux-2.6.9/drivers/char/agp/amd64-agp.c --- linux-2.6.9-vanilla/drivers/char/agp/amd64-agp.c 2004-10-19 05:54:38.000000000 +0800 +++ linux-2.6.9/drivers/char/agp/amd64-agp.c 2004-11-19 14:21:37.120320416 +0800 @@ -46,6 +46,15 @@ #define NVIDIA_X86_64_1_APBASE2 0xd8 #define NVIDIA_X86_64_1_APLIMIT2 0xdc +//////////////////////////////////////////// +// ++ ULi +/* ULi K8 registers */ +#define ULI_X86_64_BASE_ADDR 0x10 +#define ULI_X86_64_HTT_FEA_REG 0x50 +#define ULI_X86_64_ENU_SCR_REG 0x54 +// -- ULi +//////////////////////////////////////////// + static int nr_garts; static struct pci_dev * hammers[MAX_HAMMER_GARTS]; @@ -405,6 +414,66 @@ static void __devinit amd8151_init(struc } } + +////////////////////////////////////////////////////// +// ++ULi +static struct aper_size_info_32 uli_sizes[7] = +{ + {256, 65536, 6, 10}, + {128, 32768, 5, 9}, + {64, 16384, 4, 8}, + {32, 8192, 3, 7}, + {16, 4096, 2, 6}, + {8, 2048, 1, 4}, + {4, 1024, 0, 3} +}; +static int __devinit uli_agp_init(struct pci_dev *pdev) +{ + u32 httfea,baseaddr,enuscr; + struct pci_dev *dev1; + int i; + unsigned size = amd64_fetch_size(); + printk(KERN_INFO "Setting up ULi AGP. \n"); + dev1 = pci_find_slot ((unsigned int)pdev->bus->number,PCI_DEVFN(0,0)); + if (dev1 == NULL) { + printk(KERN_INFO PFX "agpgart: Detected a ULi chipset, " + "but could not fine the secondary device.\n"); + return -ENODEV; + } + for (i = 0; i < ARRAY_SIZE(uli_sizes); i++) + if (uli_sizes[i].size == size) + break; + + if (i == ARRAY_SIZE(uli_sizes)) { + printk(KERN_INFO PFX "No ULi size found for %d\n", size); + return -ENODEV; + } + + + /* shadow x86-64 registers into ULi registers */ + pci_read_config_dword (hammers[0], AMD64_GARTAPERTUREBASE, &httfea); + + /* if x86-64 aperture base is beyond 4G, exit here */ + if ( (httfea & 0x7fff) >> (32 - 25) ) + return -ENODEV; + + httfea = (httfea& 0x7fff) << 25; + + pci_read_config_dword(pdev, ULI_X86_64_BASE_ADDR, &baseaddr); + baseaddr&= ~PCI_BASE_ADDRESS_MEM_MASK; + baseaddr|= httfea; + pci_write_config_dword(pdev, ULI_X86_64_BASE_ADDR, baseaddr); + + enuscr= httfea+ (size * 1024 * 1024) - 1; + pci_write_config_dword(dev1, ULI_X86_64_HTT_FEA_REG, httfea); + pci_write_config_dword(dev1, ULI_X86_64_ENU_SCR_REG, enuscr); + return 0; +} +// --ULi +///////////////////////////////////////////////////////////////////// + + + static struct aper_size_info_32 nforce3_sizes[5] = { {512, 131072, 7, 0x00000000 }, @@ -513,6 +582,18 @@ static int __devinit agp_amd64_probe(str } } + //////////////////////////////////////////// + // ++ULi + if (pdev->vendor == PCI_VENDOR_ID_AL) { + int ret = uli_agp_init(pdev); + if (ret) { + agp_put_bridge(bridge); + return ret; + } + } + // --ULi + //////////////////////////////////////////// + pci_set_drvdata(pdev, bridge); return agp_add_bridge(bridge); } @@ -536,6 +617,19 @@ static struct pci_device_id agp_amd64_pc .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, + /////////////////////////////////////////////// + // ++ULi + /* ULi M1689 */ + { + .class = (PCI_CLASS_BRIDGE_HOST << 8), + .class_mask = ~0, + .vendor = PCI_VENDOR_ID_AL, + .device = PCI_DEVICE_ID_AL_M1689, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + // --ULi + /////////////////////////////////////////////// /* VIA K8T800Pro */ { .class = (PCI_CLASS_BRIDGE_HOST << 8), diff -uprN linux-2.6.9-vanilla/include/linux/pci_ids.h linux-2.6.9/include/linux/pci_ids.h --- linux-2.6.9-vanilla/include/linux/pci_ids.h 2004-10-19 05:55:36.000000000 +0800 +++ linux-2.6.9/include/linux/pci_ids.h 2004-11-19 14:22:13.000000000 +0800 @@ -1022,6 +1022,9 @@ #define PCI_DEVICE_ID_AL_M1647 0x1647 #define PCI_DEVICE_ID_AL_M1651 0x1651 #define PCI_DEVICE_ID_AL_M1671 0x1671 +#define PCI_DEVICE_ID_AL_M1681 0x1681 +#define PCI_DEVICE_ID_AL_M1683 0x1683 +#define PCI_DEVICE_ID_AL_M1689 0x1689 #define PCI_DEVICE_ID_AL_M1543 0x1543 #define PCI_DEVICE_ID_AL_M3307 0x3307 #define PCI_DEVICE_ID_AL_M4803 0x5215