| [2] | 1 | /* |
|---|
| 2 | * AGPGART module version 0.99 |
|---|
| 3 | * Copyright (C) 1999 Jeff Hartmann |
|---|
| 4 | * Copyright (C) 1999 Precision Insight, Inc. |
|---|
| 5 | * Copyright (C) 1999 Xi Graphics, Inc. |
|---|
| 6 | * |
|---|
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
|---|
| 8 | * copy of this software and associated documentation files (the "Software"), |
|---|
| 9 | * to deal in the Software without restriction, including without limitation |
|---|
| 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|---|
| 11 | * and/or sell copies of the Software, and to permit persons to whom the |
|---|
| 12 | * Software is furnished to do so, subject to the following conditions: |
|---|
| 13 | * |
|---|
| 14 | * The above copyright notice and this permission notice shall be included |
|---|
| 15 | * in all copies or substantial portions of the Software. |
|---|
| 16 | * |
|---|
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|---|
| 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|---|
| 20 | * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, |
|---|
| 21 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|---|
| 22 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE |
|---|
| 23 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|---|
| 24 | * |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | #ifndef _AGP_H |
|---|
| 28 | #define _AGP_H 1 |
|---|
| 29 | |
|---|
| 30 | #define AGPIOC_BASE 'A' |
|---|
| 31 | #define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*) |
|---|
| 32 | #define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1) |
|---|
| 33 | #define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2) |
|---|
| 34 | #define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*) |
|---|
| 35 | #define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*) |
|---|
| 36 | #define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*) |
|---|
| 37 | #define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*) |
|---|
| 38 | #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) |
|---|
| 39 | #define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*) |
|---|
| 40 | #define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*) |
|---|
| 41 | |
|---|
| 42 | #define AGP_DEVICE "/dev/agpgart" |
|---|
| 43 | |
|---|
| 44 | #ifndef TRUE |
|---|
| 45 | #define TRUE 1 |
|---|
| 46 | #endif |
|---|
| 47 | |
|---|
| 48 | #ifndef FALSE |
|---|
| 49 | #define FALSE 0 |
|---|
| 50 | #endif |
|---|
| 51 | |
|---|
| 52 | #include <linux/types.h> |
|---|
| 53 | |
|---|
| 54 | struct agp_version { |
|---|
| 55 | __u16 major; |
|---|
| 56 | __u16 minor; |
|---|
| 57 | }; |
|---|
| 58 | |
|---|
| 59 | typedef struct _agp_info { |
|---|
| 60 | struct agp_version version; /* version of the driver */ |
|---|
| 61 | __u32 bridge_id; /* bridge vendor/device */ |
|---|
| 62 | __u32 agp_mode; /* mode info of bridge */ |
|---|
| 63 | unsigned long aper_base;/* base of aperture */ |
|---|
| 64 | size_t aper_size; /* size of aperture */ |
|---|
| 65 | size_t pg_total; /* max pages (swap + system) */ |
|---|
| 66 | size_t pg_system; /* max pages (system) */ |
|---|
| 67 | size_t pg_used; /* current pages used */ |
|---|
| 68 | } agp_info; |
|---|
| 69 | |
|---|
| 70 | typedef struct _agp_setup { |
|---|
| 71 | __u32 agp_mode; /* mode info of bridge */ |
|---|
| 72 | } agp_setup; |
|---|
| 73 | |
|---|
| 74 | /* |
|---|
| 75 | * The "prot" down below needs still a "sleep" flag somehow ... |
|---|
| 76 | */ |
|---|
| 77 | typedef struct _agp_segment { |
|---|
| 78 | off_t pg_start; /* starting page to populate */ |
|---|
| 79 | size_t pg_count; /* number of pages */ |
|---|
| 80 | int prot; /* prot flags for mmap */ |
|---|
| 81 | } agp_segment; |
|---|
| 82 | |
|---|
| 83 | typedef struct _agp_region { |
|---|
| 84 | pid_t pid; /* pid of process */ |
|---|
| 85 | size_t seg_count; /* number of segments */ |
|---|
| 86 | struct _agp_segment *seg_list; |
|---|
| 87 | } agp_region; |
|---|
| 88 | |
|---|
| 89 | typedef struct _agp_allocate { |
|---|
| 90 | int key; /* tag of allocation */ |
|---|
| 91 | size_t pg_count; /* number of pages */ |
|---|
| 92 | __u32 type; /* 0 == normal, other devspec */ |
|---|
| 93 | __u32 physical; /* device specific (some devices |
|---|
| 94 | * need a phys address of the |
|---|
| 95 | * actual page behind the gatt |
|---|
| 96 | * table) */ |
|---|
| 97 | } agp_allocate; |
|---|
| 98 | |
|---|
| 99 | typedef struct _agp_bind { |
|---|
| 100 | int key; /* tag of allocation */ |
|---|
| 101 | off_t pg_start; /* starting page to populate */ |
|---|
| 102 | } agp_bind; |
|---|
| 103 | |
|---|
| 104 | typedef struct _agp_unbind { |
|---|
| 105 | int key; /* tag of allocation */ |
|---|
| 106 | __u32 priority; /* priority for paging out */ |
|---|
| 107 | } agp_unbind; |
|---|
| 108 | |
|---|
| 109 | #endif /* _AGP_H */ |
|---|