2 * AGPGART driver frontend
3 * Copyright (C) 2004 Silicon Graphics, Inc.
4 * Copyright (C) 2002-2003 Dave Jones
5 * Copyright (C) 1999 Jeff Hartmann
6 * Copyright (C) 1999 Precision Insight, Inc.
7 * Copyright (C) 1999 Xi Graphics, Inc.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
23 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
25 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 #include <linux/types.h>
30 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/mman.h>
33 #include <linux/pci.h>
34 #include <linux/init.h>
35 #include <linux/miscdevice.h>
36 #include <linux/agp_backend.h>
37 #include <linux/agpgart.h>
38 #include <linux/slab.h>
41 #include <linux/sched.h>
42 #include <linux/smp_lock.h>
43 #include <asm/uaccess.h>
44 #include <asm/pgtable.h>
47 struct agp_front_data agp_fe;
49 struct agp_memory *agp_find_mem_by_key(int key)
51 struct agp_memory *curr;
53 if (agp_fe.current_controller == NULL)
56 curr = agp_fe.current_controller->pool;
58 while (curr != NULL) {
64 DBG("key=%d -> mem=%p", key, curr);
68 static void agp_remove_from_pool(struct agp_memory *temp)
70 struct agp_memory *prev;
71 struct agp_memory *next;
73 /* Check to see if this is even in the memory pool */
76 if (agp_find_mem_by_key(temp->key) != NULL) {
86 /* This is the first item on the list */
90 agp_fe.current_controller->pool = next;
96 * Routines for managing each client's segment list -
97 * These routines handle adding and removing segments
98 * to each auth'ed client.
102 agp_segment_priv *agp_find_seg_in_client(const struct agp_client *client,
103 unsigned long offset,
104 int size, pgprot_t page_prot)
106 struct agp_segment_priv *seg;
111 pg_start = offset / 4096;
112 pg_count = size / 4096;
113 seg = *(client->segments);
114 num_segments = client->num_segments;
116 for (i = 0; i < client->num_segments; i++) {
117 if ((seg[i].pg_start == pg_start) &&
118 (seg[i].pg_count == pg_count) &&
119 (pgprot_val(seg[i].prot) == pgprot_val(page_prot))) {
127 static void agp_remove_seg_from_client(struct agp_client *client)
129 DBG("client=%p", client);
131 if (client->segments != NULL) {
132 if (*(client->segments) != NULL) {
133 DBG("Freeing %p from client %p", *(client->segments), client);
134 kfree(*(client->segments));
136 DBG("Freeing %p from client %p", client->segments, client);
137 kfree(client->segments);
138 client->segments = NULL;
142 static void agp_add_seg_to_client(struct agp_client *client,
143 struct agp_segment_priv ** seg, int num_segments)
145 struct agp_segment_priv **prev_seg;
147 prev_seg = client->segments;
149 if (prev_seg != NULL)
150 agp_remove_seg_from_client(client);
152 DBG("Adding seg %p (%d segments) to client %p", seg, num_segments, client);
153 client->num_segments = num_segments;
154 client->segments = seg;
157 static pgprot_t agp_convert_mmap_flags(int prot)
159 unsigned long prot_bits;
161 prot_bits = calc_vm_prot_bits(prot) | VM_SHARED;
162 return vm_get_page_prot(prot_bits);
165 int agp_create_segment(struct agp_client *client, struct agp_region *region)
167 struct agp_segment_priv **ret_seg;
168 struct agp_segment_priv *seg;
169 struct agp_segment *user_seg;
172 seg = kzalloc((sizeof(struct agp_segment_priv) * region->seg_count), GFP_KERNEL);
174 kfree(region->seg_list);
175 region->seg_list = NULL;
178 user_seg = region->seg_list;
180 for (i = 0; i < region->seg_count; i++) {
181 seg[i].pg_start = user_seg[i].pg_start;
182 seg[i].pg_count = user_seg[i].pg_count;
183 seg[i].prot = agp_convert_mmap_flags(user_seg[i].prot);
185 kfree(region->seg_list);
186 region->seg_list = NULL;
188 ret_seg = kmalloc(sizeof(void *), GFP_KERNEL);
189 if (ret_seg == NULL) {
194 agp_add_seg_to_client(client, ret_seg, region->seg_count);
198 /* End - Routines for managing each client's segment list */
200 /* This function must only be called when current_controller != NULL */
201 static void agp_insert_into_pool(struct agp_memory * temp)
203 struct agp_memory *prev;
205 prev = agp_fe.current_controller->pool;
211 agp_fe.current_controller->pool = temp;
215 /* File private list routines */
217 struct agp_file_private *agp_find_private(pid_t pid)
219 struct agp_file_private *curr;
221 curr = agp_fe.file_priv_list;
223 while (curr != NULL) {
224 if (curr->my_pid == pid)
232 static void agp_insert_file_private(struct agp_file_private * priv)
234 struct agp_file_private *prev;
236 prev = agp_fe.file_priv_list;
241 agp_fe.file_priv_list = priv;
244 static void agp_remove_file_private(struct agp_file_private * priv)
246 struct agp_file_private *next;
247 struct agp_file_private *prev;
262 agp_fe.file_priv_list = next;
266 /* End - File flag list routines */
269 * Wrappers for agp_free_memory & agp_allocate_memory
270 * These make sure that internal lists are kept updated.
272 void agp_free_memory_wrap(struct agp_memory *memory)
274 agp_remove_from_pool(memory);
275 agp_free_memory(memory);
278 struct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type)
280 struct agp_memory *memory;
282 memory = agp_allocate_memory(agp_bridge, pg_count, type);
286 agp_insert_into_pool(memory);
290 /* Routines for managing the list of controllers -
291 * These routines manage the current controller, and the list of
295 static struct agp_controller *agp_find_controller_by_pid(pid_t id)
297 struct agp_controller *controller;
299 controller = agp_fe.controllers;
301 while (controller != NULL) {
302 if (controller->pid == id)
304 controller = controller->next;
310 static struct agp_controller *agp_create_controller(pid_t id)
312 struct agp_controller *controller;
314 controller = kzalloc(sizeof(struct agp_controller), GFP_KERNEL);
315 if (controller == NULL)
318 controller->pid = id;
322 static int agp_insert_controller(struct agp_controller *controller)
324 struct agp_controller *prev_controller;
326 prev_controller = agp_fe.controllers;
327 controller->next = prev_controller;
329 if (prev_controller != NULL)
330 prev_controller->prev = controller;
332 agp_fe.controllers = controller;
337 static void agp_remove_all_clients(struct agp_controller *controller)
339 struct agp_client *client;
340 struct agp_client *temp;
342 client = controller->clients;
345 struct agp_file_private *priv;
348 agp_remove_seg_from_client(temp);
349 priv = agp_find_private(temp->pid);
352 clear_bit(AGP_FF_IS_VALID, &priv->access_flags);
353 clear_bit(AGP_FF_IS_CLIENT, &priv->access_flags);
355 client = client->next;
360 static void agp_remove_all_memory(struct agp_controller *controller)
362 struct agp_memory *memory;
363 struct agp_memory *temp;
365 memory = controller->pool;
369 memory = memory->next;
370 agp_free_memory_wrap(temp);
374 static int agp_remove_controller(struct agp_controller *controller)
376 struct agp_controller *prev_controller;
377 struct agp_controller *next_controller;
379 prev_controller = controller->prev;
380 next_controller = controller->next;
382 if (prev_controller != NULL) {
383 prev_controller->next = next_controller;
384 if (next_controller != NULL)
385 next_controller->prev = prev_controller;
388 if (next_controller != NULL)
389 next_controller->prev = NULL;
391 agp_fe.controllers = next_controller;
394 agp_remove_all_memory(controller);
395 agp_remove_all_clients(controller);
397 if (agp_fe.current_controller == controller) {
398 agp_fe.current_controller = NULL;
399 agp_fe.backend_acquired = FALSE;
400 agp_backend_release(agp_bridge);
406 static void agp_controller_make_current(struct agp_controller *controller)
408 struct agp_client *clients;
410 clients = controller->clients;
412 while (clients != NULL) {
413 struct agp_file_private *priv;
415 priv = agp_find_private(clients->pid);
418 set_bit(AGP_FF_IS_VALID, &priv->access_flags);
419 set_bit(AGP_FF_IS_CLIENT, &priv->access_flags);
421 clients = clients->next;
424 agp_fe.current_controller = controller;
427 static void agp_controller_release_current(struct agp_controller *controller,
428 struct agp_file_private *controller_priv)
430 struct agp_client *clients;
432 clear_bit(AGP_FF_IS_VALID, &controller_priv->access_flags);
433 clients = controller->clients;
435 while (clients != NULL) {
436 struct agp_file_private *priv;
438 priv = agp_find_private(clients->pid);
441 clear_bit(AGP_FF_IS_VALID, &priv->access_flags);
443 clients = clients->next;
446 agp_fe.current_controller = NULL;
447 agp_fe.used_by_controller = FALSE;
448 agp_backend_release(agp_bridge);
452 * Routines for managing client lists -
453 * These routines are for managing the list of auth'ed clients.
456 static struct agp_client
457 *agp_find_client_in_controller(struct agp_controller *controller, pid_t id)
459 struct agp_client *client;
461 if (controller == NULL)
464 client = controller->clients;
466 while (client != NULL) {
467 if (client->pid == id)
469 client = client->next;
475 static struct agp_controller *agp_find_controller_for_client(pid_t id)
477 struct agp_controller *controller;
479 controller = agp_fe.controllers;
481 while (controller != NULL) {
482 if ((agp_find_client_in_controller(controller, id)) != NULL)
484 controller = controller->next;
490 struct agp_client *agp_find_client_by_pid(pid_t id)
492 struct agp_client *temp;
494 if (agp_fe.current_controller == NULL)
497 temp = agp_find_client_in_controller(agp_fe.current_controller, id);
501 static void agp_insert_client(struct agp_client *client)
503 struct agp_client *prev_client;
505 prev_client = agp_fe.current_controller->clients;
506 client->next = prev_client;
508 if (prev_client != NULL)
509 prev_client->prev = client;
511 agp_fe.current_controller->clients = client;
512 agp_fe.current_controller->num_clients++;
515 struct agp_client *agp_create_client(pid_t id)
517 struct agp_client *new_client;
519 new_client = kzalloc(sizeof(struct agp_client), GFP_KERNEL);
520 if (new_client == NULL)
523 new_client->pid = id;
524 agp_insert_client(new_client);
528 int agp_remove_client(pid_t id)
530 struct agp_client *client;
531 struct agp_client *prev_client;
532 struct agp_client *next_client;
533 struct agp_controller *controller;
535 controller = agp_find_controller_for_client(id);
536 if (controller == NULL)
539 client = agp_find_client_in_controller(controller, id);
543 prev_client = client->prev;
544 next_client = client->next;
546 if (prev_client != NULL) {
547 prev_client->next = next_client;
548 if (next_client != NULL)
549 next_client->prev = prev_client;
552 if (next_client != NULL)
553 next_client->prev = NULL;
554 controller->clients = next_client;
557 controller->num_clients--;
558 agp_remove_seg_from_client(client);
563 /* End - Routines for managing client lists */
565 /* File Operations */
567 static int agp_mmap(struct file *file, struct vm_area_struct *vma)
569 unsigned int size, current_size;
570 unsigned long offset;
571 struct agp_client *client;
572 struct agp_file_private *priv = file->private_data;
573 struct agp_kern_info kerninfo;
575 mutex_lock(&(agp_fe.agp_mutex));
577 if (agp_fe.backend_acquired != TRUE)
580 if (!(test_bit(AGP_FF_IS_VALID, &priv->access_flags)))
583 agp_copy_info(agp_bridge, &kerninfo);
584 size = vma->vm_end - vma->vm_start;
585 current_size = kerninfo.aper_size;
586 current_size = current_size * 0x100000;
587 offset = vma->vm_pgoff << PAGE_SHIFT;
588 DBG("%lx:%lx", offset, offset+size);
590 if (test_bit(AGP_FF_IS_CLIENT, &priv->access_flags)) {
591 if ((size + offset) > current_size)
594 client = agp_find_client_by_pid(current->pid);
599 if (!agp_find_seg_in_client(client, offset, size, vma->vm_page_prot))
602 DBG("client vm_ops=%p", kerninfo.vm_ops);
603 if (kerninfo.vm_ops) {
604 vma->vm_ops = kerninfo.vm_ops;
605 } else if (io_remap_pfn_range(vma, vma->vm_start,
606 (kerninfo.aper_base + offset) >> PAGE_SHIFT,
607 size, vma->vm_page_prot)) {
610 mutex_unlock(&(agp_fe.agp_mutex));
614 if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
615 if (size != current_size)
618 DBG("controller vm_ops=%p", kerninfo.vm_ops);
619 if (kerninfo.vm_ops) {
620 vma->vm_ops = kerninfo.vm_ops;
621 } else if (io_remap_pfn_range(vma, vma->vm_start,
622 kerninfo.aper_base >> PAGE_SHIFT,
623 size, vma->vm_page_prot)) {
626 mutex_unlock(&(agp_fe.agp_mutex));
631 mutex_unlock(&(agp_fe.agp_mutex));
635 mutex_unlock(&(agp_fe.agp_mutex));
639 mutex_unlock(&(agp_fe.agp_mutex));
643 static int agp_release(struct inode *inode, struct file *file)
645 struct agp_file_private *priv = file->private_data;
647 mutex_lock(&(agp_fe.agp_mutex));
649 DBG("priv=%p", priv);
651 if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
652 struct agp_controller *controller;
654 controller = agp_find_controller_by_pid(priv->my_pid);
656 if (controller != NULL) {
657 if (controller == agp_fe.current_controller)
658 agp_controller_release_current(controller, priv);
659 agp_remove_controller(controller);
664 if (test_bit(AGP_FF_IS_CLIENT, &priv->access_flags))
665 agp_remove_client(priv->my_pid);
667 agp_remove_file_private(priv);
669 file->private_data = NULL;
670 mutex_unlock(&(agp_fe.agp_mutex));
674 static int agp_open(struct inode *inode, struct file *file)
676 int minor = iminor(inode);
677 struct agp_file_private *priv;
678 struct agp_client *client;
682 mutex_lock(&(agp_fe.agp_mutex));
684 if (minor != AGPGART_MINOR)
687 priv = kzalloc(sizeof(struct agp_file_private), GFP_KERNEL);
691 set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags);
692 priv->my_pid = current->pid;
694 if (capable(CAP_SYS_RAWIO)) {
695 /* Root priv, can be controller */
696 set_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags);
698 client = agp_find_client_by_pid(current->pid);
700 if (client != NULL) {
701 set_bit(AGP_FF_IS_CLIENT, &priv->access_flags);
702 set_bit(AGP_FF_IS_VALID, &priv->access_flags);
704 file->private_data = (void *) priv;
705 agp_insert_file_private(priv);
706 DBG("private=%p, client=%p", priv, client);
707 mutex_unlock(&(agp_fe.agp_mutex));
714 mutex_unlock(&(agp_fe.agp_mutex));
720 static ssize_t agp_read(struct file *file, char __user *buf,
721 size_t count, loff_t * ppos)
726 static ssize_t agp_write(struct file *file, const char __user *buf,
727 size_t count, loff_t * ppos)
732 static int agpioc_info_wrap(struct agp_file_private *priv, void __user *arg)
734 struct agp_info userinfo;
735 struct agp_kern_info kerninfo;
737 agp_copy_info(agp_bridge, &kerninfo);
739 userinfo.version.major = kerninfo.version.major;
740 userinfo.version.minor = kerninfo.version.minor;
741 userinfo.bridge_id = kerninfo.device->vendor |
742 (kerninfo.device->device << 16);
743 userinfo.agp_mode = kerninfo.mode;
744 userinfo.aper_base = kerninfo.aper_base;
745 userinfo.aper_size = kerninfo.aper_size;
746 userinfo.pg_total = userinfo.pg_system = kerninfo.max_memory;
747 userinfo.pg_used = kerninfo.current_memory;
749 if (copy_to_user(arg, &userinfo, sizeof(struct agp_info)))
755 int agpioc_acquire_wrap(struct agp_file_private *priv)
757 struct agp_controller *controller;
761 if (!(test_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags)))
764 if (agp_fe.current_controller != NULL)
770 if (atomic_read(&agp_bridge->agp_in_use))
773 atomic_inc(&agp_bridge->agp_in_use);
775 agp_fe.backend_acquired = TRUE;
777 controller = agp_find_controller_by_pid(priv->my_pid);
779 if (controller != NULL) {
780 agp_controller_make_current(controller);
782 controller = agp_create_controller(priv->my_pid);
784 if (controller == NULL) {
785 agp_fe.backend_acquired = FALSE;
786 agp_backend_release(agp_bridge);
789 agp_insert_controller(controller);
790 agp_controller_make_current(controller);
793 set_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags);
794 set_bit(AGP_FF_IS_VALID, &priv->access_flags);
798 int agpioc_release_wrap(struct agp_file_private *priv)
801 agp_controller_release_current(agp_fe.current_controller, priv);
805 int agpioc_setup_wrap(struct agp_file_private *priv, void __user *arg)
807 struct agp_setup mode;
810 if (copy_from_user(&mode, arg, sizeof(struct agp_setup)))
813 agp_enable(agp_bridge, mode.agp_mode);
817 static int agpioc_reserve_wrap(struct agp_file_private *priv, void __user *arg)
819 struct agp_region reserve;
820 struct agp_client *client;
821 struct agp_file_private *client_priv;
824 if (copy_from_user(&reserve, arg, sizeof(struct agp_region)))
827 if ((unsigned) reserve.seg_count >= ~0U/sizeof(struct agp_segment))
830 client = agp_find_client_by_pid(reserve.pid);
832 if (reserve.seg_count == 0) {
833 /* remove a client */
834 client_priv = agp_find_private(reserve.pid);
836 if (client_priv != NULL) {
837 set_bit(AGP_FF_IS_CLIENT, &client_priv->access_flags);
838 set_bit(AGP_FF_IS_VALID, &client_priv->access_flags);
840 if (client == NULL) {
841 /* client is already removed */
844 return agp_remove_client(reserve.pid);
846 struct agp_segment *segment;
848 if (reserve.seg_count >= 16384)
851 segment = kmalloc((sizeof(struct agp_segment) * reserve.seg_count),
857 if (copy_from_user(segment, (void __user *) reserve.seg_list,
858 sizeof(struct agp_segment) * reserve.seg_count)) {
862 reserve.seg_list = segment;
864 if (client == NULL) {
865 /* Create the client and add the segment */
866 client = agp_create_client(reserve.pid);
868 if (client == NULL) {
872 client_priv = agp_find_private(reserve.pid);
874 if (client_priv != NULL) {
875 set_bit(AGP_FF_IS_CLIENT, &client_priv->access_flags);
876 set_bit(AGP_FF_IS_VALID, &client_priv->access_flags);
879 return agp_create_segment(client, &reserve);
881 /* Will never really happen */
885 int agpioc_protect_wrap(struct agp_file_private *priv)
888 /* This function is not currently implemented */
892 static int agpioc_allocate_wrap(struct agp_file_private *priv, void __user *arg)
894 struct agp_memory *memory;
895 struct agp_allocate alloc;
898 if (copy_from_user(&alloc, arg, sizeof(struct agp_allocate)))
901 if (alloc.type >= AGP_USER_TYPES)
904 memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type);
909 alloc.key = memory->key;
910 alloc.physical = memory->physical;
912 if (copy_to_user(arg, &alloc, sizeof(struct agp_allocate))) {
913 agp_free_memory_wrap(memory);
919 int agpioc_deallocate_wrap(struct agp_file_private *priv, int arg)
921 struct agp_memory *memory;
924 memory = agp_find_mem_by_key(arg);
929 agp_free_memory_wrap(memory);
933 static int agpioc_bind_wrap(struct agp_file_private *priv, void __user *arg)
935 struct agp_bind bind_info;
936 struct agp_memory *memory;
939 if (copy_from_user(&bind_info, arg, sizeof(struct agp_bind)))
942 memory = agp_find_mem_by_key(bind_info.key);
947 return agp_bind_memory(memory, bind_info.pg_start);
950 static int agpioc_unbind_wrap(struct agp_file_private *priv, void __user *arg)
952 struct agp_memory *memory;
953 struct agp_unbind unbind;
956 if (copy_from_user(&unbind, arg, sizeof(struct agp_unbind)))
959 memory = agp_find_mem_by_key(unbind.key);
964 return agp_unbind_memory(memory);
967 int agpioc_chipset_flush_wrap(struct agp_file_private *priv)
970 agp_flush_chipset(agp_bridge);
974 static long agp_ioctl(struct file *file,
975 unsigned int cmd, unsigned long arg)
977 struct agp_file_private *curr_priv = file->private_data;
978 int ret_val = -ENOTTY;
980 DBG("priv=%p, cmd=%x", curr_priv, cmd);
981 mutex_lock(&(agp_fe.agp_mutex));
983 if ((agp_fe.current_controller == NULL) &&
984 (cmd != AGPIOC_ACQUIRE)) {
988 if ((agp_fe.backend_acquired != TRUE) &&
989 (cmd != AGPIOC_ACQUIRE)) {
993 if (cmd != AGPIOC_ACQUIRE) {
994 if (!(test_bit(AGP_FF_IS_CONTROLLER, &curr_priv->access_flags))) {
998 /* Use the original pid of the controller,
999 * in case it's threaded */
1001 if (agp_fe.current_controller->pid != curr_priv->my_pid) {
1009 ret_val = agpioc_info_wrap(curr_priv, (void __user *) arg);
1012 case AGPIOC_ACQUIRE:
1013 ret_val = agpioc_acquire_wrap(curr_priv);
1016 case AGPIOC_RELEASE:
1017 ret_val = agpioc_release_wrap(curr_priv);
1021 ret_val = agpioc_setup_wrap(curr_priv, (void __user *) arg);
1024 case AGPIOC_RESERVE:
1025 ret_val = agpioc_reserve_wrap(curr_priv, (void __user *) arg);
1028 case AGPIOC_PROTECT:
1029 ret_val = agpioc_protect_wrap(curr_priv);
1032 case AGPIOC_ALLOCATE:
1033 ret_val = agpioc_allocate_wrap(curr_priv, (void __user *) arg);
1036 case AGPIOC_DEALLOCATE:
1037 ret_val = agpioc_deallocate_wrap(curr_priv, (int) arg);
1041 ret_val = agpioc_bind_wrap(curr_priv, (void __user *) arg);
1045 ret_val = agpioc_unbind_wrap(curr_priv, (void __user *) arg);
1048 case AGPIOC_CHIPSET_FLUSH:
1049 ret_val = agpioc_chipset_flush_wrap(curr_priv);
1054 DBG("ioctl returns %d\n", ret_val);
1055 mutex_unlock(&(agp_fe.agp_mutex));
1059 static const struct file_operations agp_fops =
1061 .owner = THIS_MODULE,
1062 .llseek = no_llseek,
1065 .unlocked_ioctl = agp_ioctl,
1066 #ifdef CONFIG_COMPAT
1067 .compat_ioctl = compat_agp_ioctl,
1071 .release = agp_release,
1074 static struct miscdevice agp_miscdev =
1076 .minor = AGPGART_MINOR,
1081 int agp_frontend_initialize(void)
1083 memset(&agp_fe, 0, sizeof(struct agp_front_data));
1084 mutex_init(&(agp_fe.agp_mutex));
1086 if (misc_register(&agp_miscdev)) {
1087 printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR);
1093 void agp_frontend_cleanup(void)
1095 misc_deregister(&agp_miscdev);