18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#ifndef TRIDENTFB_DEBUG
48c2ecf20Sopenharmony_ci#define TRIDENTFB_DEBUG 0
58c2ecf20Sopenharmony_ci#endif
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#if TRIDENTFB_DEBUG
88c2ecf20Sopenharmony_ci#define debug(f, a...)	printk("%s:" f,  __func__ , ## a);
98c2ecf20Sopenharmony_ci#else
108c2ecf20Sopenharmony_ci#define debug(f, a...)
118c2ecf20Sopenharmony_ci#endif
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define output(f, a...) pr_info("tridentfb: " f, ## a)
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define Kb	(1024)
168c2ecf20Sopenharmony_ci#define Mb	(Kb*Kb)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* PCI IDS of supported cards temporarily here */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define CYBER9320	0x9320
218c2ecf20Sopenharmony_ci#define CYBER9388	0x9388
228c2ecf20Sopenharmony_ci#define CYBER9382	0x9382		/* the real PCI id for this is 9660 */
238c2ecf20Sopenharmony_ci#define CYBER9385	0x9385		/* ditto */
248c2ecf20Sopenharmony_ci#define CYBER9397	0x9397
258c2ecf20Sopenharmony_ci#define CYBER9397DVD	0x939A
268c2ecf20Sopenharmony_ci#define CYBER9520	0x9520
278c2ecf20Sopenharmony_ci#define CYBER9525DVD	0x9525
288c2ecf20Sopenharmony_ci#define TGUI9440	0x9440
298c2ecf20Sopenharmony_ci#define TGUI9660	0x9660
308c2ecf20Sopenharmony_ci#define PROVIDIA9685	0x9685
318c2ecf20Sopenharmony_ci#define IMAGE975	0x9750
328c2ecf20Sopenharmony_ci#define IMAGE985	0x9850
338c2ecf20Sopenharmony_ci#define BLADE3D		0x9880
348c2ecf20Sopenharmony_ci#define CYBERBLADEE4	0x9540
358c2ecf20Sopenharmony_ci#define CYBERBLADEi7	0x8400
368c2ecf20Sopenharmony_ci#define CYBERBLADEi7D	0x8420
378c2ecf20Sopenharmony_ci#define CYBERBLADEi1	0x8500
388c2ecf20Sopenharmony_ci#define CYBERBLADEi1D	0x8520
398c2ecf20Sopenharmony_ci#define CYBERBLADEAi1	0x8600
408c2ecf20Sopenharmony_ci#define CYBERBLADEAi1D	0x8620
418c2ecf20Sopenharmony_ci#define CYBERBLADEXPAi1 0x8820
428c2ecf20Sopenharmony_ci#define CYBERBLADEXPm8  0x9910
438c2ecf20Sopenharmony_ci#define CYBERBLADEXPm16 0x9930
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* these defines are for 'lcd' variable */
468c2ecf20Sopenharmony_ci#define LCD_STRETCH	0
478c2ecf20Sopenharmony_ci#define LCD_CENTER	1
488c2ecf20Sopenharmony_ci#define LCD_BIOS	2
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* General Registers */
518c2ecf20Sopenharmony_ci#define SPR	0x1F		/* Software Programming Register (videoram) */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* 3C4 */
548c2ecf20Sopenharmony_ci#define RevisionID 0x09
558c2ecf20Sopenharmony_ci#define OldOrNew 0x0B
568c2ecf20Sopenharmony_ci#define ConfPort1 0x0C
578c2ecf20Sopenharmony_ci#define ConfPort2 0x0C
588c2ecf20Sopenharmony_ci#define NewMode2 0x0D
598c2ecf20Sopenharmony_ci#define NewMode1 0x0E
608c2ecf20Sopenharmony_ci#define Protection 0x11
618c2ecf20Sopenharmony_ci#define MCLKLow 0x16
628c2ecf20Sopenharmony_ci#define MCLKHigh 0x17
638c2ecf20Sopenharmony_ci#define ClockLow 0x18
648c2ecf20Sopenharmony_ci#define ClockHigh 0x19
658c2ecf20Sopenharmony_ci#define SSetup 0x20
668c2ecf20Sopenharmony_ci#define SKey 0x37
678c2ecf20Sopenharmony_ci#define SPKey 0x57
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* 3x4 */
708c2ecf20Sopenharmony_ci#define CRTCModuleTest 0x1E
718c2ecf20Sopenharmony_ci#define FIFOControl 0x20
728c2ecf20Sopenharmony_ci#define LinearAddReg 0x21
738c2ecf20Sopenharmony_ci#define DRAMTiming 0x23
748c2ecf20Sopenharmony_ci#define New32 0x23
758c2ecf20Sopenharmony_ci#define RAMDACTiming 0x25
768c2ecf20Sopenharmony_ci#define CRTHiOrd 0x27
778c2ecf20Sopenharmony_ci#define AddColReg 0x29
788c2ecf20Sopenharmony_ci#define InterfaceSel 0x2A
798c2ecf20Sopenharmony_ci#define HorizOverflow 0x2B
808c2ecf20Sopenharmony_ci#define GETest 0x2D
818c2ecf20Sopenharmony_ci#define Performance 0x2F
828c2ecf20Sopenharmony_ci#define GraphEngReg 0x36
838c2ecf20Sopenharmony_ci#define I2C 0x37
848c2ecf20Sopenharmony_ci#define PixelBusReg 0x38
858c2ecf20Sopenharmony_ci#define PCIReg 0x39
868c2ecf20Sopenharmony_ci#define DRAMControl 0x3A
878c2ecf20Sopenharmony_ci#define MiscContReg 0x3C
888c2ecf20Sopenharmony_ci#define CursorXLow 0x40
898c2ecf20Sopenharmony_ci#define CursorXHigh 0x41
908c2ecf20Sopenharmony_ci#define CursorYLow 0x42
918c2ecf20Sopenharmony_ci#define CursorYHigh 0x43
928c2ecf20Sopenharmony_ci#define CursorLocLow 0x44
938c2ecf20Sopenharmony_ci#define CursorLocHigh 0x45
948c2ecf20Sopenharmony_ci#define CursorXOffset 0x46
958c2ecf20Sopenharmony_ci#define CursorYOffset 0x47
968c2ecf20Sopenharmony_ci#define CursorFG1 0x48
978c2ecf20Sopenharmony_ci#define CursorFG2 0x49
988c2ecf20Sopenharmony_ci#define CursorFG3 0x4A
998c2ecf20Sopenharmony_ci#define CursorFG4 0x4B
1008c2ecf20Sopenharmony_ci#define CursorBG1 0x4C
1018c2ecf20Sopenharmony_ci#define CursorBG2 0x4D
1028c2ecf20Sopenharmony_ci#define CursorBG3 0x4E
1038c2ecf20Sopenharmony_ci#define CursorBG4 0x4F
1048c2ecf20Sopenharmony_ci#define CursorControl 0x50
1058c2ecf20Sopenharmony_ci#define PCIRetry 0x55
1068c2ecf20Sopenharmony_ci#define PreEndControl 0x56
1078c2ecf20Sopenharmony_ci#define PreEndFetch 0x57
1088c2ecf20Sopenharmony_ci#define PCIMaster 0x60
1098c2ecf20Sopenharmony_ci#define Enhancement0 0x62
1108c2ecf20Sopenharmony_ci#define NewEDO 0x64
1118c2ecf20Sopenharmony_ci#define TVinterface 0xC0
1128c2ecf20Sopenharmony_ci#define TVMode 0xC1
1138c2ecf20Sopenharmony_ci#define ClockControl 0xCF
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* 3CE */
1178c2ecf20Sopenharmony_ci#define MiscExtFunc 0x0F
1188c2ecf20Sopenharmony_ci#define PowerStatus 0x23
1198c2ecf20Sopenharmony_ci#define MiscIntContReg 0x2F
1208c2ecf20Sopenharmony_ci#define CyberControl 0x30
1218c2ecf20Sopenharmony_ci#define CyberEnhance 0x31
1228c2ecf20Sopenharmony_ci#define FPConfig     0x33
1238c2ecf20Sopenharmony_ci#define VertStretch  0x52
1248c2ecf20Sopenharmony_ci#define HorStretch   0x53
1258c2ecf20Sopenharmony_ci#define BiosMode     0x5c
1268c2ecf20Sopenharmony_ci#define BiosReg      0x5d
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/* Graphics Engine */
1298c2ecf20Sopenharmony_ci#define STATUS	0x2120
1308c2ecf20Sopenharmony_ci#define OLDCMD	0x2124
1318c2ecf20Sopenharmony_ci#define DRAWFL	0x2128
1328c2ecf20Sopenharmony_ci#define OLDCLR	0x212C
1338c2ecf20Sopenharmony_ci#define OLDDST	0x2138
1348c2ecf20Sopenharmony_ci#define OLDSRC	0x213C
1358c2ecf20Sopenharmony_ci#define OLDDIM	0x2140
1368c2ecf20Sopenharmony_ci#define CMD	0x2144
1378c2ecf20Sopenharmony_ci#define ROP	0x2148
1388c2ecf20Sopenharmony_ci#define COLOR	0x2160
1398c2ecf20Sopenharmony_ci#define BGCOLOR	0x2164
1408c2ecf20Sopenharmony_ci#define SRC1	0x2100
1418c2ecf20Sopenharmony_ci#define SRC2	0x2104
1428c2ecf20Sopenharmony_ci#define DST1	0x2108
1438c2ecf20Sopenharmony_ci#define DST2	0x210C
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define ROP_S	0xCC
1468c2ecf20Sopenharmony_ci#define ROP_P	0xF0
1478c2ecf20Sopenharmony_ci#define ROP_X	0x66
148