From: Michael Werner This patch allows drivers to allocate memory local to the bridge using platform specific alloc_page routines. Signed-off-by: Mike Werner Signed-off-by: Andrew Morton --- 25-akpm/drivers/char/agp/agp.h | 4 ++-- 25-akpm/drivers/char/agp/ali-agp.c | 4 ++-- 25-akpm/drivers/char/agp/backend.c | 2 +- 25-akpm/drivers/char/agp/generic.c | 4 ++-- 25-akpm/drivers/char/agp/i460-agp.c | 4 ++-- 25-akpm/drivers/char/agp/intel-agp.c | 2 +- 25-akpm/drivers/char/agp/intel-mch-agp.c | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff -puN drivers/char/agp/agp.h~agpgart-allow-drivers-to-allocate-memory-local-to drivers/char/agp/agp.h --- 25/drivers/char/agp/agp.h~agpgart-allow-drivers-to-allocate-memory-local-to 2005-01-23 14:46:26.675263296 -0800 +++ 25-akpm/drivers/char/agp/agp.h 2005-01-23 14:46:26.686261624 -0800 @@ -112,7 +112,7 @@ struct agp_bridge_driver { int (*remove_memory)(struct agp_memory *, off_t, int); struct agp_memory *(*alloc_by_type) (size_t, int); 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 *); }; @@ -253,7 +253,7 @@ int agp_generic_insert_memory(struct agp 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); 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_free_key(int key); int agp_num_entries(void); diff -puN drivers/char/agp/ali-agp.c~agpgart-allow-drivers-to-allocate-memory-local-to drivers/char/agp/ali-agp.c --- 25/drivers/char/agp/ali-agp.c~agpgart-allow-drivers-to-allocate-memory-local-to 2005-01-23 14:46:26.676263144 -0800 +++ 25-akpm/drivers/char/agp/ali-agp.c 2005-01-23 14:46:26.687261472 -0800 @@ -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; if (!addr) diff -puN drivers/char/agp/backend.c~agpgart-allow-drivers-to-allocate-memory-local-to drivers/char/agp/backend.c --- 25/drivers/char/agp/backend.c~agpgart-allow-drivers-to-allocate-memory-local-to 2005-01-23 14:46:26.677262992 -0800 +++ 25-akpm/drivers/char/agp/backend.c 2005-01-23 14:46:26.687261472 -0800 @@ -140,7 +140,7 @@ static int agp_backend_initialize(struct bridge->version = &agp_current_version; if (bridge->driver->needs_scratch_page) { - void *addr = bridge->driver->agp_alloc_page(); + void *addr = bridge->driver->agp_alloc_page(bridge); if (!addr) { printk(KERN_ERR PFX "unable to get memory for scratch page.\n"); diff -puN drivers/char/agp/generic.c~agpgart-allow-drivers-to-allocate-memory-local-to drivers/char/agp/generic.c --- 25/drivers/char/agp/generic.c~agpgart-allow-drivers-to-allocate-memory-local-to 2005-01-23 14:46:26.679262688 -0800 +++ 25-akpm/drivers/char/agp/generic.c 2005-01-23 14:46:26.688261320 -0800 @@ -202,7 +202,7 @@ struct agp_memory *agp_allocate_memory(s return NULL; 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) { agp_free_memory(new); @@ -950,7 +950,7 @@ EXPORT_SYMBOL(agp_generic_free_by_type); * against a maximum value. */ -void *agp_generic_alloc_page(void) +void *agp_generic_alloc_page(struct agp_bridge_data *bridge) { struct page * page; diff -puN drivers/char/agp/i460-agp.c~agpgart-allow-drivers-to-allocate-memory-local-to drivers/char/agp/i460-agp.c --- 25/drivers/char/agp/i460-agp.c~agpgart-allow-drivers-to-allocate-memory-local-to 2005-01-23 14:46:26.680262536 -0800 +++ 25-akpm/drivers/char/agp/i460-agp.c 2005-01-23 14:46:26.689261168 -0800 @@ -508,12 +508,12 @@ static int i460_remove_memory (struct ag * Let's just hope nobody counts on the allocated AGP memory being there before bind time * (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; if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) - page = agp_generic_alloc_page(); + page = agp_generic_alloc_page(agp_bridge); else /* Returning NULL would cause problems */ /* AK: really dubious code. */ diff -puN drivers/char/agp/intel-agp.c~agpgart-allow-drivers-to-allocate-memory-local-to drivers/char/agp/intel-agp.c --- 25/drivers/char/agp/intel-agp.c~agpgart-allow-drivers-to-allocate-memory-local-to 2005-01-23 14:46:26.681262384 -0800 +++ 25-akpm/drivers/char/agp/intel-agp.c 2005-01-23 14:46:26.691260864 -0800 @@ -268,7 +268,7 @@ static struct agp_memory *alloc_agpphysm return NULL; switch (pg_count) { - case 1: addr = agp_bridge->driver->agp_alloc_page(); + case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge); break; case 4: /* kludge to get 4 physical pages for ARGB cursor */ diff -puN drivers/char/agp/intel-mch-agp.c~agpgart-allow-drivers-to-allocate-memory-local-to drivers/char/agp/intel-mch-agp.c --- 25/drivers/char/agp/intel-mch-agp.c~agpgart-allow-drivers-to-allocate-memory-local-to 2005-01-23 14:46:26.683262080 -0800 +++ 25-akpm/drivers/char/agp/intel-mch-agp.c 2005-01-23 14:46:26.692260712 -0800 @@ -43,7 +43,7 @@ static struct agp_memory *alloc_agpphysm if (pg_count != 1) return NULL; - addr = agp_bridge->driver->agp_alloc_page(); + addr = agp_bridge->driver->agp_alloc_page(agp_bridge); if (addr == NULL) return NULL; _