forked from Minki/linux
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
* master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart: [AGPGART] sworks-agp: Switch to PCI ref counting APIs [AGPGART] Nvidia AGP: Use refcount aware PCI interfaces [AGPGART] Fix sparse warning in sgi-agp.c [AGPGART] Intel-agp adjustments [AGPGART] Move [un]map_page_into_agp into asm/agp.h [AGPGART] Add missing calls to global_flush_tlb() to ali-agp [AGPGART] prevent probe collision of sis-agp and amd64_agp
This commit is contained in:
commit
98b96173c7
@ -145,6 +145,7 @@ static void *m1541_alloc_page(struct agp_bridge_data *bridge)
|
||||
void *addr = agp_generic_alloc_page(agp_bridge);
|
||||
u32 temp;
|
||||
|
||||
global_flush_tlb();
|
||||
if (!addr)
|
||||
return NULL;
|
||||
|
||||
@ -160,6 +161,7 @@ static void ali_destroy_page(void * addr)
|
||||
if (addr) {
|
||||
global_cache_flush(); /* is this really needed? --hch */
|
||||
agp_generic_destroy_page(addr);
|
||||
global_flush_tlb();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,28 +51,6 @@ int agp_memory_reserved;
|
||||
*/
|
||||
EXPORT_SYMBOL_GPL(agp_memory_reserved);
|
||||
|
||||
#if defined(CONFIG_X86)
|
||||
int map_page_into_agp(struct page *page)
|
||||
{
|
||||
int i;
|
||||
i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE);
|
||||
/* Caller's responsibility to call global_flush_tlb() for
|
||||
* performance reasons */
|
||||
return i;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(map_page_into_agp);
|
||||
|
||||
int unmap_page_from_agp(struct page *page)
|
||||
{
|
||||
int i;
|
||||
i = change_page_attr(page, 1, PAGE_KERNEL);
|
||||
/* Caller's responsibility to call global_flush_tlb() for
|
||||
* performance reasons */
|
||||
return i;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(unmap_page_from_agp);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generic routines for handling agp_memory structures -
|
||||
* They use the basic page allocation routines to do the brunt of the work.
|
||||
|
@ -186,8 +186,9 @@ static void *i8xx_alloc_pages(void)
|
||||
return NULL;
|
||||
|
||||
if (change_page_attr(page, 4, PAGE_KERNEL_NOCACHE) < 0) {
|
||||
change_page_attr(page, 4, PAGE_KERNEL);
|
||||
global_flush_tlb();
|
||||
__free_page(page);
|
||||
__free_pages(page, 2);
|
||||
return NULL;
|
||||
}
|
||||
global_flush_tlb();
|
||||
@ -209,7 +210,7 @@ static void i8xx_destroy_pages(void *addr)
|
||||
global_flush_tlb();
|
||||
put_page(page);
|
||||
unlock_page(page);
|
||||
free_pages((unsigned long)addr, 2);
|
||||
__free_pages(page, 2);
|
||||
atomic_dec(&agp_bridge->current_memory_agp);
|
||||
}
|
||||
|
||||
@ -315,9 +316,6 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type)
|
||||
struct agp_memory *new;
|
||||
void *addr;
|
||||
|
||||
if (pg_count != 1 && pg_count != 4)
|
||||
return NULL;
|
||||
|
||||
switch (pg_count) {
|
||||
case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge);
|
||||
global_flush_tlb();
|
||||
|
@ -320,11 +320,11 @@ static int __devinit agp_nvidia_probe(struct pci_dev *pdev,
|
||||
u8 cap_ptr;
|
||||
|
||||
nvidia_private.dev_1 =
|
||||
pci_find_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 1));
|
||||
pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 1));
|
||||
nvidia_private.dev_2 =
|
||||
pci_find_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 2));
|
||||
pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 2));
|
||||
nvidia_private.dev_3 =
|
||||
pci_find_slot((unsigned int)pdev->bus->number, PCI_DEVFN(30, 0));
|
||||
pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(30, 0));
|
||||
|
||||
if (!nvidia_private.dev_1 || !nvidia_private.dev_2 || !nvidia_private.dev_3) {
|
||||
printk(KERN_INFO PFX "Detected an NVIDIA nForce/nForce2 "
|
||||
@ -443,6 +443,9 @@ static int __init agp_nvidia_init(void)
|
||||
static void __exit agp_nvidia_cleanup(void)
|
||||
{
|
||||
pci_unregister_driver(&agp_nvidia_pci_driver);
|
||||
pci_dev_put(nvidia_private.dev_1);
|
||||
pci_dev_put(nvidia_private.dev_2);
|
||||
pci_dev_put(nvidia_private.dev_3);
|
||||
}
|
||||
|
||||
module_init(agp_nvidia_init);
|
||||
|
@ -47,9 +47,8 @@ static void *sgi_tioca_alloc_page(struct agp_bridge_data *bridge)
|
||||
|
||||
nid = info->ca_closest_node;
|
||||
page = alloc_pages_node(nid, GFP_KERNEL, 0);
|
||||
if (page == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (!page)
|
||||
return NULL;
|
||||
|
||||
get_page(page);
|
||||
SetPageLocked(page);
|
||||
|
@ -143,96 +143,6 @@ static struct agp_bridge_driver sis_driver = {
|
||||
.agp_type_to_mask_type = agp_generic_type_to_mask_type,
|
||||
};
|
||||
|
||||
static struct agp_device_ids sis_agp_device_ids[] __devinitdata =
|
||||
{
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_5591_AGP,
|
||||
.chipset_name = "5591",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_530,
|
||||
.chipset_name = "530",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_540,
|
||||
.chipset_name = "540",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_550,
|
||||
.chipset_name = "550",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_620,
|
||||
.chipset_name = "620",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_630,
|
||||
.chipset_name = "630",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_635,
|
||||
.chipset_name = "635",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_645,
|
||||
.chipset_name = "645",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_646,
|
||||
.chipset_name = "646",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_648,
|
||||
.chipset_name = "648",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_650,
|
||||
.chipset_name = "650",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_651,
|
||||
.chipset_name = "651",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_655,
|
||||
.chipset_name = "655",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_661,
|
||||
.chipset_name = "661",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_730,
|
||||
.chipset_name = "730",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_735,
|
||||
.chipset_name = "735",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_740,
|
||||
.chipset_name = "740",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_741,
|
||||
.chipset_name = "741",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_745,
|
||||
.chipset_name = "745",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_746,
|
||||
.chipset_name = "746",
|
||||
},
|
||||
{
|
||||
.device_id = PCI_DEVICE_ID_SI_760,
|
||||
.chipset_name = "760",
|
||||
},
|
||||
{ }, /* dummy final entry, always present */
|
||||
};
|
||||
|
||||
|
||||
// chipsets that require the 'delay hack'
|
||||
static int sis_broken_chipsets[] __devinitdata = {
|
||||
PCI_DEVICE_ID_SI_648,
|
||||
@ -269,29 +179,15 @@ static void __devinit sis_get_driver(struct agp_bridge_data *bridge)
|
||||
static int __devinit agp_sis_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
{
|
||||
struct agp_device_ids *devs = sis_agp_device_ids;
|
||||
struct agp_bridge_data *bridge;
|
||||
u8 cap_ptr;
|
||||
int j;
|
||||
|
||||
cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
|
||||
if (!cap_ptr)
|
||||
return -ENODEV;
|
||||
|
||||
/* probe for known chipsets */
|
||||
for (j = 0; devs[j].chipset_name; j++) {
|
||||
if (pdev->device == devs[j].device_id) {
|
||||
printk(KERN_INFO PFX "Detected SiS %s chipset\n",
|
||||
devs[j].chipset_name);
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
printk(KERN_ERR PFX "Unsupported SiS chipset (device id: %04x)\n",
|
||||
pdev->device);
|
||||
return -ENODEV;
|
||||
|
||||
found:
|
||||
printk(KERN_INFO PFX "Detected SiS chipset - id:%i\n", pdev->device);
|
||||
bridge = agp_alloc_bridge();
|
||||
if (!bridge)
|
||||
return -ENOMEM;
|
||||
@ -320,12 +216,172 @@ static void __devexit agp_sis_remove(struct pci_dev *pdev)
|
||||
|
||||
static struct pci_device_id agp_sis_pci_table[] = {
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_ANY_ID,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_5591_AGP,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_530,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_540,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_550,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_620,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_630,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_635,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_645,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_646,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_648,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_650,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_651,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_655,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_661,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_730,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_735,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_740,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_741,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_745,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_746,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
.vendor = PCI_VENDOR_ID_SI,
|
||||
.device = PCI_DEVICE_ID_SI_760,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
@ -455,15 +455,6 @@ static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
|
||||
u32 temp, temp2;
|
||||
u8 cap_ptr = 0;
|
||||
|
||||
/* Everything is on func 1 here so we are hardcoding function one */
|
||||
bridge_dev = pci_find_slot((unsigned int)pdev->bus->number,
|
||||
PCI_DEVFN(0, 1));
|
||||
if (!bridge_dev) {
|
||||
printk(KERN_INFO PFX "Detected a Serverworks chipset "
|
||||
"but could not find the secondary device.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
|
||||
|
||||
switch (pdev->device) {
|
||||
@ -483,6 +474,15 @@ static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Everything is on func 1 here so we are hardcoding function one */
|
||||
bridge_dev = pci_get_bus_and_slot((unsigned int)pdev->bus->number,
|
||||
PCI_DEVFN(0, 1));
|
||||
if (!bridge_dev) {
|
||||
printk(KERN_INFO PFX "Detected a Serverworks chipset "
|
||||
"but could not find the secondary device.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
serverworks_private.svrwrks_dev = bridge_dev;
|
||||
serverworks_private.gart_addr_ofs = 0x10;
|
||||
|
||||
@ -515,7 +515,7 @@ static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
|
||||
|
||||
bridge->driver = &sworks_driver;
|
||||
bridge->dev_private_data = &serverworks_private,
|
||||
bridge->dev = pdev;
|
||||
bridge->dev = pci_dev_get(pdev);
|
||||
|
||||
pci_set_drvdata(pdev, bridge);
|
||||
return agp_add_bridge(bridge);
|
||||
@ -525,8 +525,11 @@ static void __devexit agp_serverworks_remove(struct pci_dev *pdev)
|
||||
{
|
||||
struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
|
||||
|
||||
pci_dev_put(bridge->dev);
|
||||
agp_remove_bridge(bridge);
|
||||
agp_put_bridge(bridge);
|
||||
pci_dev_put(serverworks_private.svrwrks_dev);
|
||||
serverworks_private.svrwrks_dev = NULL;
|
||||
}
|
||||
|
||||
static struct pci_device_id agp_serverworks_pci_table[] = {
|
||||
|
@ -12,8 +12,10 @@
|
||||
* data corruption on some CPUs.
|
||||
*/
|
||||
|
||||
int map_page_into_agp(struct page *page);
|
||||
int unmap_page_from_agp(struct page *page);
|
||||
/* Caller's responsibility to call global_flush_tlb() for
|
||||
* performance reasons */
|
||||
#define map_page_into_agp(page) change_page_attr(page, 1, PAGE_KERNEL_NOCACHE)
|
||||
#define unmap_page_from_agp(page) change_page_attr(page, 1, PAGE_KERNEL)
|
||||
#define flush_agp_mappings() global_flush_tlb()
|
||||
|
||||
/* Could use CLFLUSH here if the cpu supports it. But then it would
|
||||
|
@ -10,8 +10,10 @@
|
||||
* with different cachability attributes for the same page.
|
||||
*/
|
||||
|
||||
int map_page_into_agp(struct page *page);
|
||||
int unmap_page_from_agp(struct page *page);
|
||||
/* Caller's responsibility to call global_flush_tlb() for
|
||||
* performance reasons */
|
||||
#define map_page_into_agp(page) change_page_attr(page, 1, PAGE_KERNEL_NOCACHE)
|
||||
#define unmap_page_from_agp(page) change_page_attr(page, 1, PAGE_KERNEL)
|
||||
#define flush_agp_mappings() global_flush_tlb()
|
||||
|
||||
/* Could use CLFLUSH here if the cpu supports it. But then it would
|
||||
|
Loading…
Reference in New Issue
Block a user