Commit 3c6ab8c2 authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[AGPGART] allow drivers to allocate memory local to the bridge

From: Michael Werner <werner@mrcoffee.engr.sgi.com>

This patch allows drivers to allocate memory local to the bridge using
platform specific alloc_page routines.
Signed-off-by: default avatarMike Werner <werner@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 4ce94034
...@@ -112,7 +112,7 @@ struct agp_bridge_driver { ...@@ -112,7 +112,7 @@ struct agp_bridge_driver {
int (*remove_memory)(struct agp_memory *, off_t, int); int (*remove_memory)(struct agp_memory *, off_t, int);
struct agp_memory *(*alloc_by_type) (size_t, int); struct agp_memory *(*alloc_by_type) (size_t, int);
void (*free_by_type)(struct agp_memory *); void (*free_by_type)(struct agp_memory *);
void *(*agp_alloc_page)(void); void *(*agp_alloc_page)(struct agp_bridge_data *);
void (*agp_destroy_page)(void *); void (*agp_destroy_page)(void *);
}; };
...@@ -254,7 +254,7 @@ int agp_generic_insert_memory(struct agp_memory *mem, off_t pg_start, int type); ...@@ -254,7 +254,7 @@ int agp_generic_insert_memory(struct agp_memory *mem, off_t pg_start, int type);
int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type); int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type);
struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type); struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type);
void agp_generic_free_by_type(struct agp_memory *curr); void agp_generic_free_by_type(struct agp_memory *curr);
void *agp_generic_alloc_page(void); void *agp_generic_alloc_page(struct agp_bridge_data *bridge);
void agp_generic_destroy_page(void *addr); void agp_generic_destroy_page(void *addr);
void agp_free_key(int key); void agp_free_key(int key);
int agp_num_entries(void); int agp_num_entries(void);
......
...@@ -139,9 +139,9 @@ static void m1541_cache_flush(void) ...@@ -139,9 +139,9 @@ static void m1541_cache_flush(void)
} }
} }
static void *m1541_alloc_page(void) static void *m1541_alloc_page(struct agp_bridge_data *bridge)
{ {
void *addr = agp_generic_alloc_page(); void *addr = agp_generic_alloc_page(agp_bridge);
u32 temp; u32 temp;
if (!addr) if (!addr)
......
...@@ -140,7 +140,7 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) ...@@ -140,7 +140,7 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)
bridge->version = &agp_current_version; bridge->version = &agp_current_version;
if (bridge->driver->needs_scratch_page) { if (bridge->driver->needs_scratch_page) {
void *addr = bridge->driver->agp_alloc_page(); void *addr = bridge->driver->agp_alloc_page(bridge);
if (!addr) { if (!addr) {
printk(KERN_ERR PFX "unable to get memory for scratch page.\n"); printk(KERN_ERR PFX "unable to get memory for scratch page.\n");
......
...@@ -202,7 +202,7 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, ...@@ -202,7 +202,7 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
return NULL; return NULL;
for (i = 0; i < page_count; i++) { for (i = 0; i < page_count; i++) {
void *addr = bridge->driver->agp_alloc_page(); void *addr = bridge->driver->agp_alloc_page(bridge);
if (addr == NULL) { if (addr == NULL) {
agp_free_memory(new); agp_free_memory(new);
...@@ -1064,7 +1064,7 @@ EXPORT_SYMBOL(agp_generic_free_by_type); ...@@ -1064,7 +1064,7 @@ EXPORT_SYMBOL(agp_generic_free_by_type);
* against a maximum value. * against a maximum value.
*/ */
void *agp_generic_alloc_page(void) void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
{ {
struct page * page; struct page * page;
......
...@@ -508,12 +508,12 @@ static int i460_remove_memory (struct agp_memory *mem, ...@@ -508,12 +508,12 @@ static int i460_remove_memory (struct agp_memory *mem,
* Let's just hope nobody counts on the allocated AGP memory being there before bind time * Let's just hope nobody counts on the allocated AGP memory being there before bind time
* (I don't think current drivers do)... * (I don't think current drivers do)...
*/ */
static void *i460_alloc_page (void) static void *i460_alloc_page (struct agp_bridge_data *bridge)
{ {
void *page; void *page;
if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT)
page = agp_generic_alloc_page(); page = agp_generic_alloc_page(agp_bridge);
else else
/* Returning NULL would cause problems */ /* Returning NULL would cause problems */
/* AK: really dubious code. */ /* AK: really dubious code. */
......
...@@ -268,7 +268,7 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type) ...@@ -268,7 +268,7 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type)
return NULL; return NULL;
switch (pg_count) { switch (pg_count) {
case 1: addr = agp_bridge->driver->agp_alloc_page(); case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge);
break; break;
case 4: case 4:
/* kludge to get 4 physical pages for ARGB cursor */ /* kludge to get 4 physical pages for ARGB cursor */
......
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