1/* 2 * AGPGART backend specific includes. Not for userspace consumption. 3 * 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. 8 * 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: 15 * 16 * The above copyright notice and this permission notice shall be included 17 * in all copies or substantial portions of the Software. 18 * 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. 26 * 27 */ 28 29#ifndef _AGP_BACKEND_H 30#define _AGP_BACKEND_H 1 31 32#ifdef __KERNEL__ 33 34#ifndef TRUE 35#define TRUE 1 36#endif 37 38#ifndef FALSE 39#define FALSE 0 40#endif 41 42enum chipset_type { 43 NOT_SUPPORTED, 44 SUPPORTED, 45}; 46 47struct agp_version { 48 u16 major; 49 u16 minor; 50}; 51 52struct agp_kern_info { 53 struct agp_version version; 54 struct pci_dev *device; 55 enum chipset_type chipset; 56 unsigned long mode; 57 off_t aper_base; 58 size_t aper_size; 59 int max_memory; /* In pages */ 60 int current_memory; 61 int cant_use_aperture; 62 unsigned long page_mask; 63 struct vm_operations_struct *vm_ops; 64}; 65 66/* 67 * The agp_memory structure has information about the block of agp memory 68 * allocated. A caller may manipulate the next and prev pointers to link 69 * each allocated item into a list. These pointers are ignored by the backend. 70 * Everything else should never be written to, but the caller may read any of 71 * the items to detrimine the status of this block of agp memory. 72 */ 73 74struct agp_memory { 75 int key; 76 struct agp_memory *next; 77 struct agp_memory *prev; 78 size_t page_count; 79 int num_scratch_pages; 80 unsigned long *memory; 81 off_t pg_start; 82 u32 type; 83 u32 physical; 84 u8 is_bound; 85 u8 is_flushed; 86}; 87 88#define AGP_NORMAL_MEMORY 0 89 90extern void agp_free_memory(struct agp_memory *); 91extern struct agp_memory *agp_allocate_memory(size_t, u32); 92extern int agp_copy_info(struct agp_kern_info *); 93extern int agp_bind_memory(struct agp_memory *, off_t); 94extern int agp_unbind_memory(struct agp_memory *); 95extern void agp_enable(u32); 96extern int agp_backend_acquire(void); 97extern void agp_backend_release(void); 98 99/* 100 * Interface between drm and agp code. When agp initializes, it makes 101 * the below structure available via inter_module_register(), drm might 102 * use it. Keith Owens <kaos@ocs.com.au> 28 Oct 2000. 103 */ 104typedef struct { 105 void (*free_memory)(struct agp_memory *); 106 struct agp_memory * (*allocate_memory)(size_t, u32); 107 int (*bind_memory)(struct agp_memory *, off_t); 108 int (*unbind_memory)(struct agp_memory *); 109 void (*enable)(u32); 110 int (*acquire)(void); 111 void (*release)(void); 112 int (*copy_info)(struct agp_kern_info *); 113} drm_agp_t; 114 115extern const drm_agp_t *drm_agp_p; 116 117#endif /* __KERNEL__ */ 118#endif /* _AGP_BACKEND_H */ 119

