diff options
Diffstat (limited to 'drivers/char/agp/amd64-agp.c')
-rw-r--r-- | drivers/char/agp/amd64-agp.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 93d2209fee4c..636d984ed4a6 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -62,12 +62,18 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
62 | { | 62 | { |
63 | int i, j, num_entries; | 63 | int i, j, num_entries; |
64 | long long tmp; | 64 | long long tmp; |
65 | int mask_type; | ||
66 | struct agp_bridge_data *bridge = mem->bridge; | ||
65 | u32 pte; | 67 | u32 pte; |
66 | 68 | ||
67 | num_entries = agp_num_entries(); | 69 | num_entries = agp_num_entries(); |
68 | 70 | ||
69 | if (type != 0 || mem->type != 0) | 71 | if (type != mem->type) |
70 | return -EINVAL; | 72 | return -EINVAL; |
73 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); | ||
74 | if (mask_type != 0) | ||
75 | return -EINVAL; | ||
76 | |||
71 | 77 | ||
72 | /* Make sure we can fit the range in the gatt table. */ | 78 | /* Make sure we can fit the range in the gatt table. */ |
73 | /* FIXME: could wrap */ | 79 | /* FIXME: could wrap */ |
@@ -90,7 +96,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
90 | 96 | ||
91 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { | 97 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { |
92 | tmp = agp_bridge->driver->mask_memory(agp_bridge, | 98 | tmp = agp_bridge->driver->mask_memory(agp_bridge, |
93 | mem->memory[i], mem->type); | 99 | mem->memory[i], mask_type); |
94 | 100 | ||
95 | BUG_ON(tmp & 0xffffff0000000ffcULL); | 101 | BUG_ON(tmp & 0xffffff0000000ffcULL); |
96 | pte = (tmp & 0x000000ff00000000ULL) >> 28; | 102 | pte = (tmp & 0x000000ff00000000ULL) >> 28; |
@@ -247,6 +253,7 @@ static struct agp_bridge_driver amd_8151_driver = { | |||
247 | .free_by_type = agp_generic_free_by_type, | 253 | .free_by_type = agp_generic_free_by_type, |
248 | .agp_alloc_page = agp_generic_alloc_page, | 254 | .agp_alloc_page = agp_generic_alloc_page, |
249 | .agp_destroy_page = agp_generic_destroy_page, | 255 | .agp_destroy_page = agp_generic_destroy_page, |
256 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, | ||
250 | }; | 257 | }; |
251 | 258 | ||
252 | /* Some basic sanity checks for the aperture. */ | 259 | /* Some basic sanity checks for the aperture. */ |