12 #ifndef __SAVAGEFB_H__
13 #define __SAVAGEFB_H__
15 #include <linux/i2c.h>
22 # define DBG(x) printk (KERN_DEBUG "savagefb: %s\n", (x));
25 # define SavagePrintRegs(...)
29 #define PCI_CHIP_SAVAGE4 0x8a22
30 #define PCI_CHIP_SAVAGE3D 0x8a20
31 #define PCI_CHIP_SAVAGE3D_MV 0x8a21
32 #define PCI_CHIP_SAVAGE2000 0x9102
33 #define PCI_CHIP_SAVAGE_MX_MV 0x8c10
34 #define PCI_CHIP_SAVAGE_MX 0x8c11
35 #define PCI_CHIP_SAVAGE_IX_MV 0x8c12
36 #define PCI_CHIP_SAVAGE_IX 0x8c13
37 #define PCI_CHIP_PROSAVAGE_PM 0x8a25
38 #define PCI_CHIP_PROSAVAGE_KM 0x8a26
39 #define PCI_CHIP_S3TWISTER_P 0x8d01
40 #define PCI_CHIP_S3TWISTER_K 0x8d02
41 #define PCI_CHIP_PROSAVAGE_DDR 0x8d03
42 #define PCI_CHIP_PROSAVAGE_DDRK 0x8d04
43 #define PCI_CHIP_SUPSAV_MX128 0x8c22
44 #define PCI_CHIP_SUPSAV_MX64 0x8c24
45 #define PCI_CHIP_SUPSAV_MX64C 0x8c26
46 #define PCI_CHIP_SUPSAV_IX128SDR 0x8c2a
47 #define PCI_CHIP_SUPSAV_IX128DDR 0x8c2b
48 #define PCI_CHIP_SUPSAV_IX64SDR 0x8c2c
49 #define PCI_CHIP_SUPSAV_IX64DDR 0x8c2d
50 #define PCI_CHIP_SUPSAV_IXCSDR 0x8c2e
51 #define PCI_CHIP_SUPSAV_IXCDDR 0x8c2f
54 #define S3_SAVAGE_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000))
56 #define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX))
58 #define S3_SAVAGE4_SERIES(chip) ((chip>=S3_SAVAGE4) && (chip<=S3_PROSAVAGEDDR))
60 #define S3_SAVAGE_MOBILE_SERIES(chip) ((chip==S3_SAVAGE_MX) || (chip==S3_SUPERSAVAGE))
62 #define S3_MOBILE_TWISTER_SERIES(chip) ((chip==S3_TWISTER) || (chip==S3_PROSAVAGEDDR))
81 #define BIOS_BSIZE 1024
82 #define BIOS_BASE 0xc0000
84 #define SAVAGE_NEWMMIO_REGBASE_S3 0x1000000
85 #define SAVAGE_NEWMMIO_REGBASE_S4 0x0000000
86 #define SAVAGE_NEWMMIO_REGSIZE 0x0080000
87 #define SAVAGE_NEWMMIO_VGABASE 0x8000
89 #define BASE_FREQ 14318
90 #define HALF_BASE_FREQ 7159
92 #define FIFO_CONTROL_REG 0x8200
93 #define MIU_CONTROL_REG 0x8204
94 #define STREAMS_TIMEOUT_REG 0x8208
95 #define MISC_TIMEOUT_REG 0x820c
97 #define MONO_PAT_0 0xa4e8
98 #define MONO_PAT_1 0xa4ec
100 #define MAXFIFO 0x7f00
102 #define BCI_CMD_NOP 0x40000000
103 #define BCI_CMD_SETREG 0x96000000
104 #define BCI_CMD_RECT 0x48000000
105 #define BCI_CMD_RECT_XP 0x01000000
106 #define BCI_CMD_RECT_YP 0x02000000
107 #define BCI_CMD_SEND_COLOR 0x00008000
108 #define BCI_CMD_DEST_GBD 0x00000000
109 #define BCI_CMD_SRC_GBD 0x00000020
110 #define BCI_CMD_SRC_SOLID 0x00000000
111 #define BCI_CMD_SRC_MONO 0x00000060
112 #define BCI_CMD_CLIP_NEW 0x00006000
113 #define BCI_CMD_CLIP_LR 0x00004000
115 #define BCI_CLIP_LR(l, r) ((((r) << 16) | (l)) & 0x0FFF0FFF)
116 #define BCI_CLIP_TL(t, l) ((((t) << 16) | (l)) & 0x0FFF0FFF)
117 #define BCI_CLIP_BR(b, r) ((((b) << 16) | (r)) & 0x0FFF0FFF)
118 #define BCI_W_H(w, h) (((h) << 16) | ((w) & 0xFFF))
119 #define BCI_X_Y(x, y) (((y) << 16) | ((x) & 0xFFF))
121 #define BCI_GBD1 0xE0
122 #define BCI_GBD2 0xE1
124 #define BCI_BUFFER_OFFSET 0x10000
125 #define BCI_SIZE 0x4000
127 #define BCI_SEND(dw) writel(dw, par->bci_base + par->bci_ptr++)
129 #define BCI_CMD_GET_ROP(cmd) (((cmd) >> 16) & 0xFF)
130 #define BCI_CMD_SET_ROP(cmd, rop) ((cmd) |= ((rop & 0xFF) << 16))
131 #define BCI_CMD_SEND_COLOR 0x00008000
176 #define NR_PALETTE 256
250 #define BCI_BD_BW_DISABLE 0x10000000
251 #define BCI_BD_SET_BPP(bd, bpp) ((bd) |= (((bpp) & 0xFF) << 16))
252 #define BCI_BD_SET_STRIDE(bd, st) ((bd) |= ((st) & 0xFFFF))
288 return savage_in8(0x8000 + addr, par);
293 return savage_in16(0x8000 + addr, par);
298 return savage_in32(0x8000 + addr, par);
303 savage_out8(0x8000 + addr, val, par);
308 savage_out16(0x8000 + addr, val, par);
313 savage_out32(0x8000 + addr, val, par);
318 vga_out8(0x3d4, index, par);
319 return vga_in8(0x3d5, par);
324 vga_out8(0x3ce, index, par);
325 return vga_in8(0x3cf, par);
330 vga_out8(0x3c4, index, par);
331 return vga_in8(0x3c5, par);
336 vga_out8(0x3d4, index, par);
337 vga_out8(0x3d5, val, par);
342 vga_out8(0x3ce, index, par);
343 vga_out8(0x3cf, val, par);
348 vga_out8(0x3c4, index, par);
349 vga_out8 (0x3c5, val, par);
352 static inline void VGAenablePalette(
struct savagefb_par *par)
356 tmp = vga_in8(0x3da, par);
357 vga_out8(0x3c0, 0x00, par);
361 static inline void VGAdisablePalette(
struct savagefb_par *par)
365 tmp = vga_in8(0x3da, par);
366 vga_out8(0x3c0, 0x20, par);
379 tmp = vga_in8(0x3da, par);
380 vga_out8(0x3c0, index, par);
381 vga_out8 (0x3c0, value, par);
386 vga_out8(0x3c2, value, par);
389 #ifndef CONFIG_FB_SAVAGE_ACCEL
390 #define savagefb_set_clip(x)
393 static inline void VerticalRetraceWait(
struct savagefb_par *par)
395 vga_out8(0x3d4, 0x17, par);
396 if (vga_in8(0x3d5, par) & 0x80) {
397 while ((vga_in8(0x3da, par) & 0x08) == 0x08);
398 while ((vga_in8(0x3da, par) & 0x08) == 0x00);