Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* gamma_drv.h -- Private header for 3dlabs GMX 2000 driver -*- linux-c -*- |
| 2 | * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com |
| 3 | * |
| 4 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
| 5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 9 | * copy of this software and associated documentation files (the "Software"), |
| 10 | * to deal in the Software without restriction, including without limitation |
| 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 12 | * and/or sell copies of the Software, and to permit persons to whom the |
| 13 | * Software is furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice (including the next |
| 16 | * paragraph) shall be included in all copies or substantial portions of the |
| 17 | * Software. |
| 18 | * |
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 22 | * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 23 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 24 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 25 | * DEALINGS IN THE SOFTWARE. |
| 26 | * |
| 27 | * Authors: |
| 28 | * Rickard E. (Rik) Faith <faith@valinux.com> |
| 29 | * |
| 30 | */ |
| 31 | |
| 32 | #ifndef _GAMMA_DRV_H_ |
| 33 | #define _GAMMA_DRV_H_ |
| 34 | |
| 35 | typedef struct drm_gamma_private { |
| 36 | drm_gamma_sarea_t *sarea_priv; |
| 37 | drm_map_t *sarea; |
| 38 | drm_map_t *mmio0; |
| 39 | drm_map_t *mmio1; |
| 40 | drm_map_t *mmio2; |
| 41 | drm_map_t *mmio3; |
| 42 | int num_rast; |
| 43 | } drm_gamma_private_t; |
| 44 | |
| 45 | /* gamma_dma.c */ |
| 46 | extern int gamma_dma_init( struct inode *inode, struct file *filp, |
| 47 | unsigned int cmd, unsigned long arg ); |
| 48 | extern int gamma_dma_copy( struct inode *inode, struct file *filp, |
| 49 | unsigned int cmd, unsigned long arg ); |
| 50 | |
| 51 | extern int gamma_do_cleanup_dma( drm_device_t *dev ); |
| 52 | extern void gamma_dma_ready(drm_device_t *dev); |
| 53 | extern void gamma_dma_quiescent_single(drm_device_t *dev); |
| 54 | extern void gamma_dma_quiescent_dual(drm_device_t *dev); |
| 55 | |
| 56 | /* gamma_dma.c */ |
| 57 | extern int gamma_dma_schedule(drm_device_t *dev, int locked); |
| 58 | extern int gamma_dma(struct inode *inode, struct file *filp, |
| 59 | unsigned int cmd, unsigned long arg); |
| 60 | extern int gamma_find_devices(void); |
| 61 | extern int gamma_found(void); |
| 62 | |
| 63 | /* Gamma-specific code pulled from drm_fops.h: |
| 64 | */ |
| 65 | extern int DRM(finish)(struct inode *inode, struct file *filp, |
| 66 | unsigned int cmd, unsigned long arg); |
| 67 | extern int DRM(flush_unblock)(drm_device_t *dev, int context, |
| 68 | drm_lock_flags_t flags); |
| 69 | extern int DRM(flush_block_and_flush)(drm_device_t *dev, int context, |
| 70 | drm_lock_flags_t flags); |
| 71 | |
| 72 | /* Gamma-specific code pulled from drm_dma.h: |
| 73 | */ |
| 74 | extern void DRM(clear_next_buffer)(drm_device_t *dev); |
| 75 | extern int DRM(select_queue)(drm_device_t *dev, |
| 76 | void (*wrapper)(unsigned long)); |
| 77 | extern int DRM(dma_enqueue)(struct file *filp, drm_dma_t *dma); |
| 78 | extern int DRM(dma_get_buffers)(struct file *filp, drm_dma_t *dma); |
| 79 | |
| 80 | |
| 81 | /* Gamma-specific code pulled from drm_lists.h (now renamed gamma_lists.h): |
| 82 | */ |
| 83 | extern int DRM(waitlist_create)(drm_waitlist_t *bl, int count); |
| 84 | extern int DRM(waitlist_destroy)(drm_waitlist_t *bl); |
| 85 | extern int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf); |
| 86 | extern drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl); |
| 87 | extern int DRM(freelist_create)(drm_freelist_t *bl, int count); |
| 88 | extern int DRM(freelist_destroy)(drm_freelist_t *bl); |
| 89 | extern int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, |
| 90 | drm_buf_t *buf); |
| 91 | extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block); |
| 92 | |
| 93 | /* externs for gamma changes to the ops */ |
| 94 | extern struct file_operations DRM(fops); |
| 95 | extern unsigned int gamma_fops_poll(struct file *filp, struct poll_table_struct *wait); |
| 96 | extern ssize_t gamma_fops_read(struct file *filp, char __user *buf, size_t count, loff_t *off); |
| 97 | |
| 98 | |
| 99 | #define GLINT_DRI_BUF_COUNT 256 |
| 100 | |
| 101 | #define GAMMA_OFF(reg) \ |
| 102 | ((reg < 0x1000) \ |
| 103 | ? reg \ |
| 104 | : ((reg < 0x10000) \ |
| 105 | ? (reg - 0x1000) \ |
| 106 | : ((reg < 0x11000) \ |
| 107 | ? (reg - 0x10000) \ |
| 108 | : (reg - 0x11000)))) |
| 109 | |
| 110 | #define GAMMA_BASE(reg) ((unsigned long) \ |
| 111 | ((reg < 0x1000) ? dev_priv->mmio0->handle : \ |
| 112 | ((reg < 0x10000) ? dev_priv->mmio1->handle : \ |
| 113 | ((reg < 0x11000) ? dev_priv->mmio2->handle : \ |
| 114 | dev_priv->mmio3->handle)))) |
| 115 | #define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg)) |
| 116 | #define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg) |
| 117 | #define GAMMA_READ(reg) GAMMA_DEREF(reg) |
| 118 | #define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0) |
| 119 | |
| 120 | #define GAMMA_BROADCASTMASK 0x9378 |
| 121 | #define GAMMA_COMMANDINTENABLE 0x0c48 |
| 122 | #define GAMMA_DMAADDRESS 0x0028 |
| 123 | #define GAMMA_DMACOUNT 0x0030 |
| 124 | #define GAMMA_FILTERMODE 0x8c00 |
| 125 | #define GAMMA_GCOMMANDINTFLAGS 0x0c50 |
| 126 | #define GAMMA_GCOMMANDMODE 0x0c40 |
| 127 | #define GAMMA_QUEUED_DMA_MODE 1<<1 |
| 128 | #define GAMMA_GCOMMANDSTATUS 0x0c60 |
| 129 | #define GAMMA_GDELAYTIMER 0x0c38 |
| 130 | #define GAMMA_GDMACONTROL 0x0060 |
| 131 | #define GAMMA_USE_AGP 1<<1 |
| 132 | #define GAMMA_GINTENABLE 0x0808 |
| 133 | #define GAMMA_GINTFLAGS 0x0810 |
| 134 | #define GAMMA_INFIFOSPACE 0x0018 |
| 135 | #define GAMMA_OUTFIFOWORDS 0x0020 |
| 136 | #define GAMMA_OUTPUTFIFO 0x2000 |
| 137 | #define GAMMA_SYNC 0x8c40 |
| 138 | #define GAMMA_SYNC_TAG 0x0188 |
| 139 | #define GAMMA_PAGETABLEADDR 0x0C00 |
| 140 | #define GAMMA_PAGETABLELENGTH 0x0C08 |
| 141 | |
| 142 | #define GAMMA_PASSTHROUGH 0x1FE |
| 143 | #define GAMMA_DMAADDRTAG 0x530 |
| 144 | #define GAMMA_DMACOUNTTAG 0x531 |
| 145 | #define GAMMA_COMMANDINTTAG 0x532 |
| 146 | |
| 147 | #endif |