Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart:
  [AGPGART] allow drm populated agp memory types cleanups
  [AGPGART] intel-agp: Use ARRAY_SIZE macro when appropriate
  [AGPGART] Add agp-type-to-mask-type method missing from some drivers.
  [AGPGART] Don't try to remap i810 registers on resume.
  [AGPGART] Allow drm-populated agp memory types
  [AGPGART] compat ioctl
  • Loading branch information
Linus Torvalds committed Feb 16, 2007
2 parents ef29498 + 1c14cfb commit f8abea8
Show file tree
Hide file tree
Showing 24 changed files with 707 additions and 98 deletions.
1 change: 1 addition & 0 deletions drivers/char/agp/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
agpgart-y := backend.o frontend.o generic.o isoch.o

obj-$(CONFIG_AGP) += agpgart.o
obj-$(CONFIG_COMPAT) += compat_ioctl.o
obj-$(CONFIG_AGP_ALI) += ali-agp.o
obj-$(CONFIG_AGP_ATI) += ati-agp.o
obj-$(CONFIG_AGP_AMD) += amd-k7-agp.o
Expand Down
12 changes: 12 additions & 0 deletions drivers/char/agp/agp.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ struct agp_bridge_driver {
void (*free_by_type)(struct agp_memory *);
void *(*agp_alloc_page)(struct agp_bridge_data *);
void (*agp_destroy_page)(void *);
int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
};

struct agp_bridge_data {
Expand Down Expand Up @@ -218,6 +219,7 @@ struct agp_bridge_data {
#define I810_PTE_MAIN_UNCACHED 0x00000000
#define I810_PTE_LOCAL 0x00000002
#define I810_PTE_VALID 0x00000001
#define I830_PTE_SYSTEM_CACHED 0x00000006
#define I810_SMRAM_MISCC 0x70
#define I810_GFX_MEM_WIN_SIZE 0x00010000
#define I810_GFX_MEM_WIN_32M 0x00010000
Expand Down Expand Up @@ -270,8 +272,16 @@ void global_cache_flush(void);
void get_agp_version(struct agp_bridge_data *bridge);
unsigned long agp_generic_mask_memory(struct agp_bridge_data *bridge,
unsigned long addr, int type);
int agp_generic_type_to_mask_type(struct agp_bridge_data *bridge,
int type);
struct agp_bridge_data *agp_generic_find_bridge(struct pci_dev *pdev);

/* generic functions for user-populated AGP memory types */
struct agp_memory *agp_generic_alloc_user(size_t page_count, int type);
void agp_alloc_page_array(size_t size, struct agp_memory *mem);
void agp_free_page_array(struct agp_memory *mem);


/* generic routines for agp>=3 */
int agp3_generic_fetch_size(void);
void agp3_generic_tlbflush(struct agp_memory *mem);
Expand All @@ -288,6 +298,8 @@ extern struct aper_size_info_16 agp3_generic_sizes[];
extern int agp_off;
extern int agp_try_unsupported_boot;

long compat_agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg);

/* Chipset independant registers (from AGP Spec) */
#define AGP_APBASE 0x10

Expand Down
2 changes: 2 additions & 0 deletions drivers/char/agp/ali-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ static struct agp_bridge_driver ali_generic_bridge = {
.free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = ali_destroy_page,
.agp_type_to_mask_type = agp_generic_type_to_mask_type,
};

static struct agp_bridge_driver ali_m1541_bridge = {
Expand All @@ -237,6 +238,7 @@ static struct agp_bridge_driver ali_m1541_bridge = {
.free_by_type = agp_generic_free_by_type,
.agp_alloc_page = m1541_alloc_page,
.agp_destroy_page = m1541_destroy_page,
.agp_type_to_mask_type = agp_generic_type_to_mask_type,
};


Expand Down
4 changes: 4 additions & 0 deletions drivers/char/agp/alpha-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ static int alpha_core_agp_insert_memory(struct agp_memory *mem, off_t pg_start,
int num_entries, status;
void *temp;

if (type >= AGP_USER_TYPES || mem->type >= AGP_USER_TYPES)
return -EINVAL;

temp = agp_bridge->current_size;
num_entries = A_SIZE_FIX(temp)->num_entries;
if ((pg_start + mem->page_count) > num_entries)
Expand Down Expand Up @@ -142,6 +145,7 @@ struct agp_bridge_driver alpha_core_agp_driver = {
.free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page,
.agp_type_to_mask_type = agp_generic_type_to_mask_type,
};

struct agp_bridge_data *alpha_bridge;
Expand Down
1 change: 1 addition & 0 deletions drivers/char/agp/amd-k7-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ static struct agp_bridge_driver amd_irongate_driver = {
.free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page,
.agp_type_to_mask_type = agp_generic_type_to_mask_type,
};

static struct agp_device_ids amd_agp_device_ids[] __devinitdata =
Expand Down
11 changes: 9 additions & 2 deletions drivers/char/agp/amd64-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
{
int i, j, num_entries;
long long tmp;
int mask_type;
struct agp_bridge_data *bridge = mem->bridge;
u32 pte;

num_entries = agp_num_entries();

if (type != 0 || mem->type != 0)
if (type != mem->type)
return -EINVAL;
mask_type = bridge->driver->agp_type_to_mask_type(bridge, type);
if (mask_type != 0)
return -EINVAL;


/* Make sure we can fit the range in the gatt table. */
/* FIXME: could wrap */
Expand All @@ -90,7 +96,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)

for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
tmp = agp_bridge->driver->mask_memory(agp_bridge,
mem->memory[i], mem->type);
mem->memory[i], mask_type);

BUG_ON(tmp & 0xffffff0000000ffcULL);
pte = (tmp & 0x000000ff00000000ULL) >> 28;
Expand Down Expand Up @@ -247,6 +253,7 @@ static struct agp_bridge_driver amd_8151_driver = {
.free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page,
.agp_type_to_mask_type = agp_generic_type_to_mask_type,
};

/* Some basic sanity checks for the aperture. */
Expand Down
1 change: 1 addition & 0 deletions drivers/char/agp/ati-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ static struct agp_bridge_driver ati_generic_bridge = {
.free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page,
.agp_type_to_mask_type = agp_generic_type_to_mask_type,
};


Expand Down
2 changes: 1 addition & 1 deletion drivers/char/agp/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* fix some real stupidity. It's only by chance we can bump
* past 0.99 at all due to some boolean logic error. */
#define AGPGART_VERSION_MAJOR 0
#define AGPGART_VERSION_MINOR 101
#define AGPGART_VERSION_MINOR 102
static const struct agp_version agp_current_version =
{
.major = AGPGART_VERSION_MAJOR,
Expand Down
Loading

0 comments on commit f8abea8

Please sign in to comment.