2
* Id: mach64.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
4
* Copyright � 2001 Keith Packard
6
* Permission to use, copy, modify, distribute, and sell this software and its
7
* documentation for any purpose is hereby granted without fee, provided that
8
* the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of Keith Packard not be used in
11
* advertising or publicity pertaining to distribution of the software without
12
* specific, written prior permission. Keith Packard makes no
13
* representations about the suitability of this software for any purpose. It
14
* is provided "as is" without express or implied warranty.
16
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
24
/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.h,v 1.6 2001/07/24 19:06:03 keithp Exp $ */
32
* offset from ioport beginning
35
#define MACH64_REG_BASE(c) ((c)->attr.address[1])
36
#define MACH64_REG_SIZE(c) (4096)
38
#define MACH64_REG_OFF(c) (1024)
39
#define MACH64_MEDIA_REG_OFF(c) (0)
41
typedef volatile CARD8 VOL8;
42
typedef volatile CARD16 VOL16;
43
typedef volatile CARD32 VOL32;
46
VOL32 CRTC_H_TOTAL_DISP; /* 0x00 */
47
VOL32 CRTC_H_SYNC_STRT_WID; /* 0x01 */
48
VOL32 CRTC_V_TOTAL_DISP; /* 0x02 */
49
VOL32 CRTC_V_SYNC_STRT_WID; /* 0x03 */
50
VOL32 CRTC_VLINE_CRNT_VLINE; /* 0x04 */
51
VOL32 CRTC_OFF_PITCH; /* 0x05 */
52
VOL32 CRTC_INT_CNTL; /* 0x06 */
53
VOL32 CRTC_GEN_CNTL; /* 0x07 */
54
VOL32 DSP_CONFIG; /* 0x08 */
55
VOL32 DSP_ON_OFF; /* 0x09 */
56
VOL32 TIMER_CONFIG; /* 0x0a */
57
VOL32 MEM_BUF_CNTL; /* 0x0b */
58
VOL32 unused0; /* 0x0c */
59
VOL32 MEM_ADDR_CONFIG; /* 0x0d */
60
VOL32 CRT_TRAP; /* 0x0e */
61
VOL32 I2C_CNTL_0; /* 0x0f */
62
VOL32 OVR_CLR; /* 0x10 */
63
VOL32 OVR_WID_LEFT_RIGHT; /* 0x11 */
64
VOL32 OVR_WID_TOP_BOTTOM; /* 0x12 */
65
VOL32 VGA_DSP_CONFIG; /* 0x13 */
66
VOL32 VGA_DSP_ON_OFF; /* 0x14 */
67
VOL32 DSP2_CONFIG; /* 0x15 */
68
VOL32 DSP2_ON_OFF; /* 0x16 */
69
VOL32 CRTC2_OFF_PITCH; /* 0x17 */
70
VOL32 CUR_CLR0; /* 0x18 */
71
VOL32 CUR_CLR1; /* 0x19 */
72
VOL32 CUR_OFFSET; /* 0x1a */
73
VOL32 CUR_HORZ_VERT_POSN; /* 0x1b */
74
VOL32 CUR_HORZ_VERT_OFF; /* 0x1c */
75
VOL32 TV_OUT_INDEX; /* 0x1d */
76
VOL32 GP_IO; /* 0x1e */
77
VOL32 HW_DEBUG; /* 0x1f */
78
VOL32 SCRATCH_REG0; /* 0x20 */
86
VOL32 BUS_CNTL; /* 0x28 */
87
VOL32 LCD_INDEX; /* 0x29 */
88
VOL32 LCD_DATA; /* 0x2a */
94
VOL32 DAC_REGS; /* 0x30 */
95
VOL32 DAC_CNTL; /* 0x31 */
98
VOL32 GEN_TEST_CNTL; /* 0x34 */
99
VOL32 CUSTOM_MACRO_CNTL;
102
VOL32 CONFIG_CHIP_ID;
110
VOL32 DST_OFF_PITCH; /* 0x40 */
116
VOL32 DST_HEIGHT_WIDTH;
124
VOL32 TRAIL_BRES_ERR;
125
VOL32 TRAIL_BRES_INC;
126
VOL32 TRAIL_BRES_DEC;
127
VOL32 LEAD_BRES_LNTH;
130
VOL32 ALPHA_TST_CNTL;
132
VOL32 SECONDARY_STW_EXP;
133
VOL32 SECONDARY_S_X_INC;
134
VOL32 SECONDARY_S_Y_INC;
135
VOL32 SECONDARY_S_START;
136
VOL32 SECONDARY_W_X_INC;
137
VOL32 SECONDARY_W_Y_INC;
138
VOL32 SECONDARY_W_START;
139
VOL32 SECONDARY_T_X_INC;
140
VOL32 SECONDARY_T_Y_INC;
141
VOL32 SECONDARY_T_START;
148
VOL32 SRC_HEIGHT1_WIDTH1;
154
VOL32 SRC_HEIGHT2_WIDTH2;
160
VOL32 SCALE_OFF; /* 0x70 */
175
VOL32 SCALE_3D_CNTL; /* 0x7f */
178
VOL32 TEX_0_OFF; /* 0x70 */
191
VOL32 GREEN_X_INC; /* 0x7d */
196
VOL32 HOST_DATA[16]; /* 0x80 */
197
VOL32 HOST_CNTL; /* 0x90 */
198
VOL32 BM_HOSTDATA; /* 0x91 */
199
VOL32 BM_ADDR; /* 0x92 */
200
VOL32 BM_GUI_TABLE_CMD; /* 0x93 */
201
VOL32 unused94; /* 0x94 */
202
VOL32 unused95; /* 0x95 */
203
VOL32 unused96; /* 0x96 */
204
VOL32 FOG_TABLE_INDEX; /* 0x97 */
205
VOL32 FOG_TABLE_DATA[8]; /* 0x98 */
206
VOL32 PAT_REG0; /* 0xa0 */
220
VOL32 USR1_DST_OFF_PITCH;
221
VOL32 USR2_DST_OFF_PITCH;
222
VOL32 DP_BKGD_CLR; /* 0xb0 */
229
VOL32 DP_FRGD_CLR_MIX;
230
VOL32 DP_FRGD_BKGD_CLR;
233
VOL32 DST_WIDTH_HEIGHT;
236
VOL32 DP_SET_GUI_ENGINE2;
237
VOL32 DP_SET_GUI_ENGINE;
238
VOL32 CLR_CMP_CLR; /* 0xc0 */
254
VOL32 TEX_PALETTE_INDEX;
258
VOL32 S_Y_INC_2_SCALE_PITCH;
264
VOL32 T_Y_INC_SECONDARY_SCALE_PITCH;
266
VOL32 TEX_SIZE_PITCH;
268
VOL32 SECONDARY_TEX_OFFSET_SECONDARY_SCALE_OFF;
270
VOL32 SCALE_PITCH_BOTH; /* 0xe0 */
271
VOL32 SECONDARY_SCALE_OFF_ACC;
276
VOL32 COMPOSITE_SHADOW_ID;
277
VOL32 SECONDARY_SCALE_X_INC_SPECULAR_RED_X_INC;
278
VOL32 SPECULAR_RED_Y_INC;
279
VOL32 SPECULAR_RED_START_SECONDARY_SCALE_HACC;;
280
VOL32 SPECULAR_GREEN_X_INC;
281
VOL32 SPECULAR_GREEN_Y_INC;
282
VOL32 SPECULAR_GREEN_START;
283
VOL32 SPECULAR_BLUE_X_INC;
284
VOL32 SPECULAR_BLUE_Y_INC;
285
VOL32 SPECULAR_BLUE_START;
286
VOL32 RED_X_INC_SCALE_X_INC;
288
VOL32 RED_START_SCALE_HACC;
289
VOL32 GREEN_X_INC_SCALE_Y_INC;
290
VOL32 GREEN_Y_INC_SECONDARY_SCALE_Y_INC;
291
VOL32 GREEN_START_SECONDARY_SCALE_VACC;
307
#define DST_X_DIR (1 << 0)
308
#define DST_Y_DIR (1 << 1)
309
#define DST_Y_MAJOR (1 << 2)
310
#define DST_X_TILE (1 << 3)
311
#define DST_Y_TILE (1 << 4)
312
#define DST_LAST_PEL (1 << 5)
313
#define DST_POLYGON_EN (1 << 6)
314
#define DST_24_ROT_EN (1 << 7)
315
#define DST_24_ROT(n) ((n) << 8)
316
#define DST_BRES_ZERO (1 << 11)
317
#define DST_POLYGON_RTEDGE_DIS (1 << 12)
318
#define TRAIL_X_DIR (1 << 13)
319
#define TRAP_FILL_DIR (1 << 14)
320
#define TRAIL_BRES_SIGN (1 << 15)
321
#define SRC_PATT_EN (1 << 16)
322
#define SRC_PATT_ROT_EN (1 << 17)
323
#define SRC_LINEAR_EN (1 << 18)
324
#define SRC_BYTE_ALIGN (1 << 19)
325
#define SRC_LINE_X_DIR (1 << 20)
326
#define SRC_8x8x8_BRUSH (1 << 21)
327
#define FAST_FILL_EN (1 << 22)
328
#define SRC_TRACK_DST (1 << 23)
329
#define PAT_MONO_EN (1 << 24)
330
#define PAT_CLR_4x2_EN (1 << 25)
331
#define PAT_CLR_8x1_EN (1 << 26)
332
#define HOST_BYTE_ALIGN (1 << 28)
333
#define HOST_BIG_ENDIAN_EN (1 << 29)
336
#define BUS_DBL_RESYNC (1 << 0)
337
#define BUS_MSTR_RESET (1 << 1)
338
#define BUS_FLUSH_BUF (1 << 2)
339
#define BUS_STOP_REQ_DIS (1 << 3)
340
#define BUS_APER_REG_DIS (1 << 4)
341
#define BUS_EXTRA_PIPE_DIS (1 << 5)
342
#define BUS_MASTER_DIS (1 << 6)
343
#define ROM_WRT_EN (1 << 7)
344
#define CHIP_HIDDEN_REV (3 << 8)
345
#define BUS_PCI_READ_RETRY_EN (1 << 13)
346
#define BUS_PCI_WRT_RETRY_EN (1 << 15)
347
#define BUS_RETRY_WS (0xf << 16)
348
#define BUS_MSTR_RD_MULT (1 << 20)
349
#define BUS_MSTR_RD_LINE (1 << 21)
350
#define BUS_SUSPEND (1 << 22)
351
#define LAT16X (1 << 23)
352
#define BUS_RD_DISCARD_EN (1 << 24)
353
#define BUS_RD_ABORT_EN (1 << 25)
354
#define BUS_MSTR_WS (1 << 26)
355
#define BUS_EXT_REG_EN (1 << 27)
356
#define BUS_MSTR_DISCONNECT_EN (1 << 28)
357
#define BUS_WRT_BURST (1 << 29)
358
#define BUS_READ_BURST (1 << 30)
359
#define BUS_RDY_READ_DLY (1 << 31)
361
#define SCALE_PIX_EXPAND (1 << 0)
362
#define SCALE_Y2R_TEMP (1 << 1)
363
#define SCALE_HORZ_MODE (1 << 2)
364
#define SCALE_VERT_MODE (1 << 3)
365
#define SCALE_SIGNED_UV (1 << 4)
366
#define SCALE_GAMMA_SEL (3 << 5)
367
#define SCALE_GAMMA_BRIGHT (0 << 5)
368
#define SCALE_GAMMA_22 (1 << 5)
369
#define SCALE_GAMMA_18 (2 << 5)
370
#define SCALE_GAMMA_14 (3 << 5)
371
#define SCALE_DISP_SEL (1 << 7)
372
#define SCALE_BANDWIDTH (1 << 26)
373
#define SCALE_DIS_LIMIT (1 << 27)
374
#define SCALE_CLK_FORCE_ON (1 << 29)
375
#define SCALE_OVERLAY_EN (1 << 30)
376
#define SCALE_EN (1 << 31)
378
#define VIDEO_IN_VYUY422 (0xb)
379
#define VIDEO_IN_YVYU422 (0xc)
380
#define SCALER_IN_15bpp (0x3 << 16)
381
#define SCALER_IN_16bpp (0x4 << 16)
382
#define SCALER_IN_32bpp (0x6 << 16)
383
#define SCALER_IN_YUV_9 (0x9 << 16)
384
#define SCALER_IN_YUV_12 (0xa << 16)
385
#define SCALER_IN_VYUY422 (0xb << 16)
386
#define SCALER_IN_YVYU422 (0xc << 16)
388
#define CAP_INPUT_MODE (1 << 0)
389
#define CAP_BUF_MODE (1 << 2)
390
#define CAP_START_BUF (1 << 3)
391
#define CAP_BUF_TYPE_FIELD (0 << 4)
392
#define CAP_BUF_TYPE_ALTERNATING (1 << 4)
393
#define CAP_BUF_TYPE_FRAME (2 << 4)
395
#define OVL_BUF_MODE (1 << 28)
396
#define OVL_BUF_NEXT (1 << 29)
398
#define CAP_TRIGGER (3 << 0)
399
#define OVL_CUR_BUF (1 << 5)
400
#define OVL_BUF_STATUS (1 << 6)
401
#define CAP_BUF_STATUS (1 << 7)
402
#define CAPTURE_EN (1 << 31)
404
typedef struct _MediaReg {
405
VOL32 OVERLAY_Y_X_START; /* 0x100 */
406
VOL32 OVERLAY_Y_X_END;
407
VOL32 OVERLAY_VIDEO_KEY_CLR;
408
VOL32 OVERLAY_VIDEO_KEY_MSK;
409
VOL32 OVERLAY_GRAPHICS_KEY_CLR;
410
VOL32 OVERLAY_GRAPHICS_KEY_MSK;
411
VOL32 OVERLAY_KEY_CNTL;
413
VOL32 OVERLAY_SCALE_INC;
414
VOL32 OVERLAY_SCALE_CNTL;
415
VOL32 SCALER_HEIGHT_WIDTH;
418
VOL32 SCALER_BUF0_OFFSET;
419
VOL32 SCALER_BUF1_OFFSET;
420
VOL32 SCALER_BUF_PITCH;
421
VOL32 CAPTURE_START_END; /* 0x110 */
422
VOL32 CAPTURE_X_WIDTH;
425
VOL32 CAPTURE_CONFIG;
427
VOL32 OVERLAY_EXCLUSIVE_HORZ;
428
VOL32 OVERLAY_EXCLUSIVE_VERT;
431
VOL32 VIDEO_SYNC_TEST;
433
VOL32 SNAPSHOT_VH_COUNTS;
434
VOL32 SNAPSHOT_F_COUNT;
436
VOL32 SNAPSHOT_VIF_COUNT;
437
VOL32 CAPTURE_BUF0_OFFSET; /* 0x120 */
438
VOL32 CAPTURE_BUF1_OFFSET;
439
VOL32 ONESHOT_BUF_OFFSET;
449
VOL32 SNAPSHOT2_VH_COUNTS;
450
VOL32 SNAPSHOT2_F_COUNT;
452
VOL32 SNAPSHOT2_VIF_COUNT;
453
VOL32 MPP_CONFIG; /* 0x130 */
454
VOL32 MPP_STROBE_SEQ;
469
VOL32 TVO_CNTL; /* 0x140 */
470
VOL32 unused_141[15];
471
VOL32 unused_150; /* 0x150 */
472
VOL32 CRT_HORZ_VERT_LOAD; /* 0x151 */
473
VOL32 AGP_BASE; /* 0x152 */
474
VOL32 AGP_CNTL; /* 0x153 */
475
VOL32 SCALER_COLOUR_CNTL; /* 0x154 */
476
VOL32 SCALER_H_COEFF0; /* 0x155 */
477
VOL32 SCALER_H_COEFF1; /* 0x156 */
478
VOL32 SCALER_H_COEFF2; /* 0x157 */
479
VOL32 SCALER_H_COEFF3; /* 0x158 */
480
VOL32 SCALER_H_COEFF4; /* 0x159 */
483
VOL32 GUI_CMDFIFO_DEBUG;
484
VOL32 GUI_CMDFIFO_DATA;
487
VOL32 BM_FRAME_BUF_OFFSET; /* 0x160 */
488
VOL32 BM_SYSTEM_MEM_ADDR;
491
VOL32 unused_164[10];
493
VOL32 BM_SYSTEM_TABLE;
494
VOL32 unused_170[5]; /* 0x170 */
495
VOL32 SCALER_BUF0_OFFSET_U;
496
VOL32 SCALER_BUF0_OFFSET_V;
497
VOL32 SCALER_BUF1_OFFSET_U;
498
VOL32 SCALER_BUF1_OFFSET_V;
500
VOL32 unused_180[16]; /* 0x180 */
501
VOL32 setup_engine[0x40]; /* 0x190 */
502
VOL32 dvd_subpicture[0x30]; /* 0x1d0 */
505
#define MACH64_XY(x,y) (((x) & 0x7fff) | (((y) & 0x7fff) << 16))
506
#define MACH64_YX(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16))
508
typedef struct _mach64Save {
512
typedef struct _mach64CardInfo {
513
VesaCardPrivRec vesa;
521
#define getMach64CardInfo(kd) ((Mach64CardInfo *) ((kd)->card->driver))
522
#define mach64CardInfo(kd) Mach64CardInfo *mach64c = getMach64CardInfo(kd)
524
typedef struct _mach64Cursor {
532
#define MACH64_CURSOR_WIDTH 64
533
#define MACH64_CURSOR_HEIGHT 64
536
* Xv information, optional
538
typedef struct _mach64PortPriv {
556
} Mach64PortPrivRec, *Mach64PortPrivPtr;
558
Bool mach64InitVideo(ScreenPtr pScreen);
560
typedef struct _mach64ScreenInfo {
561
VesaScreenPrivRec vesa;
567
CARD32 DP_SET_GUI_ENGINE;
568
CARD32 USR1_DST_OFF_PITCH;
572
KdVideoAdaptorPtr pAdaptor;
575
#define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver))
576
#define mach64ScreenInfo(kd) Mach64ScreenInfo *mach64s = getMach64ScreenInfo(kd)
579
mach64ReadLCD (Reg *reg, int id);
582
mach64WriteLCD (Reg *reg, int id, CARD32 data);
585
mach64Preserve (KdCardInfo *card);
588
mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c);
591
mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c);
594
mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c);
597
mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c);
600
mach64Enable (ScreenPtr pScreen);
603
mach64Disable (ScreenPtr pScreen);
606
mach64WaitAvail(Reg *reg, int n);
609
mach64WaitIdle (Reg *reg);
612
mach64DrawSetup (ScreenPtr pScreen);
615
mach64DrawInit (ScreenPtr pScreen);
618
mach64DrawReinit (ScreenPtr pScreen);
621
mach64DrawEnable (ScreenPtr pScreen);
624
mach64DrawSync (ScreenPtr pScreen);
627
mach64DrawDisable (ScreenPtr pScreen);
630
mach64DrawFini (ScreenPtr pScreen);
633
mach64ReadIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index);
636
mach64WriteIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index, CARD8 value);
639
mach64CursorInit (ScreenPtr pScreen);
642
mach64CursorEnable (ScreenPtr pScreen);
645
mach64CursorDisable (ScreenPtr pScreen);
648
mach64CursorFini (ScreenPtr pScreen);
651
mach64RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
653
extern KdCardFuncs mach64Funcs;
655
#endif /* _MACH64_H_ */