Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * AGPGART backend specific includes. Not for userspace consumption.
0003  *
0004  * Copyright (C) 2004 Silicon Graphics, Inc.
0005  * Copyright (C) 2002-2003 Dave Jones
0006  * Copyright (C) 1999 Jeff Hartmann
0007  * Copyright (C) 1999 Precision Insight, Inc.
0008  * Copyright (C) 1999 Xi Graphics, Inc.
0009  *
0010  * Permission is hereby granted, free of charge, to any person obtaining a
0011  * copy of this software and associated documentation files (the "Software"),
0012  * to deal in the Software without restriction, including without limitation
0013  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0014  * and/or sell copies of the Software, and to permit persons to whom the
0015  * Software is furnished to do so, subject to the following conditions:
0016  *
0017  * The above copyright notice and this permission notice shall be included
0018  * in all copies or substantial portions of the Software.
0019  *
0020  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0021  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0022  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0023  * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 
0024  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
0025  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
0026  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0027  *
0028  */
0029 
0030 #ifndef _AGP_BACKEND_H
0031 #define _AGP_BACKEND_H 1
0032 
0033 #include <linux/list.h>
0034 
0035 enum chipset_type {
0036     NOT_SUPPORTED,
0037     SUPPORTED,
0038 };
0039 
0040 struct agp_version {
0041     u16 major;
0042     u16 minor;
0043 };
0044 
0045 struct agp_kern_info {
0046     struct agp_version version;
0047     struct pci_dev *device;
0048     enum chipset_type chipset;
0049     unsigned long mode;
0050     unsigned long aper_base;
0051     size_t aper_size;
0052     int max_memory;     /* In pages */
0053     int current_memory;
0054     bool cant_use_aperture;
0055     unsigned long page_mask;
0056     const struct vm_operations_struct *vm_ops;
0057 };
0058 
0059 /*
0060  * The agp_memory structure has information about the block of agp memory
0061  * allocated.  A caller may manipulate the next and prev pointers to link
0062  * each allocated item into a list.  These pointers are ignored by the backend.
0063  * Everything else should never be written to, but the caller may read any of
0064  * the items to determine the status of this block of agp memory.
0065  */
0066 
0067 struct agp_bridge_data;
0068 
0069 struct agp_memory {
0070     struct agp_memory *next;
0071     struct agp_memory *prev;
0072     struct agp_bridge_data *bridge;
0073     struct page **pages;
0074     size_t page_count;
0075     int key;
0076     int num_scratch_pages;
0077     off_t pg_start;
0078     u32 type;
0079     u32 physical;
0080     bool is_bound;
0081     bool is_flushed;
0082     /* list of agp_memory mapped to the aperture */
0083     struct list_head mapped_list;
0084     /* DMA-mapped addresses */
0085     struct scatterlist *sg_list;
0086     int num_sg;
0087 };
0088 
0089 #define AGP_NORMAL_MEMORY 0
0090 
0091 #define AGP_USER_TYPES (1 << 16)
0092 #define AGP_USER_MEMORY (AGP_USER_TYPES)
0093 #define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
0094 
0095 extern struct agp_bridge_data *agp_bridge;
0096 extern struct list_head agp_bridges;
0097 
0098 extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *);
0099 
0100 extern void agp_free_memory(struct agp_memory *);
0101 extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);
0102 extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
0103 extern int agp_bind_memory(struct agp_memory *, off_t);
0104 extern int agp_unbind_memory(struct agp_memory *);
0105 extern void agp_enable(struct agp_bridge_data *, u32);
0106 extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
0107 extern void agp_backend_release(struct agp_bridge_data *);
0108 
0109 #endif              /* _AGP_BACKEND_H */