forked from luck/tmp_suning_uos_patched
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
This commit is contained in:
commit
5d9c4a7de6
|
@ -134,6 +134,8 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
WARN_ON_ONCE(page_is_ram(pfn));
|
||||
|
||||
switch (mode) {
|
||||
case IOR_MODE_UNCACHED:
|
||||
default:
|
||||
|
|
|
@ -41,6 +41,7 @@ static int amd_create_page_map(struct amd_page_map *page_map)
|
|||
if (page_map->real == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
#ifndef CONFIG_X86
|
||||
SetPageReserved(virt_to_page(page_map->real));
|
||||
global_cache_flush();
|
||||
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)
|
|||
return -ENOMEM;
|
||||
}
|
||||
global_cache_flush();
|
||||
#else
|
||||
set_memory_uc((unsigned long)page_map->real, 1);
|
||||
page_map->remapped = page_map->real;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) {
|
||||
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)
|
|||
|
||||
static void amd_free_page_map(struct amd_page_map *page_map)
|
||||
{
|
||||
#ifndef CONFIG_X86
|
||||
iounmap(page_map->remapped);
|
||||
ClearPageReserved(virt_to_page(page_map->real));
|
||||
#else
|
||||
set_memory_wb((unsigned long)page_map->real, 1);
|
||||
#endif
|
||||
free_page((unsigned long) page_map->real);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,18 +60,9 @@ static int ati_create_page_map(struct ati_page_map *page_map)
|
|||
if (page_map->real == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
SetPageReserved(virt_to_page(page_map->real));
|
||||
set_memory_uc((unsigned long)page_map->real, 1);
|
||||
err = map_page_into_agp(virt_to_page(page_map->real));
|
||||
page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
|
||||
PAGE_SIZE);
|
||||
if (page_map->remapped == NULL || err) {
|
||||
ClearPageReserved(virt_to_page(page_map->real));
|
||||
free_page((unsigned long) page_map->real);
|
||||
page_map->real = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
/*CACHE_FLUSH();*/
|
||||
global_cache_flush();
|
||||
page_map->remapped = page_map->real;
|
||||
|
||||
for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) {
|
||||
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)
|
|||
static void ati_free_page_map(struct ati_page_map *page_map)
|
||||
{
|
||||
unmap_page_from_agp(virt_to_page(page_map->real));
|
||||
iounmap(page_map->remapped);
|
||||
ClearPageReserved(virt_to_page(page_map->real));
|
||||
set_memory_wb((unsigned long)page_map->real, 1);
|
||||
free_page((unsigned long) page_map->real);
|
||||
}
|
||||
|
||||
|
|
|
@ -932,9 +932,14 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
|
|||
agp_gatt_table = (void *)table;
|
||||
|
||||
bridge->driver->cache_flush();
|
||||
#ifdef CONFIG_X86
|
||||
set_memory_uc((unsigned long)table, 1 << page_order);
|
||||
bridge->gatt_table = (void *)table;
|
||||
#else
|
||||
bridge->gatt_table = ioremap_nocache(virt_to_gart(table),
|
||||
(PAGE_SIZE * (1 << page_order)));
|
||||
bridge->driver->cache_flush();
|
||||
#endif
|
||||
|
||||
if (bridge->gatt_table == NULL) {
|
||||
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)
|
|||
* called, then all agp memory is deallocated and removed
|
||||
* from the table. */
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
set_memory_wb((unsigned long)bridge->gatt_table, 1 << page_order);
|
||||
#else
|
||||
iounmap(bridge->gatt_table);
|
||||
#endif
|
||||
table = (char *) bridge->gatt_table_real;
|
||||
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#define SIS_TLBCNTRL 0x97
|
||||
#define SIS_TLBFLUSH 0x98
|
||||
|
||||
#define PCI_DEVICE_ID_SI_662 0x0662
|
||||
#define PCI_DEVICE_ID_SI_671 0x0671
|
||||
|
||||
static int __devinitdata agp_sis_force_delay = 0;
|
||||
static int __devinitdata agp_sis_agp_spec = -1;
|
||||
|
||||
|
@ -27,8 +30,8 @@ static int sis_fetch_size(void)
|
|||
values = A_SIZE_8(agp_bridge->driver->aperture_sizes);
|
||||
for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
|
||||
if ((temp_size == values[i].size_value) ||
|
||||
((temp_size & ~(0x03)) ==
|
||||
(values[i].size_value & ~(0x03)))) {
|
||||
((temp_size & ~(0x07)) ==
|
||||
(values[i].size_value & ~(0x07)))) {
|
||||
agp_bridge->previous_size =
|
||||
agp_bridge->current_size = (void *) (values + i);
|
||||
|
||||
|
@ -214,6 +217,26 @@ static void __devexit agp_sis_remove(struct pci_dev *pdev)
|
|||
agp_put_bridge(bridge);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int agp_sis_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||
{
|
||||
pci_save_state(pdev);
|
||||
pci_set_power_state(pdev, pci_choose_state(pdev, state));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int agp_sis_resume(struct pci_dev *pdev)
|
||||
{
|
||||
pci_set_power_state(pdev, PCI_D0);
|
||||
pci_restore_state(pdev);
|
||||
|
||||
return sis_driver.configure();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
static struct pci_device_id agp_sis_pci_table[] = {
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
|
@ -327,6 +350,22 @@ static struct pci_device_id agp_sis_pci_table[] = {
|
|||
.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_662,
|
||||
.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_671,
|
||||
.subvendor = PCI_ANY_ID,
|
||||
.subdevice = PCI_ANY_ID,
|
||||
},
|
||||
{
|
||||
.class = (PCI_CLASS_BRIDGE_HOST << 8),
|
||||
.class_mask = ~0,
|
||||
|
@ -393,6 +432,10 @@ static struct pci_driver agp_sis_pci_driver = {
|
|||
.id_table = agp_sis_pci_table,
|
||||
.probe = agp_sis_probe,
|
||||
.remove = agp_sis_remove,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = agp_sis_suspend,
|
||||
.resume = agp_sis_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int __init agp_sis_init(void)
|
||||
|
|
|
@ -52,28 +52,20 @@ static int serverworks_create_page_map(struct serverworks_page_map *page_map)
|
|||
if (page_map->real == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
SetPageReserved(virt_to_page(page_map->real));
|
||||
global_cache_flush();
|
||||
page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
|
||||
PAGE_SIZE);
|
||||
if (page_map->remapped == NULL) {
|
||||
ClearPageReserved(virt_to_page(page_map->real));
|
||||
free_page((unsigned long) page_map->real);
|
||||
page_map->real = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
global_cache_flush();
|
||||
|
||||
set_memory_uc((unsigned long)page_map->real, 1);
|
||||
page_map->remapped = page_map->real;
|
||||
|
||||
for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++)
|
||||
writel(agp_bridge->scratch_page, page_map->remapped+i);
|
||||
/* Red Pen: Everyone else does pci posting flush here */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void serverworks_free_page_map(struct serverworks_page_map *page_map)
|
||||
{
|
||||
iounmap(page_map->remapped);
|
||||
ClearPageReserved(virt_to_page(page_map->real));
|
||||
set_memory_wb((unsigned long)page_map->real, 1);
|
||||
free_page((unsigned long) page_map->real);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user