diff options
Diffstat (limited to 'src/nv_local.h')
-rw-r--r-- | src/nv_local.h | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/src/nv_local.h b/src/nv_local.h index 50ec06a..f9a8668 100644 --- a/src/nv_local.h +++ b/src/nv_local.h @@ -1,6 +1,6 @@ /***************************************************************************\ |* *| -|* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *| +|* Copyright 1993-2003 NVIDIA, Corporation. All rights reserved. *| |* *| |* NOTICE TO USER: The source code is copyrighted under U.S. and *| |* international laws. Users and possessors of this source code are *| @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h,v 1.7 2002/01/25 21:56:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_local.h,v 1.9 2003/11/03 05:11:25 tsi Exp $ */ #ifndef __NV_LOCAL_H__ #define __NV_LOCAL_H__ @@ -60,15 +60,42 @@ typedef unsigned int U032; /* * HW access macros. These assume memory-mapped I/O, and not normal I/O space. */ -#define NV_WR08(p,i,d) MMIO_OUT8((volatile pointer)(p), (i), (d)) -#define NV_RD08(p,i) MMIO_IN8((volatile pointer)(p), (i)) -#define NV_WR16(p,i,d) MMIO_OUT16((volatile pointer)(p), (i), (d)) -#define NV_RD16(p,i) MMIO_IN16((volatile pointer)(p), (i)) -#define NV_WR32(p,i,d) MMIO_OUT32((volatile pointer)(p), (i), (d)) -#define NV_RD32(p,i) MMIO_IN32((volatile pointer)(p), (i)) +#define NV_WR08(p,i,d) MMIO_OUT8((pointer)(p), (i), (d)) +#define NV_RD08(p,i) MMIO_IN8((pointer)(p), (i)) +#define NV_WR16(p,i,d) MMIO_OUT16((pointer)(p), (i), (d)) +#define NV_RD16(p,i) MMIO_IN16((pointer)(p), (i)) +#define NV_WR32(p,i,d) MMIO_OUT32((pointer)(p), (i), (d)) +#define NV_RD32(p,i) MMIO_IN32((pointer)(p), (i)) /* VGA I/O is now always done through MMIO */ #define VGA_WR08(p,i,d) NV_WR08(p,i,d) #define VGA_RD08(p,i) NV_RD08(p,i) +#define NVDmaNext(pNv, data) \ + (pNv)->dmaBase[(pNv)->dmaCurrent++] = (data) + +#define NVDmaStart(pNv, tag, size) { \ + if((pNv)->dmaFree <= (size)) \ + NVDmaWait(pNv, size); \ + NVDmaNext(pNv, ((size) << 18) | (tag)); \ + (pNv)->dmaFree -= ((size) + 1); \ +} + +#if defined(__i386__) +#define _NV_FENCE() outb(0x3D0, 0); +#else +#define _NV_FENCE() mem_barrier(); +#endif + +#define WRITE_PUT(pNv, data) { \ + volatile CARD8 scratch; \ + _NV_FENCE() \ + scratch = (pNv)->FbStart[0]; \ + (pNv)->FIFO[0x0010] = (data) << 2; \ + mem_barrier(); \ +} + +#define READ_GET(pNv) ((pNv)->FIFO[0x0011] >> 2) + + #endif /* __NV_LOCAL_H__ */ |