xref: /linux/drivers/char/agp/sis-agp.c (revision 0bbed20e0518f6b9d46b7fe2bd044e3398a6dc40)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * SiS AGPGART routines.
31da177e4SLinus Torvalds  */
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds #include <linux/module.h>
61da177e4SLinus Torvalds #include <linux/pci.h>
71da177e4SLinus Torvalds #include <linux/init.h>
81da177e4SLinus Torvalds #include <linux/agp_backend.h>
91da177e4SLinus Torvalds #include <linux/delay.h>
101da177e4SLinus Torvalds #include "agp.h"
111da177e4SLinus Torvalds 
121da177e4SLinus Torvalds #define SIS_ATTBASE	0x90
131da177e4SLinus Torvalds #define SIS_APSIZE	0x94
141da177e4SLinus Torvalds #define SIS_TLBCNTRL	0x97
151da177e4SLinus Torvalds #define SIS_TLBFLUSH	0x98
161da177e4SLinus Torvalds 
172e374748SChaoyu Chen #define PCI_DEVICE_ID_SI_662	0x0662
182e374748SChaoyu Chen #define PCI_DEVICE_ID_SI_671	0x0671
192e374748SChaoyu Chen 
20*0bbed20eSBill Pemberton static bool agp_sis_force_delay = 0;
21*0bbed20eSBill Pemberton static int agp_sis_agp_spec = -1;
221da177e4SLinus Torvalds 
231da177e4SLinus Torvalds static int sis_fetch_size(void)
241da177e4SLinus Torvalds {
251da177e4SLinus Torvalds 	u8 temp_size;
261da177e4SLinus Torvalds 	int i;
271da177e4SLinus Torvalds 	struct aper_size_info_8 *values;
281da177e4SLinus Torvalds 
291da177e4SLinus Torvalds 	pci_read_config_byte(agp_bridge->dev, SIS_APSIZE, &temp_size);
301da177e4SLinus Torvalds 	values = A_SIZE_8(agp_bridge->driver->aperture_sizes);
311da177e4SLinus Torvalds 	for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
321da177e4SLinus Torvalds 		if ((temp_size == values[i].size_value) ||
33b7d0640fSStuart Bennett 		    ((temp_size & ~(0x07)) ==
34b7d0640fSStuart Bennett 		     (values[i].size_value & ~(0x07)))) {
351da177e4SLinus Torvalds 			agp_bridge->previous_size =
361da177e4SLinus Torvalds 			    agp_bridge->current_size = (void *) (values + i);
371da177e4SLinus Torvalds 
381da177e4SLinus Torvalds 			agp_bridge->aperture_size_idx = i;
391da177e4SLinus Torvalds 			return values[i].size;
401da177e4SLinus Torvalds 		}
411da177e4SLinus Torvalds 	}
421da177e4SLinus Torvalds 
431da177e4SLinus Torvalds 	return 0;
441da177e4SLinus Torvalds }
451da177e4SLinus Torvalds 
461da177e4SLinus Torvalds static void sis_tlbflush(struct agp_memory *mem)
471da177e4SLinus Torvalds {
481da177e4SLinus Torvalds 	pci_write_config_byte(agp_bridge->dev, SIS_TLBFLUSH, 0x02);
491da177e4SLinus Torvalds }
501da177e4SLinus Torvalds 
511da177e4SLinus Torvalds static int sis_configure(void)
521da177e4SLinus Torvalds {
531da177e4SLinus Torvalds 	u32 temp;
541da177e4SLinus Torvalds 	struct aper_size_info_8 *current_size;
551da177e4SLinus Torvalds 
561da177e4SLinus Torvalds 	current_size = A_SIZE_8(agp_bridge->current_size);
571da177e4SLinus Torvalds 	pci_write_config_byte(agp_bridge->dev, SIS_TLBCNTRL, 0x05);
581da177e4SLinus Torvalds 	pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
591da177e4SLinus Torvalds 	agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
601da177e4SLinus Torvalds 	pci_write_config_dword(agp_bridge->dev, SIS_ATTBASE,
611da177e4SLinus Torvalds 			       agp_bridge->gatt_bus_addr);
621da177e4SLinus Torvalds 	pci_write_config_byte(agp_bridge->dev, SIS_APSIZE,
631da177e4SLinus Torvalds 			      current_size->size_value);
641da177e4SLinus Torvalds 	return 0;
651da177e4SLinus Torvalds }
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds static void sis_cleanup(void)
681da177e4SLinus Torvalds {
691da177e4SLinus Torvalds 	struct aper_size_info_8 *previous_size;
701da177e4SLinus Torvalds 
711da177e4SLinus Torvalds 	previous_size = A_SIZE_8(agp_bridge->previous_size);
721da177e4SLinus Torvalds 	pci_write_config_byte(agp_bridge->dev, SIS_APSIZE,
731da177e4SLinus Torvalds 			      (previous_size->size_value & ~(0x03)));
741da177e4SLinus Torvalds }
751da177e4SLinus Torvalds 
761da177e4SLinus Torvalds static void sis_delayed_enable(struct agp_bridge_data *bridge, u32 mode)
771da177e4SLinus Torvalds {
781da177e4SLinus Torvalds 	struct pci_dev *device = NULL;
791da177e4SLinus Torvalds 	u32 command;
801da177e4SLinus Torvalds 	int rate;
811da177e4SLinus Torvalds 
82e3cf6951SBjorn Helgaas 	dev_info(&agp_bridge->dev->dev, "AGP %d.%d bridge\n",
83e3cf6951SBjorn Helgaas 		 agp_bridge->major_version, agp_bridge->minor_version);
841da177e4SLinus Torvalds 
851da177e4SLinus Torvalds 	pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx + PCI_AGP_STATUS, &command);
861da177e4SLinus Torvalds 	command = agp_collect_device_status(bridge, mode, command);
871da177e4SLinus Torvalds 	command |= AGPSTAT_AGP_ENABLE;
881da177e4SLinus Torvalds 	rate = (command & 0x7) << 2;
891da177e4SLinus Torvalds 
901da177e4SLinus Torvalds 	for_each_pci_dev(device) {
911da177e4SLinus Torvalds 		u8 agp = pci_find_capability(device, PCI_CAP_ID_AGP);
921da177e4SLinus Torvalds 		if (!agp)
931da177e4SLinus Torvalds 			continue;
941da177e4SLinus Torvalds 
95e3cf6951SBjorn Helgaas 		dev_info(&agp_bridge->dev->dev, "putting AGP V3 device at %s into %dx mode\n",
961da177e4SLinus Torvalds 			 pci_name(device), rate);
971da177e4SLinus Torvalds 
981da177e4SLinus Torvalds 		pci_write_config_dword(device, agp + PCI_AGP_COMMAND, command);
991da177e4SLinus Torvalds 
1001da177e4SLinus Torvalds 		/*
1011da177e4SLinus Torvalds 		 * Weird: on some sis chipsets any rate change in the target
1021da177e4SLinus Torvalds 		 * command register triggers a 5ms screwup during which the master
1031da177e4SLinus Torvalds 		 * cannot be configured
1041da177e4SLinus Torvalds 		 */
1051da177e4SLinus Torvalds 		if (device->device == bridge->dev->device) {
106e3cf6951SBjorn Helgaas 			dev_info(&agp_bridge->dev->dev, "SiS delay workaround: giving bridge time to recover\n");
1071da177e4SLinus Torvalds 			msleep(10);
1081da177e4SLinus Torvalds 		}
1091da177e4SLinus Torvalds 	}
1101da177e4SLinus Torvalds }
1111da177e4SLinus Torvalds 
112e5524f35SDave Jones static const struct aper_size_info_8 sis_generic_sizes[7] =
1131da177e4SLinus Torvalds {
1141da177e4SLinus Torvalds 	{256, 65536, 6, 99},
1151da177e4SLinus Torvalds 	{128, 32768, 5, 83},
1161da177e4SLinus Torvalds 	{64, 16384, 4, 67},
1171da177e4SLinus Torvalds 	{32, 8192, 3, 51},
1181da177e4SLinus Torvalds 	{16, 4096, 2, 35},
1191da177e4SLinus Torvalds 	{8, 2048, 1, 19},
1201da177e4SLinus Torvalds 	{4, 1024, 0, 3}
1211da177e4SLinus Torvalds };
1221da177e4SLinus Torvalds 
123408b664aSAdrian Bunk static struct agp_bridge_driver sis_driver = {
1241da177e4SLinus Torvalds 	.owner			= THIS_MODULE,
1251da177e4SLinus Torvalds 	.aperture_sizes		= sis_generic_sizes,
1261da177e4SLinus Torvalds 	.size_type		= U8_APER_SIZE,
1271da177e4SLinus Torvalds 	.num_aperture_sizes	= 7,
12861cf0593SJerome Glisse 	.needs_scratch_page	= true,
1291da177e4SLinus Torvalds 	.configure		= sis_configure,
1301da177e4SLinus Torvalds 	.fetch_size		= sis_fetch_size,
1311da177e4SLinus Torvalds 	.cleanup		= sis_cleanup,
1321da177e4SLinus Torvalds 	.tlb_flush		= sis_tlbflush,
1331da177e4SLinus Torvalds 	.mask_memory		= agp_generic_mask_memory,
1341da177e4SLinus Torvalds 	.masks			= NULL,
1351da177e4SLinus Torvalds 	.agp_enable		= agp_generic_enable,
1361da177e4SLinus Torvalds 	.cache_flush		= global_cache_flush,
1371da177e4SLinus Torvalds 	.create_gatt_table	= agp_generic_create_gatt_table,
1381da177e4SLinus Torvalds 	.free_gatt_table	= agp_generic_free_gatt_table,
1391da177e4SLinus Torvalds 	.insert_memory		= agp_generic_insert_memory,
1401da177e4SLinus Torvalds 	.remove_memory		= agp_generic_remove_memory,
1411da177e4SLinus Torvalds 	.alloc_by_type		= agp_generic_alloc_by_type,
1421da177e4SLinus Torvalds 	.free_by_type		= agp_generic_free_by_type,
1431da177e4SLinus Torvalds 	.agp_alloc_page		= agp_generic_alloc_page,
1445f310b63SRene Herman 	.agp_alloc_pages	= agp_generic_alloc_pages,
1451da177e4SLinus Torvalds 	.agp_destroy_page	= agp_generic_destroy_page,
1465f310b63SRene Herman 	.agp_destroy_pages	= agp_generic_destroy_pages,
147bf1e5989SThomas Hellstrom 	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
1481da177e4SLinus Torvalds };
1491da177e4SLinus Torvalds 
1501da177e4SLinus Torvalds // chipsets that require the 'delay hack'
151*0bbed20eSBill Pemberton static int sis_broken_chipsets[] = {
1521da177e4SLinus Torvalds 	PCI_DEVICE_ID_SI_648,
1531da177e4SLinus Torvalds 	PCI_DEVICE_ID_SI_746,
1541da177e4SLinus Torvalds 	0 // terminator
1551da177e4SLinus Torvalds };
1561da177e4SLinus Torvalds 
1571da177e4SLinus Torvalds static void __devinit sis_get_driver(struct agp_bridge_data *bridge)
1581da177e4SLinus Torvalds {
1591da177e4SLinus Torvalds 	int i;
1601da177e4SLinus Torvalds 
1611da177e4SLinus Torvalds 	for (i=0; sis_broken_chipsets[i]!=0; ++i)
1621da177e4SLinus Torvalds 		if (bridge->dev->device==sis_broken_chipsets[i])
1631da177e4SLinus Torvalds 			break;
1641da177e4SLinus Torvalds 
1651da177e4SLinus Torvalds 	if (sis_broken_chipsets[i] || agp_sis_force_delay)
1661da177e4SLinus Torvalds 		sis_driver.agp_enable=sis_delayed_enable;
1671da177e4SLinus Torvalds 
1681da177e4SLinus Torvalds 	// sis chipsets that indicate less than agp3.5
1691da177e4SLinus Torvalds 	// are not actually fully agp3 compliant
1701da177e4SLinus Torvalds 	if ((agp_bridge->major_version == 3 && agp_bridge->minor_version >= 5
1711da177e4SLinus Torvalds 	     && agp_sis_agp_spec!=0) || agp_sis_agp_spec==1) {
1721da177e4SLinus Torvalds 		sis_driver.aperture_sizes = agp3_generic_sizes;
1731da177e4SLinus Torvalds 		sis_driver.size_type = U16_APER_SIZE;
1741da177e4SLinus Torvalds 		sis_driver.num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES;
1751da177e4SLinus Torvalds 		sis_driver.configure = agp3_generic_configure;
1761da177e4SLinus Torvalds 		sis_driver.fetch_size = agp3_generic_fetch_size;
1771da177e4SLinus Torvalds 		sis_driver.cleanup = agp3_generic_cleanup;
1781da177e4SLinus Torvalds 		sis_driver.tlb_flush = agp3_generic_tlbflush;
1791da177e4SLinus Torvalds 	}
1801da177e4SLinus Torvalds }
1811da177e4SLinus Torvalds 
1821da177e4SLinus Torvalds 
1831da177e4SLinus Torvalds static int __devinit agp_sis_probe(struct pci_dev *pdev,
1841da177e4SLinus Torvalds 				   const struct pci_device_id *ent)
1851da177e4SLinus Torvalds {
1861da177e4SLinus Torvalds 	struct agp_bridge_data *bridge;
1871da177e4SLinus Torvalds 	u8 cap_ptr;
1881da177e4SLinus Torvalds 
1891da177e4SLinus Torvalds 	cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
1901da177e4SLinus Torvalds 	if (!cap_ptr)
1911da177e4SLinus Torvalds 		return -ENODEV;
1921da177e4SLinus Torvalds 
1931da177e4SLinus Torvalds 
194e3cf6951SBjorn Helgaas 	dev_info(&pdev->dev, "SiS chipset [%04x/%04x]\n",
195e3cf6951SBjorn Helgaas 		 pdev->vendor, pdev->device);
1961da177e4SLinus Torvalds 	bridge = agp_alloc_bridge();
1971da177e4SLinus Torvalds 	if (!bridge)
1981da177e4SLinus Torvalds 		return -ENOMEM;
1991da177e4SLinus Torvalds 
2001da177e4SLinus Torvalds 	bridge->driver = &sis_driver;
2011da177e4SLinus Torvalds 	bridge->dev = pdev;
2021da177e4SLinus Torvalds 	bridge->capndx = cap_ptr;
2031da177e4SLinus Torvalds 
2041da177e4SLinus Torvalds 	get_agp_version(bridge);
2051da177e4SLinus Torvalds 
2061da177e4SLinus Torvalds 	/* Fill in the mode register */
2071da177e4SLinus Torvalds 	pci_read_config_dword(pdev, bridge->capndx+PCI_AGP_STATUS, &bridge->mode);
2081da177e4SLinus Torvalds 	sis_get_driver(bridge);
2091da177e4SLinus Torvalds 
2101da177e4SLinus Torvalds 	pci_set_drvdata(pdev, bridge);
2111da177e4SLinus Torvalds 	return agp_add_bridge(bridge);
2121da177e4SLinus Torvalds }
2131da177e4SLinus Torvalds 
2141da177e4SLinus Torvalds static void __devexit agp_sis_remove(struct pci_dev *pdev)
2151da177e4SLinus Torvalds {
2161da177e4SLinus Torvalds 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
2171da177e4SLinus Torvalds 
2181da177e4SLinus Torvalds 	agp_remove_bridge(bridge);
2191da177e4SLinus Torvalds 	agp_put_bridge(bridge);
2201da177e4SLinus Torvalds }
2211da177e4SLinus Torvalds 
22216469a0eSStuart Bennett #ifdef CONFIG_PM
22316469a0eSStuart Bennett 
22416469a0eSStuart Bennett static int agp_sis_suspend(struct pci_dev *pdev, pm_message_t state)
22516469a0eSStuart Bennett {
22616469a0eSStuart Bennett 	pci_save_state(pdev);
22716469a0eSStuart Bennett 	pci_set_power_state(pdev, pci_choose_state(pdev, state));
22816469a0eSStuart Bennett 
22916469a0eSStuart Bennett 	return 0;
23016469a0eSStuart Bennett }
23116469a0eSStuart Bennett 
23216469a0eSStuart Bennett static int agp_sis_resume(struct pci_dev *pdev)
23316469a0eSStuart Bennett {
23416469a0eSStuart Bennett 	pci_set_power_state(pdev, PCI_D0);
23516469a0eSStuart Bennett 	pci_restore_state(pdev);
23616469a0eSStuart Bennett 
23716469a0eSStuart Bennett 	return sis_driver.configure();
23816469a0eSStuart Bennett }
23916469a0eSStuart Bennett 
24016469a0eSStuart Bennett #endif /* CONFIG_PM */
24116469a0eSStuart Bennett 
2421da177e4SLinus Torvalds static struct pci_device_id agp_sis_pci_table[] = {
2431da177e4SLinus Torvalds 	{
2441da177e4SLinus Torvalds 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
2451da177e4SLinus Torvalds 		.class_mask	= ~0,
2461da177e4SLinus Torvalds 		.vendor		= PCI_VENDOR_ID_SI,
24791397585SKrzysztof Helt 		.device		= PCI_DEVICE_ID_SI_5591,
24882eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
24982eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
25082eab130SOliver Neukum 	},
25182eab130SOliver Neukum 	{
25282eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
25382eab130SOliver Neukum 		.class_mask	= ~0,
25482eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
25582eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_530,
25682eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
25782eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
25882eab130SOliver Neukum 	},
25982eab130SOliver Neukum 	{
26082eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
26182eab130SOliver Neukum 		.class_mask	= ~0,
26282eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
26382eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_540,
26482eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
26582eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
26682eab130SOliver Neukum 	},
26782eab130SOliver Neukum 	{
26882eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
26982eab130SOliver Neukum 		.class_mask	= ~0,
27082eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
27182eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_550,
27282eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
27382eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
27482eab130SOliver Neukum 	},
27582eab130SOliver Neukum 	{
27682eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
27782eab130SOliver Neukum 		.class_mask	= ~0,
27882eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
27982eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_620,
28082eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
28182eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
28282eab130SOliver Neukum 	},
28382eab130SOliver Neukum 	{
28482eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
28582eab130SOliver Neukum 		.class_mask	= ~0,
28682eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
28782eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_630,
28882eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
28982eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
29082eab130SOliver Neukum 	},
29182eab130SOliver Neukum 	{
29282eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
29382eab130SOliver Neukum 		.class_mask	= ~0,
29482eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
29582eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_635,
29682eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
29782eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
29882eab130SOliver Neukum 	},
29982eab130SOliver Neukum 	{
30082eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
30182eab130SOliver Neukum 		.class_mask	= ~0,
30282eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
30382eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_645,
30482eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
30582eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
30682eab130SOliver Neukum 	},
30782eab130SOliver Neukum 	{
30882eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
30982eab130SOliver Neukum 		.class_mask	= ~0,
31082eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
31182eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_646,
31282eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
31382eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
31482eab130SOliver Neukum 	},
31582eab130SOliver Neukum 	{
31682eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
31782eab130SOliver Neukum 		.class_mask	= ~0,
31882eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
31982eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_648,
32082eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
32182eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
32282eab130SOliver Neukum 	},
32382eab130SOliver Neukum 	{
32482eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
32582eab130SOliver Neukum 		.class_mask	= ~0,
32682eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
32782eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_650,
32882eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
32982eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
33082eab130SOliver Neukum 	},
33182eab130SOliver Neukum 	{
33282eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
33382eab130SOliver Neukum 		.class_mask	= ~0,
33482eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
33582eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_651,
33682eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
33782eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
33882eab130SOliver Neukum 	},
33982eab130SOliver Neukum 	{
34082eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
34182eab130SOliver Neukum 		.class_mask	= ~0,
34282eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
34382eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_655,
34482eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
34582eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
34682eab130SOliver Neukum 	},
34782eab130SOliver Neukum 	{
34882eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
34982eab130SOliver Neukum 		.class_mask	= ~0,
35082eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
35182eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_661,
35282eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
35382eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
35482eab130SOliver Neukum 	},
35582eab130SOliver Neukum 	{
35682eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
35782eab130SOliver Neukum 		.class_mask	= ~0,
35882eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
3592e374748SChaoyu Chen 		.device		= PCI_DEVICE_ID_SI_662,
3602e374748SChaoyu Chen 		.subvendor	= PCI_ANY_ID,
3612e374748SChaoyu Chen 		.subdevice	= PCI_ANY_ID,
3622e374748SChaoyu Chen 	},
3632e374748SChaoyu Chen 	{
3642e374748SChaoyu Chen 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
3652e374748SChaoyu Chen 		.class_mask	= ~0,
3662e374748SChaoyu Chen 		.vendor		= PCI_VENDOR_ID_SI,
3672e374748SChaoyu Chen 		.device		= PCI_DEVICE_ID_SI_671,
3682e374748SChaoyu Chen 		.subvendor	= PCI_ANY_ID,
3692e374748SChaoyu Chen 		.subdevice	= PCI_ANY_ID,
3702e374748SChaoyu Chen 	},
3712e374748SChaoyu Chen 	{
3722e374748SChaoyu Chen 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
3732e374748SChaoyu Chen 		.class_mask	= ~0,
3742e374748SChaoyu Chen 		.vendor		= PCI_VENDOR_ID_SI,
37582eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_730,
37682eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
37782eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
37882eab130SOliver Neukum 	},
37982eab130SOliver Neukum 	{
38082eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
38182eab130SOliver Neukum 		.class_mask	= ~0,
38282eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
38382eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_735,
38482eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
38582eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
38682eab130SOliver Neukum 	},
38782eab130SOliver Neukum 	{
38882eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
38982eab130SOliver Neukum 		.class_mask	= ~0,
39082eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
39182eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_740,
39282eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
39382eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
39482eab130SOliver Neukum 	},
39582eab130SOliver Neukum 	{
39682eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
39782eab130SOliver Neukum 		.class_mask	= ~0,
39882eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
39982eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_741,
40082eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
40182eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
40282eab130SOliver Neukum 	},
40382eab130SOliver Neukum 	{
40482eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
40582eab130SOliver Neukum 		.class_mask	= ~0,
40682eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
40782eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_745,
40882eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
40982eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
41082eab130SOliver Neukum 	},
41182eab130SOliver Neukum 	{
41282eab130SOliver Neukum 		.class		= (PCI_CLASS_BRIDGE_HOST << 8),
41382eab130SOliver Neukum 		.class_mask	= ~0,
41482eab130SOliver Neukum 		.vendor		= PCI_VENDOR_ID_SI,
41582eab130SOliver Neukum 		.device		= PCI_DEVICE_ID_SI_746,
41682eab130SOliver Neukum 		.subvendor	= PCI_ANY_ID,
41782eab130SOliver Neukum 		.subdevice	= PCI_ANY_ID,
41882eab130SOliver Neukum 	},
4191da177e4SLinus Torvalds 	{ }
4201da177e4SLinus Torvalds };
4211da177e4SLinus Torvalds 
4221da177e4SLinus Torvalds MODULE_DEVICE_TABLE(pci, agp_sis_pci_table);
4231da177e4SLinus Torvalds 
4241da177e4SLinus Torvalds static struct pci_driver agp_sis_pci_driver = {
4251da177e4SLinus Torvalds 	.name		= "agpgart-sis",
4261da177e4SLinus Torvalds 	.id_table	= agp_sis_pci_table,
4271da177e4SLinus Torvalds 	.probe		= agp_sis_probe,
4281da177e4SLinus Torvalds 	.remove		= agp_sis_remove,
42916469a0eSStuart Bennett #ifdef CONFIG_PM
43016469a0eSStuart Bennett 	.suspend	= agp_sis_suspend,
43116469a0eSStuart Bennett 	.resume		= agp_sis_resume,
43216469a0eSStuart Bennett #endif
4331da177e4SLinus Torvalds };
4341da177e4SLinus Torvalds 
4351da177e4SLinus Torvalds static int __init agp_sis_init(void)
4361da177e4SLinus Torvalds {
4371da177e4SLinus Torvalds 	if (agp_off)
4381da177e4SLinus Torvalds 		return -EINVAL;
4391da177e4SLinus Torvalds 	return pci_register_driver(&agp_sis_pci_driver);
4401da177e4SLinus Torvalds }
4411da177e4SLinus Torvalds 
4421da177e4SLinus Torvalds static void __exit agp_sis_cleanup(void)
4431da177e4SLinus Torvalds {
4441da177e4SLinus Torvalds 	pci_unregister_driver(&agp_sis_pci_driver);
4451da177e4SLinus Torvalds }
4461da177e4SLinus Torvalds 
4471da177e4SLinus Torvalds module_init(agp_sis_init);
4481da177e4SLinus Torvalds module_exit(agp_sis_cleanup);
4491da177e4SLinus Torvalds 
4501da177e4SLinus Torvalds module_param(agp_sis_force_delay, bool, 0);
4511da177e4SLinus Torvalds MODULE_PARM_DESC(agp_sis_force_delay,"forces sis delay hack");
4521da177e4SLinus Torvalds module_param(agp_sis_agp_spec, int, 0);
4531da177e4SLinus Torvalds MODULE_PARM_DESC(agp_sis_agp_spec,"0=force sis init, 1=force generic agp3 init, default: autodetect");
4541da177e4SLinus Torvalds MODULE_LICENSE("GPL and additional rights");
455