summaryrefslogtreecommitdiff
path: root/src/regsmi.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/regsmi.h')
-rw-r--r--src/regsmi.h178
1 files changed, 80 insertions, 98 deletions
diff --git a/src/regsmi.h b/src/regsmi.h
index 6640ec0..c325571 100644
--- a/src/regsmi.h
+++ b/src/regsmi.h
@@ -52,63 +52,51 @@ authorization from the XFree86 Project and SIlicon Motion.
static __inline__ CARD8
VGAIN8_INDEX(SMIPtr pSmi, int indexPort, int dataPort, CARD8 index)
{
- if (pSmi->IOBase)
- {
- MMIO_OUT8(pSmi->IOBase, indexPort, index);
- return(MMIO_IN8(pSmi->IOBase, dataPort));
- }
- else
- {
- outb(pSmi->PIOBase + indexPort, index);
- return(inb(pSmi->PIOBase + dataPort));
- }
+ if (pSmi->IOBase) {
+ MMIO_OUT8(pSmi->IOBase, indexPort, index);
+ return(MMIO_IN8(pSmi->IOBase, dataPort));
+ } else {
+ outb(pSmi->PIOBase + indexPort, index);
+ return(inb(pSmi->PIOBase + dataPort));
+ }
}
static __inline__ void
VGAOUT8_INDEX(SMIPtr pSmi, int indexPort, int dataPort, CARD8 index, CARD8 data)
{
- if (pSmi->IOBase)
- {
- MMIO_OUT8(pSmi->IOBase, indexPort, index);
- MMIO_OUT8(pSmi->IOBase, dataPort, data);
- }
- else
- {
- outb(pSmi->PIOBase + indexPort, index);
- outb(pSmi->PIOBase + dataPort, data);
- }
+ if (pSmi->IOBase) {
+ MMIO_OUT8(pSmi->IOBase, indexPort, index);
+ MMIO_OUT8(pSmi->IOBase, dataPort, data);
+ } else {
+ outb(pSmi->PIOBase + indexPort, index);
+ outb(pSmi->PIOBase + dataPort, data);
+ }
}
static __inline__ CARD8
VGAIN8(SMIPtr pSmi, int port)
{
- if (pSmi->IOBase)
- {
- return(MMIO_IN8(pSmi->IOBase, port));
- }
- else
- {
- return(inb(pSmi->PIOBase + port));
- }
+ if (pSmi->IOBase) {
+ return(MMIO_IN8(pSmi->IOBase, port));
+ } else {
+ return(inb(pSmi->PIOBase + port));
+ }
}
static __inline__ void
VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
{
- if (pSmi->IOBase)
- {
- MMIO_OUT8(pSmi->IOBase, port, data);
- }
- else
- {
- outb(pSmi->PIOBase + port, data);
- }
+ if (pSmi->IOBase) {
+ MMIO_OUT8(pSmi->IOBase, port, data);
+ } else {
+ outb(pSmi->PIOBase + port, data);
+ }
}
#define OUT_SEQ(pSmi, index, data) \
- VGAOUT8_INDEX((pSmi), VGA_SEQ_INDEX, VGA_SEQ_DATA, (index), (data))
+ VGAOUT8_INDEX((pSmi), VGA_SEQ_INDEX, VGA_SEQ_DATA, (index), (data))
#define IN_SEQ(pSmi, index) \
- VGAIN8_INDEX((pSmi), VGA_SEQ_INDEX, VGA_SEQ_DATA, (index))
+ VGAIN8_INDEX((pSmi), VGA_SEQ_INDEX, VGA_SEQ_DATA, (index))
#define WRITE_DPR(pSmi, dpr, data) MMIO_OUT32(pSmi->DPRBase, dpr, data); DEBUG((VERBLEV, "DPR%02X = %08X\n", dpr, data))
#define READ_DPR(pSmi, dpr) MMIO_IN32(pSmi->DPRBase, dpr)
@@ -120,88 +108,82 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
#define READ_FPR(pSmi, fpr) MMIO_IN32(pSmi->FPRBase, fpr)
/* 2D Engine commands */
-#define SMI_TRANSPARENT_SRC 0x00000100
+#define SMI_TRANSPARENT_SRC 0x00000100
#define SMI_TRANSPARENT_DEST 0x00000300
-#define SMI_OPAQUE_PXL 0x00000000
-#define SMI_TRANSPARENT_PXL 0x00000400
+#define SMI_OPAQUE_PXL 0x00000000
+#define SMI_TRANSPARENT_PXL 0x00000400
-#define SMI_MONO_PACK_8 0x00001000
-#define SMI_MONO_PACK_16 0x00002000
-#define SMI_MONO_PACK_32 0x00003000
+#define SMI_MONO_PACK_8 0x00001000
+#define SMI_MONO_PACK_16 0x00002000
+#define SMI_MONO_PACK_32 0x00003000
-#define SMI_ROP2_SRC 0x00008000
-#define SMI_ROP2_PAT 0x0000C000
-#define SMI_ROP3 0x00000000
+#define SMI_ROP2_SRC 0x00008000
+#define SMI_ROP2_PAT 0x0000C000
+#define SMI_ROP3 0x00000000
-#define SMI_BITBLT 0x00000000
-#define SMI_RECT_FILL 0x00010000
-#define SMI_TRAPEZOID_FILL 0x00030000
+#define SMI_BITBLT 0x00000000
+#define SMI_RECT_FILL 0x00010000
+#define SMI_TRAPEZOID_FILL 0x00030000
#define SMI_SHORT_STROKE 0x00060000
-#define SMI_BRESENHAM_LINE 0x00070000
-#define SMI_HOSTBLT_WRITE 0x00080000
-#define SMI_HOSTBLT_READ 0x00090000
-#define SMI_ROTATE_BLT 0x000B0000
+#define SMI_BRESENHAM_LINE 0x00070000
+#define SMI_HOSTBLT_WRITE 0x00080000
+#define SMI_HOSTBLT_READ 0x00090000
+#define SMI_ROTATE_BLT 0x000B0000
-#define SMI_SRC_COLOR 0x00000000
-#define SMI_SRC_MONOCHROME 0x00400000
+#define SMI_SRC_COLOR 0x00000000
+#define SMI_SRC_MONOCHROME 0x00400000
#define SMI_GRAPHICS_STRETCH 0x00800000
-#define SMI_ROTATE_CW 0x01000000
-#define SMI_ROTATE_CCW 0x02000000
+#define SMI_ROTATE_CW 0x01000000
+#define SMI_ROTATE_CCW 0x02000000
-#define SMI_MAJOR_X 0x00000000
-#define SMI_MAJOR_Y 0x04000000
+#define SMI_MAJOR_X 0x00000000
+#define SMI_MAJOR_Y 0x04000000
-#define SMI_LEFT_TO_RIGHT 0x00000000
-#define SMI_RIGHT_TO_LEFT 0x08000000
+#define SMI_LEFT_TO_RIGHT 0x00000000
+#define SMI_RIGHT_TO_LEFT 0x08000000
-#define SMI_COLOR_PATTERN 0x40000000
-#define SMI_MONO_PATTERN 0x00000000
+#define SMI_COLOR_PATTERN 0x40000000
+#define SMI_MONO_PATTERN 0x00000000
-#define SMI_QUICK_START 0x10000000
-#define SMI_START_ENGINE 0x80000000
+#define SMI_QUICK_START 0x10000000
+#define SMI_START_ENGINE 0x80000000
#define MAXLOOP 0x100000 /* timeout value for engine waits */
-#define ENGINE_IDLE() \
- ((VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) & 0x08) == 0)
-#define FIFO_EMPTY() \
- ((VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) & 0x10) != 0)
+#define ENGINE_IDLE() \
+ ((VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) & 0x08) == 0)
+#define FIFO_EMPTY() \
+ ((VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) & 0x10) != 0)
/* Wait until "v" queue entries are free */
-#define WaitQueue(v) \
- do \
- { \
- if (pSmi->NoPCIRetry) \
- { \
- int loop = MAXLOOP; mem_barrier(); \
- while (!FIFO_EMPTY()) \
- if (loop-- == 0) break; \
- if (loop <= 0) SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
- } \
- } while (0)
+#define WaitQueue(v) \
+ do { \
+ if (pSmi->NoPCIRetry) { \
+ int loop = MAXLOOP; mem_barrier(); \
+ while (!FIFO_EMPTY()) \
+ if (loop-- == 0) break; \
+ if (loop <= 0) SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
+ } \
+ } while (0)
/* Wait until GP is idle */
-#define WaitIdle() \
- do \
- { \
- int loop = MAXLOOP; mem_barrier(); \
- while (!ENGINE_IDLE()) \
- if (loop-- == 0) break; \
- if (loop <= 0) SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
- } \
- while (0)
+#define WaitIdle() \
+ do { \
+ int loop = MAXLOOP; mem_barrier(); \
+ while (!ENGINE_IDLE()) \
+ if (loop-- == 0) break; \
+ if (loop <= 0) SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
+ } while (0)
/* Wait until GP is idle and queue is empty */
-#define WaitIdleEmpty() \
- do \
- { \
- WaitQueue(MAXFIFO); \
- WaitIdle(); \
- } \
- while (0)
+#define WaitIdleEmpty() \
+ do { \
+ WaitQueue(MAXFIFO); \
+ WaitIdle(); \
+ } while (0)
#define RGB8_PSEUDO (-1)
#define RGB16_565 0
@@ -210,7 +192,7 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
/* register defines so we're not hardcoding numbers */
-#define FPR00 0x0000
+#define FPR00 0x0000
/* video window formats - I=indexed, P=packed */
#define FPR00_FMT_8I 0x0