Commit 8b8f033b authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[AGPGART] Kill off some typedefs.

Note, I'm leaving behind the ones not in #ifdef __KERNEL__ for now, as I'm
not sure just what userspace stuff that might break.
parent a13100df
...@@ -94,11 +94,12 @@ static void agp_remove_from_pool(agp_memory * temp) ...@@ -94,11 +94,12 @@ static void agp_remove_from_pool(agp_memory * temp)
* to each auth'ed client. * to each auth'ed client.
*/ */
static agp_segment_priv *agp_find_seg_in_client(const agp_client * client, static struct
agp_segment_priv *agp_find_seg_in_client(const struct agp_client *client,
unsigned long offset, unsigned long offset,
int size, pgprot_t page_prot) int size, pgprot_t page_prot)
{ {
agp_segment_priv *seg; struct agp_segment_priv *seg;
int num_segments, i; int num_segments, i;
off_t pg_start; off_t pg_start;
size_t pg_count; size_t pg_count;
...@@ -119,7 +120,7 @@ static agp_segment_priv *agp_find_seg_in_client(const agp_client * client, ...@@ -119,7 +120,7 @@ static agp_segment_priv *agp_find_seg_in_client(const agp_client * client,
return NULL; return NULL;
} }
static void agp_remove_seg_from_client(agp_client * client) static void agp_remove_seg_from_client(struct agp_client *client)
{ {
DBG("client=%p", client); DBG("client=%p", client);
...@@ -134,10 +135,10 @@ static void agp_remove_seg_from_client(agp_client * client) ...@@ -134,10 +135,10 @@ static void agp_remove_seg_from_client(agp_client * client)
} }
} }
static void agp_add_seg_to_client(agp_client * client, static void agp_add_seg_to_client(struct agp_client *client,
agp_segment_priv ** seg, int num_segments) struct agp_segment_priv ** seg, int num_segments)
{ {
agp_segment_priv **prev_seg; struct agp_segment_priv **prev_seg;
prev_seg = client->segments; prev_seg = client->segments;
...@@ -180,20 +181,20 @@ static pgprot_t agp_convert_mmap_flags(int prot) ...@@ -180,20 +181,20 @@ static pgprot_t agp_convert_mmap_flags(int prot)
return temp; return temp;
} }
static int agp_create_segment(agp_client * client, agp_region * region) static int agp_create_segment(struct agp_client *client, struct agp_region *region)
{ {
agp_segment_priv **ret_seg; struct agp_segment_priv **ret_seg;
agp_segment_priv *seg; struct agp_segment_priv *seg;
agp_segment *user_seg; struct agp_segment *user_seg;
size_t i; size_t i;
seg = kmalloc((sizeof(agp_segment_priv) * region->seg_count), GFP_KERNEL); seg = kmalloc((sizeof(struct agp_segment_priv) * region->seg_count), GFP_KERNEL);
if (seg == NULL) { if (seg == NULL) {
kfree(region->seg_list); kfree(region->seg_list);
region->seg_list = NULL; region->seg_list = NULL;
return -ENOMEM; return -ENOMEM;
} }
memset(seg, 0, (sizeof(agp_segment_priv) * region->seg_count)); memset(seg, 0, (sizeof(struct agp_segment_priv) * region->seg_count));
user_seg = region->seg_list; user_seg = region->seg_list;
for (i = 0; i < region->seg_count; i++) { for (i = 0; i < region->seg_count; i++) {
...@@ -233,9 +234,9 @@ static void agp_insert_into_pool(agp_memory * temp) ...@@ -233,9 +234,9 @@ static void agp_insert_into_pool(agp_memory * temp)
/* File private list routines */ /* File private list routines */
agp_file_private *agp_find_private(pid_t pid) struct agp_file_private *agp_find_private(pid_t pid)
{ {
agp_file_private *curr; struct agp_file_private *curr;
curr = agp_fe.file_priv_list; curr = agp_fe.file_priv_list;
...@@ -248,9 +249,9 @@ agp_file_private *agp_find_private(pid_t pid) ...@@ -248,9 +249,9 @@ agp_file_private *agp_find_private(pid_t pid)
return NULL; return NULL;
} }
void agp_insert_file_private(agp_file_private * priv) void agp_insert_file_private(struct agp_file_private * priv)
{ {
agp_file_private *prev; struct agp_file_private *prev;
prev = agp_fe.file_priv_list; prev = agp_fe.file_priv_list;
...@@ -260,10 +261,10 @@ void agp_insert_file_private(agp_file_private * priv) ...@@ -260,10 +261,10 @@ void agp_insert_file_private(agp_file_private * priv)
agp_fe.file_priv_list = priv; agp_fe.file_priv_list = priv;
} }
void agp_remove_file_private(agp_file_private * priv) void agp_remove_file_private(struct agp_file_private * priv)
{ {
agp_file_private *next; struct agp_file_private *next;
agp_file_private *prev; struct agp_file_private *prev;
next = priv->next; next = priv->next;
prev = priv->prev; prev = priv->prev;
...@@ -312,9 +313,9 @@ static agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type) ...@@ -312,9 +313,9 @@ static agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type)
* controllers * controllers
*/ */
static agp_controller *agp_find_controller_by_pid(pid_t id) static struct agp_controller *agp_find_controller_by_pid(pid_t id)
{ {
agp_controller *controller; struct agp_controller *controller;
controller = agp_fe.controllers; controller = agp_fe.controllers;
...@@ -327,24 +328,24 @@ static agp_controller *agp_find_controller_by_pid(pid_t id) ...@@ -327,24 +328,24 @@ static agp_controller *agp_find_controller_by_pid(pid_t id)
return NULL; return NULL;
} }
static agp_controller *agp_create_controller(pid_t id) static struct agp_controller *agp_create_controller(pid_t id)
{ {
agp_controller *controller; struct agp_controller *controller;
controller = kmalloc(sizeof(agp_controller), GFP_KERNEL); controller = kmalloc(sizeof(struct agp_controller), GFP_KERNEL);
if (controller == NULL) if (controller == NULL)
return NULL; return NULL;
memset(controller, 0, sizeof(agp_controller)); memset(controller, 0, sizeof(struct agp_controller));
controller->pid = id; controller->pid = id;
return controller; return controller;
} }
static int agp_insert_controller(agp_controller * controller) static int agp_insert_controller(struct agp_controller *controller)
{ {
agp_controller *prev_controller; struct agp_controller *prev_controller;
prev_controller = agp_fe.controllers; prev_controller = agp_fe.controllers;
controller->next = prev_controller; controller->next = prev_controller;
...@@ -357,15 +358,15 @@ static int agp_insert_controller(agp_controller * controller) ...@@ -357,15 +358,15 @@ static int agp_insert_controller(agp_controller * controller)
return 0; return 0;
} }
static void agp_remove_all_clients(agp_controller * controller) static void agp_remove_all_clients(struct agp_controller *controller)
{ {
agp_client *client; struct agp_client *client;
agp_client *temp; struct agp_client *temp;
client = controller->clients; client = controller->clients;
while (client) { while (client) {
agp_file_private *priv; struct agp_file_private *priv;
temp = client; temp = client;
agp_remove_seg_from_client(temp); agp_remove_seg_from_client(temp);
...@@ -380,7 +381,7 @@ static void agp_remove_all_clients(agp_controller * controller) ...@@ -380,7 +381,7 @@ static void agp_remove_all_clients(agp_controller * controller)
} }
} }
static void agp_remove_all_memory(agp_controller * controller) static void agp_remove_all_memory(struct agp_controller *controller)
{ {
agp_memory *memory; agp_memory *memory;
agp_memory *temp; agp_memory *temp;
...@@ -394,10 +395,10 @@ static void agp_remove_all_memory(agp_controller * controller) ...@@ -394,10 +395,10 @@ static void agp_remove_all_memory(agp_controller * controller)
} }
} }
static int agp_remove_controller(agp_controller * controller) static int agp_remove_controller(struct agp_controller *controller)
{ {
agp_controller *prev_controller; struct agp_controller *prev_controller;
agp_controller *next_controller; struct agp_controller *next_controller;
prev_controller = controller->prev; prev_controller = controller->prev;
next_controller = controller->next; next_controller = controller->next;
...@@ -426,14 +427,14 @@ static int agp_remove_controller(agp_controller * controller) ...@@ -426,14 +427,14 @@ static int agp_remove_controller(agp_controller * controller)
return 0; return 0;
} }
static void agp_controller_make_current(agp_controller * controller) static void agp_controller_make_current(struct agp_controller *controller)
{ {
agp_client *clients; struct agp_client *clients;
clients = controller->clients; clients = controller->clients;
while (clients != NULL) { while (clients != NULL) {
agp_file_private *priv; struct agp_file_private *priv;
priv = agp_find_private(clients->pid); priv = agp_find_private(clients->pid);
...@@ -447,16 +448,16 @@ static void agp_controller_make_current(agp_controller * controller) ...@@ -447,16 +448,16 @@ static void agp_controller_make_current(agp_controller * controller)
agp_fe.current_controller = controller; agp_fe.current_controller = controller;
} }
static void agp_controller_release_current(agp_controller * controller, static void agp_controller_release_current(struct agp_controller *controller,
agp_file_private * controller_priv) struct agp_file_private *controller_priv)
{ {
agp_client *clients; struct agp_client *clients;
clear_bit(AGP_FF_IS_VALID, &controller_priv->access_flags); clear_bit(AGP_FF_IS_VALID, &controller_priv->access_flags);
clients = controller->clients; clients = controller->clients;
while (clients != NULL) { while (clients != NULL) {
agp_file_private *priv; struct agp_file_private *priv;
priv = agp_find_private(clients->pid); priv = agp_find_private(clients->pid);
...@@ -476,10 +477,10 @@ static void agp_controller_release_current(agp_controller * controller, ...@@ -476,10 +477,10 @@ static void agp_controller_release_current(agp_controller * controller,
* These routines are for managing the list of auth'ed clients. * These routines are for managing the list of auth'ed clients.
*/ */
static agp_client *agp_find_client_in_controller(agp_controller * controller, static struct agp_client
pid_t id) *agp_find_client_in_controller(struct agp_controller *controller, pid_t id)
{ {
agp_client *client; struct agp_client *client;
if (controller == NULL) if (controller == NULL)
return NULL; return NULL;
...@@ -495,9 +496,9 @@ static agp_client *agp_find_client_in_controller(agp_controller * controller, ...@@ -495,9 +496,9 @@ static agp_client *agp_find_client_in_controller(agp_controller * controller,
return NULL; return NULL;
} }
static agp_controller *agp_find_controller_for_client(pid_t id) static struct agp_controller *agp_find_controller_for_client(pid_t id)
{ {
agp_controller *controller; struct agp_controller *controller;
controller = agp_fe.controllers; controller = agp_fe.controllers;
...@@ -510,9 +511,9 @@ static agp_controller *agp_find_controller_for_client(pid_t id) ...@@ -510,9 +511,9 @@ static agp_controller *agp_find_controller_for_client(pid_t id)
return NULL; return NULL;
} }
static agp_client *agp_find_client_by_pid(pid_t id) static struct agp_client *agp_find_client_by_pid(pid_t id)
{ {
agp_client *temp; struct agp_client *temp;
if (agp_fe.current_controller == NULL) if (agp_fe.current_controller == NULL)
return NULL; return NULL;
...@@ -521,9 +522,9 @@ static agp_client *agp_find_client_by_pid(pid_t id) ...@@ -521,9 +522,9 @@ static agp_client *agp_find_client_by_pid(pid_t id)
return temp; return temp;
} }
static void agp_insert_client(agp_client * client) static void agp_insert_client(struct agp_client *client)
{ {
agp_client *prev_client; struct agp_client *prev_client;
prev_client = agp_fe.current_controller->clients; prev_client = agp_fe.current_controller->clients;
client->next = prev_client; client->next = prev_client;
...@@ -535,16 +536,16 @@ static void agp_insert_client(agp_client * client) ...@@ -535,16 +536,16 @@ static void agp_insert_client(agp_client * client)
agp_fe.current_controller->num_clients++; agp_fe.current_controller->num_clients++;
} }
static agp_client *agp_create_client(pid_t id) static struct agp_client *agp_create_client(pid_t id)
{ {
agp_client *new_client; struct agp_client *new_client;
new_client = kmalloc(sizeof(agp_client), GFP_KERNEL); new_client = kmalloc(sizeof(struct agp_client), GFP_KERNEL);
if (new_client == NULL) if (new_client == NULL)
return NULL; return NULL;
memset(new_client, 0, sizeof(agp_client)); memset(new_client, 0, sizeof(struct agp_client));
new_client->pid = id; new_client->pid = id;
agp_insert_client(new_client); agp_insert_client(new_client);
return new_client; return new_client;
...@@ -552,10 +553,10 @@ static agp_client *agp_create_client(pid_t id) ...@@ -552,10 +553,10 @@ static agp_client *agp_create_client(pid_t id)
static int agp_remove_client(pid_t id) static int agp_remove_client(pid_t id)
{ {
agp_client *client; struct agp_client *client;
agp_client *prev_client; struct agp_client *prev_client;
agp_client *next_client; struct agp_client *next_client;
agp_controller *controller; struct agp_controller *controller;
controller = agp_find_controller_for_client(id); controller = agp_find_controller_for_client(id);
if (controller == NULL) if (controller == NULL)
...@@ -593,8 +594,8 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -593,8 +594,8 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
{ {
unsigned int size, current_size; unsigned int size, current_size;
unsigned long offset; unsigned long offset;
agp_client *client; struct agp_client *client;
agp_file_private *priv = (agp_file_private *) file->private_data; struct agp_file_private *priv = file->private_data;
agp_kern_info kerninfo; agp_kern_info kerninfo;
down(&(agp_fe.agp_mutex)); down(&(agp_fe.agp_mutex));
...@@ -667,22 +668,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -667,22 +668,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
static int agp_release(struct inode *inode, struct file *file) static int agp_release(struct inode *inode, struct file *file)
{ {
agp_file_private *priv = (agp_file_private *) file->private_data; struct agp_file_private *priv = file->private_data;
down(&(agp_fe.agp_mutex)); down(&(agp_fe.agp_mutex));
DBG("priv=%p", priv); DBG("priv=%p", priv);
if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) { if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
agp_controller *controller; struct agp_controller *controller;
controller = agp_find_controller_by_pid(priv->my_pid); controller = agp_find_controller_by_pid(priv->my_pid);
if (controller != NULL) { if (controller != NULL) {
if (controller == agp_fe.current_controller) { if (controller == agp_fe.current_controller)
agp_controller_release_current(controller, agp_controller_release_current(controller, priv);
priv);
}
agp_remove_controller(controller); agp_remove_controller(controller);
controller = NULL; controller = NULL;
} }
...@@ -693,7 +692,7 @@ static int agp_release(struct inode *inode, struct file *file) ...@@ -693,7 +692,7 @@ static int agp_release(struct inode *inode, struct file *file)
agp_remove_file_private(priv); agp_remove_file_private(priv);
kfree(priv); kfree(priv);
(agp_file_private *) file->private_data = NULL; file->private_data = NULL;
up(&(agp_fe.agp_mutex)); up(&(agp_fe.agp_mutex));
return 0; return 0;
} }
...@@ -701,8 +700,8 @@ static int agp_release(struct inode *inode, struct file *file) ...@@ -701,8 +700,8 @@ static int agp_release(struct inode *inode, struct file *file)
static int agp_open(struct inode *inode, struct file *file) static int agp_open(struct inode *inode, struct file *file)
{ {
int minor = minor(inode->i_rdev); int minor = minor(inode->i_rdev);
agp_file_private *priv; struct agp_file_private *priv;
agp_client *client; struct agp_client *client;
int rc = -ENXIO; int rc = -ENXIO;
down(&(agp_fe.agp_mutex)); down(&(agp_fe.agp_mutex));
...@@ -710,11 +709,11 @@ static int agp_open(struct inode *inode, struct file *file) ...@@ -710,11 +709,11 @@ static int agp_open(struct inode *inode, struct file *file)
if (minor != AGPGART_MINOR) if (minor != AGPGART_MINOR)
goto err_out; goto err_out;
priv = kmalloc(sizeof(agp_file_private), GFP_KERNEL); priv = kmalloc(sizeof(struct agp_file_private), GFP_KERNEL);
if (priv == NULL) if (priv == NULL)
goto err_out_nomem; goto err_out_nomem;
memset(priv, 0, sizeof(agp_file_private)); memset(priv, 0, sizeof(struct agp_file_private));
set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags); set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags);
priv->my_pid = current->pid; priv->my_pid = current->pid;
...@@ -754,9 +753,9 @@ static ssize_t agp_write(struct file *file, const char *buf, ...@@ -754,9 +753,9 @@ static ssize_t agp_write(struct file *file, const char *buf,
return -EINVAL; return -EINVAL;
} }
static int agpioc_info_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_info_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
agp_info userinfo; struct agp_info userinfo;
agp_kern_info kerninfo; agp_kern_info kerninfo;
agp_copy_info(&kerninfo); agp_copy_info(&kerninfo);
...@@ -771,16 +770,16 @@ static int agpioc_info_wrap(agp_file_private * priv, unsigned long arg) ...@@ -771,16 +770,16 @@ static int agpioc_info_wrap(agp_file_private * priv, unsigned long arg)
userinfo.pg_total = userinfo.pg_system = kerninfo.max_memory; userinfo.pg_total = userinfo.pg_system = kerninfo.max_memory;
userinfo.pg_used = kerninfo.current_memory; userinfo.pg_used = kerninfo.current_memory;
if (copy_to_user((void *) arg, &userinfo, sizeof(agp_info))) if (copy_to_user((void *) arg, &userinfo, sizeof(struct agp_info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
static int agpioc_acquire_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_acquire_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
int ret; int ret;
agp_controller *controller; struct agp_controller *controller;
DBG(""); DBG("");
...@@ -817,36 +816,36 @@ static int agpioc_acquire_wrap(agp_file_private * priv, unsigned long arg) ...@@ -817,36 +816,36 @@ static int agpioc_acquire_wrap(agp_file_private * priv, unsigned long arg)
return 0; return 0;
} }
static int agpioc_release_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_release_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
DBG(""); DBG("");
agp_controller_release_current(agp_fe.current_controller, priv); agp_controller_release_current(agp_fe.current_controller, priv);
return 0; return 0;
} }
static int agpioc_setup_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_setup_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
agp_setup mode; struct agp_setup mode;
DBG(""); DBG("");
if (copy_from_user(&mode, (void *) arg, sizeof(agp_setup))) if (copy_from_user(&mode, (void *) arg, sizeof(struct agp_setup)))
return -EFAULT; return -EFAULT;
agp_enable(mode.agp_mode); agp_enable(mode.agp_mode);
return 0; return 0;
} }
static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_reserve_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
agp_region reserve; struct agp_region reserve;
agp_client *client; struct agp_client *client;
agp_file_private *client_priv; struct agp_file_private *client_priv;
DBG(""); DBG("");
if (copy_from_user(&reserve, (void *) arg, sizeof(agp_region))) if (copy_from_user(&reserve, (void *) arg, sizeof(struct agp_region)))
return -EFAULT; return -EFAULT;
if ((unsigned) reserve.seg_count >= ~0U/sizeof(agp_segment)) if ((unsigned) reserve.seg_count >= ~0U/sizeof(struct agp_segment))
return -EFAULT; return -EFAULT;
client = agp_find_client_by_pid(reserve.pid); client = agp_find_client_by_pid(reserve.pid);
...@@ -865,19 +864,19 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg) ...@@ -865,19 +864,19 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
} }
return agp_remove_client(reserve.pid); return agp_remove_client(reserve.pid);
} else { } else {
agp_segment *segment; struct agp_segment *segment;
if (reserve.seg_count >= 16384) if (reserve.seg_count >= 16384)
return -EINVAL; return -EINVAL;
segment = kmalloc((sizeof(agp_segment) * reserve.seg_count), segment = kmalloc((sizeof(struct agp_segment) * reserve.seg_count),
GFP_KERNEL); GFP_KERNEL);
if (segment == NULL) if (segment == NULL)
return -ENOMEM; return -ENOMEM;
if (copy_from_user(segment, (void *) reserve.seg_list, if (copy_from_user(segment, (void *) reserve.seg_list,
sizeof(agp_segment) * reserve.seg_count)) { sizeof(struct agp_segment) * reserve.seg_count)) {
kfree(segment); kfree(segment);
return -EFAULT; return -EFAULT;
} }
...@@ -904,20 +903,20 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg) ...@@ -904,20 +903,20 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
return -EINVAL; return -EINVAL;
} }
static int agpioc_protect_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_protect_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
DBG(""); DBG("");
/* This function is not currently implemented */ /* This function is not currently implemented */
return -EINVAL; return -EINVAL;
} }
static int agpioc_allocate_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_allocate_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
agp_memory *memory; agp_memory *memory;
agp_allocate alloc; struct agp_allocate alloc;
DBG(""); DBG("");
if (copy_from_user(&alloc, (void *) arg, sizeof(agp_allocate))) if (copy_from_user(&alloc, (void *) arg, sizeof(struct agp_allocate)))
return -EFAULT; return -EFAULT;
memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type); memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type);
...@@ -928,14 +927,14 @@ static int agpioc_allocate_wrap(agp_file_private * priv, unsigned long arg) ...@@ -928,14 +927,14 @@ static int agpioc_allocate_wrap(agp_file_private * priv, unsigned long arg)
alloc.key = memory->key; alloc.key = memory->key;
alloc.physical = memory->physical; alloc.physical = memory->physical;
if (copy_to_user((void *) arg, &alloc, sizeof(agp_allocate))) { if (copy_to_user((void *) arg, &alloc, sizeof(struct agp_allocate))) {
agp_free_memory_wrap(memory); agp_free_memory_wrap(memory);
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
} }
static int agpioc_deallocate_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_deallocate_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
agp_memory *memory; agp_memory *memory;
...@@ -949,13 +948,13 @@ static int agpioc_deallocate_wrap(agp_file_private * priv, unsigned long arg) ...@@ -949,13 +948,13 @@ static int agpioc_deallocate_wrap(agp_file_private * priv, unsigned long arg)
return 0; return 0;
} }
static int agpioc_bind_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_bind_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
agp_bind bind_info; struct agp_bind bind_info;
agp_memory *memory; agp_memory *memory;
DBG(""); DBG("");
if (copy_from_user(&bind_info, (void *) arg, sizeof(agp_bind))) if (copy_from_user(&bind_info, (void *) arg, sizeof(struct agp_bind)))
return -EFAULT; return -EFAULT;
memory = agp_find_mem_by_key(bind_info.key); memory = agp_find_mem_by_key(bind_info.key);
...@@ -966,13 +965,13 @@ static int agpioc_bind_wrap(agp_file_private * priv, unsigned long arg) ...@@ -966,13 +965,13 @@ static int agpioc_bind_wrap(agp_file_private * priv, unsigned long arg)
return agp_bind_memory(memory, bind_info.pg_start); return agp_bind_memory(memory, bind_info.pg_start);
} }
static int agpioc_unbind_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_unbind_wrap(struct agp_file_private *priv, unsigned long arg)
{ {
agp_memory *memory; agp_memory *memory;
agp_unbind unbind; struct agp_unbind unbind;
DBG(""); DBG("");
if (copy_from_user(&unbind, (void *) arg, sizeof(agp_unbind))) if (copy_from_user(&unbind, (void *) arg, sizeof(struct agp_unbind)))
return -EFAULT; return -EFAULT;
memory = agp_find_mem_by_key(unbind.key); memory = agp_find_mem_by_key(unbind.key);
...@@ -986,7 +985,7 @@ static int agpioc_unbind_wrap(agp_file_private * priv, unsigned long arg) ...@@ -986,7 +985,7 @@ static int agpioc_unbind_wrap(agp_file_private * priv, unsigned long arg)
static int agp_ioctl(struct inode *inode, struct file *file, static int agp_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
agp_file_private *curr_priv = (agp_file_private *) file->private_data; struct agp_file_private *curr_priv = file->private_data;
int ret_val = -ENOTTY; int ret_val = -ENOTTY;
DBG("priv=%p, cmd=%x", curr_priv, cmd); DBG("priv=%p, cmd=%x", curr_priv, cmd);
......
...@@ -27,17 +27,19 @@ ...@@ -27,17 +27,19 @@
#ifndef _AGP_H #ifndef _AGP_H
#define _AGP_H 1 #define _AGP_H 1
#include <linux/agp_backend.h>
#define AGPIOC_BASE 'A' #define AGPIOC_BASE 'A'
#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, agp_info*) #define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)
#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1) #define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)
#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2) #define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)
#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, agp_setup*) #define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*)
#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, agp_region*) #define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)
#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, agp_region*) #define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)
#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, agp_allocate*) #define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, agp_bind*) #define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, agp_unbind*) #define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
#define AGP_DEVICE "/dev/agpgart" #define AGP_DEVICE "/dev/agpgart"
...@@ -112,15 +114,7 @@ typedef struct _agp_unbind { ...@@ -112,15 +114,7 @@ typedef struct _agp_unbind {
#define AGPGART_MINOR 175 #define AGPGART_MINOR 175
#ifndef _AGP_BACKEND_H struct agp_info {
struct _agp_version {
u16 major;
u16 minor;
} agp_version;
#endif
typedef struct _agp_info {
struct agp_version version; /* version of the driver */ struct agp_version version; /* version of the driver */
u32 bridge_id; /* bridge vendor/device */ u32 bridge_id; /* bridge vendor/device */
u32 agp_mode; /* mode info of bridge */ u32 agp_mode; /* mode info of bridge */
...@@ -129,34 +123,34 @@ typedef struct _agp_info { ...@@ -129,34 +123,34 @@ typedef struct _agp_info {
size_t pg_total; /* max pages (swap + system) */ size_t pg_total; /* max pages (swap + system) */
size_t pg_system; /* max pages (system) */ size_t pg_system; /* max pages (system) */
size_t pg_used; /* current pages used */ size_t pg_used; /* current pages used */
} agp_info; };
typedef struct _agp_setup { struct agp_setup {
u32 agp_mode; /* mode info of bridge */ u32 agp_mode; /* mode info of bridge */
} agp_setup; };
/* /*
* The "prot" down below needs still a "sleep" flag somehow ... * The "prot" down below needs still a "sleep" flag somehow ...
*/ */
typedef struct _agp_segment { struct agp_segment {
off_t pg_start; /* starting page to populate */ off_t pg_start; /* starting page to populate */
size_t pg_count; /* number of pages */ size_t pg_count; /* number of pages */
int prot; /* prot flags for mmap */ int prot; /* prot flags for mmap */
} agp_segment; };
typedef struct _agp_segment_priv { struct agp_segment_priv {
off_t pg_start; off_t pg_start;
size_t pg_count; size_t pg_count;
pgprot_t prot; pgprot_t prot;
} agp_segment_priv; };
typedef struct _agp_region { struct agp_region {
pid_t pid; /* pid of process */ pid_t pid; /* pid of process */
size_t seg_count; /* number of segments */ size_t seg_count; /* number of segments */
struct _agp_segment *seg_list; struct agp_segment *seg_list;
} agp_region; };
typedef struct _agp_allocate { struct agp_allocate {
int key; /* tag of allocation */ int key; /* tag of allocation */
size_t pg_count; /* number of pages */ size_t pg_count; /* number of pages */
u32 type; /* 0 == normal, other devspec */ u32 type; /* 0 == normal, other devspec */
...@@ -164,34 +158,34 @@ typedef struct _agp_allocate { ...@@ -164,34 +158,34 @@ typedef struct _agp_allocate {
* need a phys address of the * need a phys address of the
* actual page behind the gatt * actual page behind the gatt
* table) */ * table) */
} agp_allocate; };
typedef struct _agp_bind { struct agp_bind {
int key; /* tag of allocation */ int key; /* tag of allocation */
off_t pg_start; /* starting page to populate */ off_t pg_start; /* starting page to populate */
} agp_bind; };
typedef struct _agp_unbind { struct agp_unbind {
int key; /* tag of allocation */ int key; /* tag of allocation */
u32 priority; /* priority for paging out */ u32 priority; /* priority for paging out */
} agp_unbind; };
typedef struct _agp_client { struct agp_client {
struct _agp_client *next; struct agp_client *next;
struct _agp_client *prev; struct agp_client *prev;
pid_t pid; pid_t pid;
int num_segments; int num_segments;
agp_segment_priv **segments; struct agp_segment_priv **segments;
} agp_client; };
typedef struct _agp_controller { struct agp_controller {
struct _agp_controller *next; struct agp_controller *next;
struct _agp_controller *prev; struct agp_controller *prev;
pid_t pid; pid_t pid;
int num_clients; int num_clients;
agp_memory *pool; agp_memory *pool;
agp_client *clients; struct agp_client *clients;
} agp_controller; };
#define AGP_FF_ALLOW_CLIENT 0 #define AGP_FF_ALLOW_CLIENT 0
#define AGP_FF_ALLOW_CONTROLLER 1 #define AGP_FF_ALLOW_CONTROLLER 1
...@@ -199,18 +193,18 @@ typedef struct _agp_controller { ...@@ -199,18 +193,18 @@ typedef struct _agp_controller {
#define AGP_FF_IS_CONTROLLER 3 #define AGP_FF_IS_CONTROLLER 3
#define AGP_FF_IS_VALID 4 #define AGP_FF_IS_VALID 4
typedef struct _agp_file_private { struct agp_file_private {
struct _agp_file_private *next; struct agp_file_private *next;
struct _agp_file_private *prev; struct agp_file_private *prev;
pid_t my_pid; pid_t my_pid;
long access_flags; /* long req'd for set_bit --RR */ long access_flags; /* long req'd for set_bit --RR */
} agp_file_private; };
struct agp_front_data { struct agp_front_data {
struct semaphore agp_mutex; struct semaphore agp_mutex;
agp_controller *current_controller; struct agp_controller *current_controller;
agp_controller *controllers; struct agp_controller *controllers;
agp_file_private *file_priv_list; struct agp_file_private *file_priv_list;
u8 used_by_controller; u8 used_by_controller;
u8 backend_acquired; u8 backend_acquired;
}; };
......
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