Commit 6586bafd authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-dj.bkbits.net/agpgart

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents b203e95a 1afee222
...@@ -24,11 +24,11 @@ static struct pci_device_id agp_amdk7_pci_table[]; ...@@ -24,11 +24,11 @@ static struct pci_device_id agp_amdk7_pci_table[];
struct amd_page_map { struct amd_page_map {
unsigned long *real; unsigned long *real;
unsigned long *remapped; unsigned long __iomem *remapped;
}; };
static struct _amd_irongate_private { static struct _amd_irongate_private {
volatile u8 *registers; volatile u8 __iomem *registers;
struct amd_page_map **gatt_pages; struct amd_page_map **gatt_pages;
int num_tables; int num_tables;
} amd_irongate_private; } amd_irongate_private;
...@@ -54,7 +54,7 @@ static int amd_create_page_map(struct amd_page_map *page_map) ...@@ -54,7 +54,7 @@ static int amd_create_page_map(struct amd_page_map *page_map)
global_cache_flush(); global_cache_flush();
for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++)
page_map->remapped[i] = agp_bridge->scratch_page; writel(agp_bridge->scratch_page, page_map->remapped+i);
return 0; return 0;
} }
...@@ -151,7 +151,7 @@ static int amd_create_gatt_table(void) ...@@ -151,7 +151,7 @@ static int amd_create_gatt_table(void)
} }
agp_bridge->gatt_table_real = (u32 *)page_dir.real; agp_bridge->gatt_table_real = (u32 *)page_dir.real;
agp_bridge->gatt_table = (u32 *)page_dir.remapped; agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real); agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
/* Get the address for the gart region. /* Get the address for the gart region.
...@@ -165,9 +165,8 @@ static int amd_create_gatt_table(void) ...@@ -165,9 +165,8 @@ static int amd_create_gatt_table(void)
/* Calculate the agp offset */ /* Calculate the agp offset */
for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) { for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
page_dir.remapped[GET_PAGE_DIR_OFF(addr)] = writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1,
virt_to_phys(amd_irongate_private.gatt_pages[i]->real); page_dir.remapped+GET_PAGE_DIR_OFF(addr));
page_dir.remapped[GET_PAGE_DIR_OFF(addr)] |= 0x00000001;
} }
return 0; return 0;
...@@ -178,7 +177,7 @@ static int amd_free_gatt_table(void) ...@@ -178,7 +177,7 @@ static int amd_free_gatt_table(void)
struct amd_page_map page_dir; struct amd_page_map page_dir;
page_dir.real = (unsigned long *)agp_bridge->gatt_table_real; page_dir.real = (unsigned long *)agp_bridge->gatt_table_real;
page_dir.remapped = (unsigned long *)agp_bridge->gatt_table; page_dir.remapped = (unsigned long __iomem *)agp_bridge->gatt_table;
amd_free_gatt_pages(); amd_free_gatt_pages();
amd_free_page_map(&page_dir); amd_free_page_map(&page_dir);
...@@ -218,7 +217,7 @@ static int amd_irongate_configure(void) ...@@ -218,7 +217,7 @@ static int amd_irongate_configure(void)
/* Get the memory mapped registers */ /* Get the memory mapped registers */
pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp); pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp);
temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); temp = (temp & PCI_BASE_ADDRESS_MEM_MASK);
amd_irongate_private.registers = (volatile u8 *) ioremap(temp, 4096); amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
/* Write out the address of the gatt table */ /* Write out the address of the gatt table */
OUTREG32(amd_irongate_private.registers, AMD_ATTBASE, OUTREG32(amd_irongate_private.registers, AMD_ATTBASE,
...@@ -263,7 +262,7 @@ static void amd_irongate_cleanup(void) ...@@ -263,7 +262,7 @@ static void amd_irongate_cleanup(void)
pci_read_config_dword(agp_bridge->dev, AMD_APSIZE, &temp); pci_read_config_dword(agp_bridge->dev, AMD_APSIZE, &temp);
temp = ((temp & ~(0x0000000f)) | previous_size->size_value); temp = ((temp & ~(0x0000000f)) | previous_size->size_value);
pci_write_config_dword(agp_bridge->dev, AMD_APSIZE, temp); pci_write_config_dword(agp_bridge->dev, AMD_APSIZE, temp);
iounmap((void *) amd_irongate_private.registers); iounmap((void __iomem *) amd_irongate_private.registers);
} }
/* /*
...@@ -282,7 +281,7 @@ static void amd_irongate_tlbflush(struct agp_memory *temp) ...@@ -282,7 +281,7 @@ static void amd_irongate_tlbflush(struct agp_memory *temp)
static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type) static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
{ {
int i, j, num_entries; int i, j, num_entries;
unsigned long *cur_gatt; unsigned long __iomem *cur_gatt;
unsigned long addr; unsigned long addr;
num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries; num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries;
...@@ -297,7 +296,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type) ...@@ -297,7 +296,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
while (j < (pg_start + mem->page_count)) { while (j < (pg_start + mem->page_count)) {
addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = GET_GATT(addr); cur_gatt = GET_GATT(addr);
if (!PGE_EMPTY(agp_bridge, cur_gatt[GET_GATT_OFF(addr)])) if (!PGE_EMPTY(agp_bridge, readl(cur_gatt+GET_GATT_OFF(addr))))
return -EBUSY; return -EBUSY;
j++; j++;
} }
...@@ -310,8 +309,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type) ...@@ -310,8 +309,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = GET_GATT(addr); cur_gatt = GET_GATT(addr);
cur_gatt[GET_GATT_OFF(addr)] = writel(agp_generic_mask_memory(mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
agp_generic_mask_memory(mem->memory[i], mem->type);
} }
amd_irongate_tlbflush(mem); amd_irongate_tlbflush(mem);
return 0; return 0;
...@@ -320,7 +318,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type) ...@@ -320,7 +318,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type) static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
{ {
int i; int i;
unsigned long *cur_gatt; unsigned long __iomem *cur_gatt;
unsigned long addr; unsigned long addr;
if (type != 0 || mem->type != 0) if (type != 0 || mem->type != 0)
...@@ -329,8 +327,7 @@ static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type) ...@@ -329,8 +327,7 @@ static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
for (i = pg_start; i < (mem->page_count + pg_start); i++) { for (i = pg_start; i < (mem->page_count + pg_start); i++) {
addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = GET_GATT(addr); cur_gatt = GET_GATT(addr);
cur_gatt[GET_GATT_OFF(addr)] = writel(agp_bridge->scratch_page, cur_gatt+GET_GATT_OFF(addr));
(unsigned long) agp_bridge->scratch_page;
} }
amd_irongate_tlbflush(mem); amd_irongate_tlbflush(mem);
......
...@@ -73,7 +73,7 @@ static void amd64_tlbflush(struct agp_memory *temp) ...@@ -73,7 +73,7 @@ static void amd64_tlbflush(struct agp_memory *temp)
static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type) static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
{ {
int i, j, num_entries; int i, j, num_entries;
long tmp; long long tmp;
u32 pte; u32 pte;
num_entries = agp_num_entries(); num_entries = agp_num_entries();
...@@ -90,7 +90,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type) ...@@ -90,7 +90,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
/* gatt table should be empty. */ /* gatt table should be empty. */
while (j < (pg_start + mem->page_count)) { while (j < (pg_start + mem->page_count)) {
if (!PGE_EMPTY(agp_bridge, agp_bridge->gatt_table[j])) if (!PGE_EMPTY(agp_bridge, readl(agp_bridge->gatt_table+j)))
return -EBUSY; return -EBUSY;
j++; j++;
} }
...@@ -108,7 +108,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type) ...@@ -108,7 +108,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
pte |=(tmp & 0x00000000fffff000ULL); pte |=(tmp & 0x00000000fffff000ULL);
pte |= GPTE_VALID | GPTE_COHERENT; pte |= GPTE_VALID | GPTE_COHERENT;
agp_bridge->gatt_table[j] = pte; writel(pte, agp_bridge->gatt_table+j);
} }
amd64_tlbflush(mem); amd64_tlbflush(mem);
return 0; return 0;
......
...@@ -42,11 +42,11 @@ static struct gatt_mask ati_generic_masks[] = ...@@ -42,11 +42,11 @@ static struct gatt_mask ati_generic_masks[] =
typedef struct _ati_page_map { typedef struct _ati_page_map {
unsigned long *real; unsigned long *real;
unsigned long *remapped; unsigned long __iomem *remapped;
} ati_page_map; } ati_page_map;
static struct _ati_generic_private { static struct _ati_generic_private {
volatile u8 *registers; volatile u8 __iomem *registers;
ati_page_map **gatt_pages; ati_page_map **gatt_pages;
int num_tables; int num_tables;
} ati_generic_private; } ati_generic_private;
...@@ -76,7 +76,7 @@ static int ati_create_page_map(ati_page_map *page_map) ...@@ -76,7 +76,7 @@ static int ati_create_page_map(ati_page_map *page_map)
global_cache_flush(); global_cache_flush();
for(i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) for(i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++)
page_map->remapped[i] = agp_bridge->scratch_page; writel(agp_bridge->scratch_page, page_map->remapped+i);
return 0; return 0;
} }
...@@ -206,7 +206,7 @@ static void ati_cleanup(void) ...@@ -206,7 +206,7 @@ static void ati_cleanup(void)
temp = ((temp & ~(0x0000000f)) | previous_size->size_value); temp = ((temp & ~(0x0000000f)) | previous_size->size_value);
pci_write_config_dword(agp_bridge->dev, ATI_RS300_APSIZE, temp); pci_write_config_dword(agp_bridge->dev, ATI_RS300_APSIZE, temp);
} }
iounmap((void *) ati_generic_private.registers); iounmap((volatile u8 __iomem *)ati_generic_private.registers);
} }
...@@ -217,7 +217,7 @@ static int ati_configure(void) ...@@ -217,7 +217,7 @@ static int ati_configure(void)
/* Get the memory mapped registers */ /* Get the memory mapped registers */
pci_read_config_dword(agp_bridge->dev, ATI_GART_MMBASE_ADDR, &temp); pci_read_config_dword(agp_bridge->dev, ATI_GART_MMBASE_ADDR, &temp);
temp = (temp & 0xfffff000); temp = (temp & 0xfffff000);
ati_generic_private.registers = (volatile u8 *) ioremap(temp, 4096); ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
if (is_r200()) if (is_r200())
pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000);
...@@ -261,7 +261,7 @@ static int ati_insert_memory(struct agp_memory * mem, ...@@ -261,7 +261,7 @@ static int ati_insert_memory(struct agp_memory * mem,
off_t pg_start, int type) off_t pg_start, int type)
{ {
int i, j, num_entries; int i, j, num_entries;
unsigned long *cur_gatt; unsigned long __iomem *cur_gatt;
unsigned long addr; unsigned long addr;
num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries; num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries;
...@@ -276,7 +276,7 @@ static int ati_insert_memory(struct agp_memory * mem, ...@@ -276,7 +276,7 @@ static int ati_insert_memory(struct agp_memory * mem,
while (j < (pg_start + mem->page_count)) { while (j < (pg_start + mem->page_count)) {
addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = GET_GATT(addr); cur_gatt = GET_GATT(addr);
if (!PGE_EMPTY(agp_bridge,cur_gatt[GET_GATT_OFF(addr)])) if (!PGE_EMPTY(agp_bridge,readl(cur_gatt+GET_GATT_OFF(addr))))
return -EBUSY; return -EBUSY;
j++; j++;
} }
...@@ -290,8 +290,7 @@ static int ati_insert_memory(struct agp_memory * mem, ...@@ -290,8 +290,7 @@ static int ati_insert_memory(struct agp_memory * mem,
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = GET_GATT(addr); cur_gatt = GET_GATT(addr);
cur_gatt[GET_GATT_OFF(addr)] = writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
agp_bridge->driver->mask_memory(mem->memory[i], mem->type);
} }
agp_bridge->driver->tlb_flush(mem); agp_bridge->driver->tlb_flush(mem);
return 0; return 0;
...@@ -301,7 +300,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start, ...@@ -301,7 +300,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
int type) int type)
{ {
int i; int i;
unsigned long *cur_gatt; unsigned long __iomem *cur_gatt;
unsigned long addr; unsigned long addr;
if (type != 0 || mem->type != 0) { if (type != 0 || mem->type != 0) {
...@@ -310,8 +309,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start, ...@@ -310,8 +309,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
for (i = pg_start; i < (mem->page_count + pg_start); i++) { for (i = pg_start; i < (mem->page_count + pg_start); i++) {
addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = GET_GATT(addr); cur_gatt = GET_GATT(addr);
cur_gatt[GET_GATT_OFF(addr)] = writel(agp_bridge->scratch_page, cur_gatt+GET_GATT_OFF(addr));
(unsigned long) agp_bridge->scratch_page;
} }
agp_bridge->driver->tlb_flush(mem); agp_bridge->driver->tlb_flush(mem);
...@@ -340,7 +338,7 @@ static int ati_create_gatt_table(void) ...@@ -340,7 +338,7 @@ static int ati_create_gatt_table(void)
} }
agp_bridge->gatt_table_real = (u32 *)page_dir.real; agp_bridge->gatt_table_real = (u32 *)page_dir.real;
agp_bridge->gatt_table = (u32 *)page_dir.remapped; agp_bridge->gatt_table = (u32 __iomem *) page_dir.remapped;
agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real); agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
/* Write out the size register */ /* Write out the size register */
...@@ -371,9 +369,8 @@ static int ati_create_gatt_table(void) ...@@ -371,9 +369,8 @@ static int ati_create_gatt_table(void)
/* Calculate the agp offset */ /* Calculate the agp offset */
for(i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) { for(i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
page_dir.remapped[GET_PAGE_DIR_OFF(addr)] = writel(virt_to_bus(ati_generic_private.gatt_pages[i]->real) | 1,
virt_to_bus(ati_generic_private.gatt_pages[i]->real); page_dir.remapped+GET_PAGE_DIR_OFF(addr));
page_dir.remapped[GET_PAGE_DIR_OFF(addr)] |= 0x00000001;
} }
return 0; return 0;
...@@ -384,7 +381,7 @@ static int ati_free_gatt_table(void) ...@@ -384,7 +381,7 @@ static int ati_free_gatt_table(void)
ati_page_map page_dir; ati_page_map page_dir;
page_dir.real = (unsigned long *)agp_bridge->gatt_table_real; page_dir.real = (unsigned long *)agp_bridge->gatt_table_real;
page_dir.remapped = (unsigned long *)agp_bridge->gatt_table; page_dir.remapped = (unsigned long __iomem *)agp_bridge->gatt_table;
ati_free_gatt_pages(); ati_free_gatt_pages();
ati_free_page_map(&page_dir); ati_free_page_map(&page_dir);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/agp_backend.h> #include <linux/agp_backend.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <asm/io.h>
#include "agp.h" #include "agp.h"
__u32 *agp_gatt_table; __u32 *agp_gatt_table;
...@@ -737,7 +738,7 @@ int agp_generic_create_gatt_table(void) ...@@ -737,7 +738,7 @@ int agp_generic_create_gatt_table(void)
/* AK: bogus, should encode addresses > 4GB */ /* AK: bogus, should encode addresses > 4GB */
for (i = 0; i < num_entries; i++) for (i = 0; i < num_entries; i++)
agp_bridge->gatt_table[i] = (unsigned long) agp_bridge->scratch_page; writel(agp_bridge->scratch_page, agp_bridge->gatt_table+i);
return 0; return 0;
} }
...@@ -843,9 +844,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) ...@@ -843,9 +844,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
j = pg_start; j = pg_start;
while (j < (pg_start + mem->page_count)) { while (j < (pg_start + mem->page_count)) {
if (!PGE_EMPTY(agp_bridge, agp_bridge->gatt_table[j])) { if (!PGE_EMPTY(agp_bridge, readl(agp_bridge->gatt_table+j)))
return -EBUSY; return -EBUSY;
}
j++; j++;
} }
...@@ -855,9 +855,7 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) ...@@ -855,9 +855,7 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
} }
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) for (i = 0, j = pg_start; i < mem->page_count; i++, j++)
agp_bridge->gatt_table[j] = writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), agp_bridge->gatt_table+j);
agp_bridge->driver->mask_memory(
mem->memory[i], mem->type);
agp_bridge->driver->tlb_flush(mem); agp_bridge->driver->tlb_flush(mem);
return 0; return 0;
...@@ -875,10 +873,8 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) ...@@ -875,10 +873,8 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
} }
/* AK: bogus, should encode addresses > 4GB */ /* AK: bogus, should encode addresses > 4GB */
for (i = pg_start; i < (mem->page_count + pg_start); i++) { for (i = pg_start; i < (mem->page_count + pg_start); i++)
agp_bridge->gatt_table[i] = writel(agp_bridge->scratch_page, agp_bridge->gatt_table+i);
(unsigned long) agp_bridge->scratch_page;
}
agp_bridge->driver->tlb_flush(mem); agp_bridge->driver->tlb_flush(mem);
return 0; return 0;
......
...@@ -202,7 +202,7 @@ static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start, ...@@ -202,7 +202,7 @@ static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
return -EINVAL; return -EINVAL;
} }
for (j = pg_start; j < (pg_start + mem->page_count); j++) { for (j = pg_start; j < (pg_start + mem->page_count); j++) {
if (!PGE_EMPTY(agp_bridge, agp_bridge->gatt_table[j])) if (!PGE_EMPTY(agp_bridge, readl(agp_bridge->gatt_table+j)))
return -EBUSY; return -EBUSY;
} }
...@@ -1768,6 +1768,7 @@ static struct pci_device_id agp_intel_pci_table[] = { ...@@ -1768,6 +1768,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
ID(PCI_DEVICE_ID_INTEL_82875_HB), ID(PCI_DEVICE_ID_INTEL_82875_HB),
ID(PCI_DEVICE_ID_INTEL_7505_0), ID(PCI_DEVICE_ID_INTEL_7505_0),
ID(PCI_DEVICE_ID_INTEL_7205_0), ID(PCI_DEVICE_ID_INTEL_7205_0),
ID(PCI_DEVICE_ID_INTEL_82915G_HB),
{ } { }
}; };
......
...@@ -84,7 +84,7 @@ static struct aper_size_info_fixed intel_i830_sizes[] = ...@@ -84,7 +84,7 @@ static struct aper_size_info_fixed intel_i830_sizes[] =
static struct _intel_i830_private { static struct _intel_i830_private {
struct pci_dev *i830_dev; /* device one */ struct pci_dev *i830_dev; /* device one */
volatile u8 *registers; volatile u8 __iomem *registers;
int gtt_entries; int gtt_entries;
} intel_i830_private; } intel_i830_private;
...@@ -172,7 +172,7 @@ static int intel_i830_create_gatt_table(void) ...@@ -172,7 +172,7 @@ static int intel_i830_create_gatt_table(void)
pci_read_config_dword(intel_i830_private.i830_dev,I810_MMADDR,&temp); pci_read_config_dword(intel_i830_private.i830_dev,I810_MMADDR,&temp);
temp &= 0xfff80000; temp &= 0xfff80000;
intel_i830_private.registers = (volatile u8 *) ioremap(temp,128 * 4096); intel_i830_private.registers = (volatile u8 __iomem*) ioremap(temp,128 * 4096);
if (!intel_i830_private.registers) if (!intel_i830_private.registers)
return (-ENOMEM); return (-ENOMEM);
...@@ -255,7 +255,7 @@ static int intel_i830_configure(void) ...@@ -255,7 +255,7 @@ static int intel_i830_configure(void)
static void intel_i830_cleanup(void) static void intel_i830_cleanup(void)
{ {
iounmap((void *) intel_i830_private.registers); iounmap((void __iomem *) intel_i830_private.registers);
} }
static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start,
......
...@@ -28,7 +28,7 @@ static struct _nvidia_private { ...@@ -28,7 +28,7 @@ static struct _nvidia_private {
struct pci_dev *dev_1; struct pci_dev *dev_1;
struct pci_dev *dev_2; struct pci_dev *dev_2;
struct pci_dev *dev_3; struct pci_dev *dev_3;
volatile u32 *aperture; volatile u32 __iomem *aperture;
int num_active_entries; int num_active_entries;
off_t pg_offset; off_t pg_offset;
u32 wbc_mask; u32 wbc_mask;
...@@ -154,7 +154,7 @@ static int nvidia_configure(void) ...@@ -154,7 +154,7 @@ static int nvidia_configure(void)
/* map aperture */ /* map aperture */
nvidia_private.aperture = nvidia_private.aperture =
(volatile u32 *) ioremap(apbase, 33 * PAGE_SIZE); (volatile u32 __iomem *) ioremap(apbase, 33 * PAGE_SIZE);
return 0; return 0;
} }
...@@ -173,7 +173,7 @@ static void nvidia_cleanup(void) ...@@ -173,7 +173,7 @@ static void nvidia_cleanup(void)
pci_write_config_dword(nvidia_private.dev_2, NVIDIA_2_GARTCTRL, temp & ~(0x11)); pci_write_config_dword(nvidia_private.dev_2, NVIDIA_2_GARTCTRL, temp & ~(0x11));
/* unmap aperture */ /* unmap aperture */
iounmap((void *) nvidia_private.aperture); iounmap((void __iomem *) nvidia_private.aperture);
/* restore previous aperture size */ /* restore previous aperture size */
previous_size = A_SIZE_8(agp_bridge->previous_size); previous_size = A_SIZE_8(agp_bridge->previous_size);
...@@ -206,7 +206,7 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type ...@@ -206,7 +206,7 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type
return -EINVAL; return -EINVAL;
for(j = pg_start; j < (pg_start + mem->page_count); j++) { for(j = pg_start; j < (pg_start + mem->page_count); j++) {
if (!PGE_EMPTY(agp_bridge, agp_bridge->gatt_table[nvidia_private.pg_offset + j])) if (!PGE_EMPTY(agp_bridge, readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j)))
return -EBUSY; return -EBUSY;
} }
...@@ -215,9 +215,8 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type ...@@ -215,9 +215,8 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type
mem->is_flushed = TRUE; mem->is_flushed = TRUE;
} }
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) for (i = 0, j = pg_start; i < mem->page_count; i++, j++)
agp_bridge->gatt_table[nvidia_private.pg_offset + j] = writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type),
agp_bridge->driver->mask_memory(mem->memory[i], mem->type); agp_bridge->gatt_table+nvidia_private.pg_offset+j);
agp_bridge->driver->tlb_flush(mem); agp_bridge->driver->tlb_flush(mem);
return 0; return 0;
} }
...@@ -229,11 +228,9 @@ static int nvidia_remove_memory(struct agp_memory *mem, off_t pg_start, int type ...@@ -229,11 +228,9 @@ static int nvidia_remove_memory(struct agp_memory *mem, off_t pg_start, int type
if ((type != 0) || (mem->type != 0)) if ((type != 0) || (mem->type != 0))
return -EINVAL; return -EINVAL;
for (i = pg_start; i < (mem->page_count + pg_start); i++) { for (i = pg_start; i < (mem->page_count + pg_start); i++)
agp_bridge->gatt_table[nvidia_private.pg_offset + i] = writel(agp_bridge->scratch_page, agp_bridge->gatt_table+nvidia_private.pg_offset+i);
(unsigned long) agp_bridge->scratch_page;
}
agp_bridge->driver->tlb_flush(mem); agp_bridge->driver->tlb_flush(mem);
return 0; return 0;
...@@ -265,9 +262,9 @@ static void nvidia_tlbflush(struct agp_memory *mem) ...@@ -265,9 +262,9 @@ static void nvidia_tlbflush(struct agp_memory *mem)
/* flush TLB entries */ /* flush TLB entries */
for(i = 0; i < 32 + 1; i++) for(i = 0; i < 32 + 1; i++)
temp = nvidia_private.aperture[i * PAGE_SIZE / sizeof(u32)]; temp = readl(nvidia_private.aperture+(i * PAGE_SIZE / sizeof(u32)));
for(i = 0; i < 32 + 1; i++) for(i = 0; i < 32 + 1; i++)
temp = nvidia_private.aperture[i * PAGE_SIZE / sizeof(u32)]; temp = readl(nvidia_private.aperture+(i * PAGE_SIZE / sizeof(u32)));
} }
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
struct serverworks_page_map { struct serverworks_page_map {
unsigned long *real; unsigned long *real;
unsigned long *remapped; unsigned long __iomem *remapped;
}; };
static struct _serverworks_private { static struct _serverworks_private {
struct pci_dev *svrwrks_dev; /* device one */ struct pci_dev *svrwrks_dev; /* device one */
volatile u8 *registers; volatile u8 __iomem *registers;
struct serverworks_page_map **gatt_pages; struct serverworks_page_map **gatt_pages;
int num_tables; int num_tables;
struct serverworks_page_map scratch_dir; struct serverworks_page_map scratch_dir;
...@@ -61,9 +61,8 @@ static int serverworks_create_page_map(struct serverworks_page_map *page_map) ...@@ -61,9 +61,8 @@ static int serverworks_create_page_map(struct serverworks_page_map *page_map)
} }
global_cache_flush(); global_cache_flush();
for(i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { for(i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++)
page_map->remapped[i] = agp_bridge->scratch_page; writel(agp_bridge->scratch_page, page_map->remapped+i);
}
return 0; return 0;
} }
...@@ -162,10 +161,8 @@ static int serverworks_create_gatt_table(void) ...@@ -162,10 +161,8 @@ static int serverworks_create_gatt_table(void)
} }
/* Create a fake scratch directory */ /* Create a fake scratch directory */
for(i = 0; i < 1024; i++) { for(i = 0; i < 1024; i++) {
serverworks_private.scratch_dir.remapped[i] = (unsigned long) agp_bridge->scratch_page; writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i);
page_dir.remapped[i] = writel(virt_to_phys(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
virt_to_phys(serverworks_private.scratch_dir.real);
page_dir.remapped[i] |= 0x00000001;
} }
retval = serverworks_create_gatt_pages(value->num_entries / 1024); retval = serverworks_create_gatt_pages(value->num_entries / 1024);
...@@ -176,7 +173,7 @@ static int serverworks_create_gatt_table(void) ...@@ -176,7 +173,7 @@ static int serverworks_create_gatt_table(void)
} }
agp_bridge->gatt_table_real = (u32 *)page_dir.real; agp_bridge->gatt_table_real = (u32 *)page_dir.real;
agp_bridge->gatt_table = (u32 *)page_dir.remapped; agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real); agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
/* Get the address for the gart region. /* Get the address for the gart region.
...@@ -189,11 +186,8 @@ static int serverworks_create_gatt_table(void) ...@@ -189,11 +186,8 @@ static int serverworks_create_gatt_table(void)
/* Calculate the agp offset */ /* Calculate the agp offset */
for(i = 0; i < value->num_entries / 1024; i++) { for(i = 0; i < value->num_entries / 1024; i++)
page_dir.remapped[i] = writel(virt_to_phys(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
virt_to_phys(serverworks_private.gatt_pages[i]->real);
page_dir.remapped[i] |= 0x00000001;
}
return 0; return 0;
} }
...@@ -203,7 +197,7 @@ static int serverworks_free_gatt_table(void) ...@@ -203,7 +197,7 @@ static int serverworks_free_gatt_table(void)
struct serverworks_page_map page_dir; struct serverworks_page_map page_dir;
page_dir.real = (unsigned long *)agp_bridge->gatt_table_real; page_dir.real = (unsigned long *)agp_bridge->gatt_table_real;
page_dir.remapped = (unsigned long *)agp_bridge->gatt_table; page_dir.remapped = (unsigned long __iomem *)agp_bridge->gatt_table;
serverworks_free_gatt_pages(); serverworks_free_gatt_pages();
serverworks_free_page_map(&page_dir); serverworks_free_page_map(&page_dir);
...@@ -269,7 +263,7 @@ static int serverworks_configure(void) ...@@ -269,7 +263,7 @@ static int serverworks_configure(void)
/* Get the memory mapped registers */ /* Get the memory mapped registers */
pci_read_config_dword(agp_bridge->dev, serverworks_private.mm_addr_ofs, &temp); pci_read_config_dword(agp_bridge->dev, serverworks_private.mm_addr_ofs, &temp);
temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); temp = (temp & PCI_BASE_ADDRESS_MEM_MASK);
serverworks_private.registers = (volatile u8 *) ioremap(temp, 4096); serverworks_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
if (!serverworks_private.registers) { if (!serverworks_private.registers) {
printk (KERN_ERR PFX "Unable to ioremap() memory.\n"); printk (KERN_ERR PFX "Unable to ioremap() memory.\n");
return -ENOMEM; return -ENOMEM;
...@@ -311,14 +305,14 @@ static int serverworks_configure(void) ...@@ -311,14 +305,14 @@ static int serverworks_configure(void)
static void serverworks_cleanup(void) static void serverworks_cleanup(void)
{ {
iounmap((void *) serverworks_private.registers); iounmap((void __iomem *) serverworks_private.registers);
} }
static int serverworks_insert_memory(struct agp_memory *mem, static int serverworks_insert_memory(struct agp_memory *mem,
off_t pg_start, int type) off_t pg_start, int type)
{ {
int i, j, num_entries; int i, j, num_entries;
unsigned long *cur_gatt; unsigned long __iomem *cur_gatt;
unsigned long addr; unsigned long addr;
num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries; num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries;
...@@ -334,9 +328,8 @@ static int serverworks_insert_memory(struct agp_memory *mem, ...@@ -334,9 +328,8 @@ static int serverworks_insert_memory(struct agp_memory *mem,
while (j < (pg_start + mem->page_count)) { while (j < (pg_start + mem->page_count)) {
addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = SVRWRKS_GET_GATT(addr); cur_gatt = SVRWRKS_GET_GATT(addr);
if (!PGE_EMPTY(agp_bridge, cur_gatt[GET_GATT_OFF(addr)])) { if (!PGE_EMPTY(agp_bridge, readl(cur_gatt+GET_GATT_OFF(addr))))
return -EBUSY; return -EBUSY;
}
j++; j++;
} }
...@@ -348,8 +341,7 @@ static int serverworks_insert_memory(struct agp_memory *mem, ...@@ -348,8 +341,7 @@ static int serverworks_insert_memory(struct agp_memory *mem,
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = SVRWRKS_GET_GATT(addr); cur_gatt = SVRWRKS_GET_GATT(addr);
cur_gatt[GET_GATT_OFF(addr)] = writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
agp_bridge->driver->mask_memory(mem->memory[i], mem->type);
} }
serverworks_tlbflush(mem); serverworks_tlbflush(mem);
return 0; return 0;
...@@ -359,7 +351,7 @@ static int serverworks_remove_memory(struct agp_memory *mem, off_t pg_start, ...@@ -359,7 +351,7 @@ static int serverworks_remove_memory(struct agp_memory *mem, off_t pg_start,
int type) int type)
{ {
int i; int i;
unsigned long *cur_gatt; unsigned long __iomem *cur_gatt;
unsigned long addr; unsigned long addr;
if (type != 0 || mem->type != 0) { if (type != 0 || mem->type != 0) {
...@@ -372,8 +364,7 @@ static int serverworks_remove_memory(struct agp_memory *mem, off_t pg_start, ...@@ -372,8 +364,7 @@ static int serverworks_remove_memory(struct agp_memory *mem, off_t pg_start,
for (i = pg_start; i < (mem->page_count + pg_start); i++) { for (i = pg_start; i < (mem->page_count + pg_start); i++) {
addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = SVRWRKS_GET_GATT(addr); cur_gatt = SVRWRKS_GET_GATT(addr);
cur_gatt[GET_GATT_OFF(addr)] = writel(agp_bridge->scratch_page, cur_gatt+GET_GATT_OFF(addr));
(unsigned long) agp_bridge->scratch_page;
} }
serverworks_tlbflush(mem); serverworks_tlbflush(mem);
......
...@@ -438,6 +438,33 @@ static void __devexit agp_via_remove(struct pci_dev *pdev) ...@@ -438,6 +438,33 @@ static void __devexit agp_via_remove(struct pci_dev *pdev)
agp_put_bridge(bridge); agp_put_bridge(bridge);
} }
#ifdef CONFIG_PM
static int agp_via_suspend(struct pci_dev *pdev, u32 state)
{
pci_save_state (pdev, pdev->saved_config_space);
pci_set_power_state (pdev, 3);
return 0;
}
static int agp_via_resume(struct pci_dev *pdev)
{
struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
pci_set_power_state (pdev, 0);
pci_restore_state(pdev, pdev->saved_config_space);
if (bridge->driver == &via_agp3_driver)
return via_configure_agp3();
else if (bridge->driver == &via_driver)
return via_configure();
return 0;
}
#endif /* CONFIG_PM */
/* must be the same order as name table above */ /* must be the same order as name table above */
static struct pci_device_id agp_via_pci_table[] = { static struct pci_device_id agp_via_pci_table[] = {
#define ID(x) \ #define ID(x) \
...@@ -487,6 +514,10 @@ static struct pci_driver agp_via_pci_driver = { ...@@ -487,6 +514,10 @@ static struct pci_driver agp_via_pci_driver = {
.id_table = agp_via_pci_table, .id_table = agp_via_pci_table,
.probe = agp_via_probe, .probe = agp_via_probe,
.remove = agp_via_remove, .remove = agp_via_remove,
#ifdef CONFIG_PM
.suspend = agp_via_suspend,
.resume = agp_via_resume,
#endif
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment