make the linux-ppc packags be in synch with other platforms
[tangerine.git] / arch / common / hidd.radeon / radeon.h
blobc36909e339086aff7b38c6f1cc53d7c91419b40c
1 #ifndef RADEON_H_
2 #define RADEON_H_
4 #include <exec/types.h>
6 typedef struct {
7 ULONG freq;
8 ULONG value;
9 } RADEONTMDSPll;
11 typedef struct {
12 UWORD reference_freq;
13 UWORD reference_div;
14 ULONG min_pll_freq;
15 ULONG max_pll_freq;
16 UWORD xclk;
17 } RADEONPLLRec;
19 typedef enum
21 DDC_NONE_DETECTED, DDC_NONE = DDC_NONE_DETECTED,
22 DDC_MONID,
23 DDC_DVI,
24 DDC_VGA,
25 DDC_CRT2
26 } RADEONDDCType;
28 typedef enum {
29 MT_UNKNOWN = -1,
30 MT_NONE = 0,
31 MT_CRT = 1,
32 MT_LCD = 2,
33 MT_DFP = 3,
34 MT_CTV = 4,
35 MT_STV = 5
36 } RADEONMonitorType;
38 typedef enum
40 CONNECTOR_NONE,
41 CONNECTOR_PROPRIETARY,
42 CONNECTOR_CRT,
43 CONNECTOR_DVI_I,
44 CONNECTOR_DVI_D,
45 CONNECTOR_CTV,
46 CONNECTOR_STV,
47 CONNECTOR_UNSUPPORTED
48 } RADEONConnectorType;
50 typedef enum
52 CONNECTOR_NONE_ATOM,
53 CONNECTOR_VGA_ATOM,
54 CONNECTOR_DVI_I_ATOM,
55 CONNECTOR_DVI_D_ATOM,
56 CONNECTOR_DVI_A_ATOM,
57 CONNECTOR_STV_ATOM,
58 CONNECTOR_CTV_ATOM,
59 CONNECTOR_LVDS_ATOM,
60 CONNECTOR_DIGITAL_ATOM,
61 CONNECTOR_UNSUPPORTED_ATOM
62 } RADEONConnectorTypeATOM;
64 typedef enum
66 DAC_UNKNOWN = -1,
67 DAC_PRIMARY = 0,
68 DAC_TVDAC = 1
69 } RADEONDacType;
71 typedef enum
73 TMDS_UNKNOWN = -1,
74 TMDS_INT = 0,
75 TMDS_EXT = 1
76 } RADEONTmdsType;
78 typedef struct
80 RADEONDDCType DDCType;
81 RADEONDacType DACType;
82 RADEONTmdsType TMDSType;
83 RADEONConnectorType ConnectorType;
84 RADEONMonitorType MonType;
85 } RADEONConnector;
87 typedef struct {
88 ULONG width;
89 ULONG height;
90 UBYTE bpp;
91 ULONG pixelc;
92 IPTR base;
93 ULONG HDisplay;
94 ULONG VDisplay;
95 ULONG HSyncStart;
96 ULONG HSyncEnd;
97 ULONG HTotal;
98 ULONG VSyncStart;
99 ULONG VSyncEnd;
100 ULONG VTotal;
101 ULONG Flags;
102 } RADEONModeInfo;
104 typedef enum {
105 Unknown = 0,
106 RAGE,
107 RADEON,
108 RV100,
109 RS100,
110 RV200,
111 RS200, RS250=RS200,
112 R200,
113 RV250,
114 RS300, RS350=RS300,
115 RV280,
116 R300,
117 R350, R360=R350,
118 RV350, RV360=RV350,
119 RV380, RV370=RV380,
120 R420, R423=R420,
122 CHIP_FAMILY_LAST
123 } CardType;
125 #define IS_RV100_VARIANT ((sd->Card.Type == RV100) || \
126 (sd->Card.Type == RV200) || \
127 (sd->Card.Type == RS100) || \
128 (sd->Card.Type == RS200) || \
129 (sd->Card.Type == RV250) || \
130 (sd->Card.Type == RV280) || \
131 (sd->Card.Type == RS300))
133 #define IS_R300_VARIANT ((sd->Card.Type == R300) || \
134 (sd->Card.Type == RV350) || \
135 (sd->Card.Type == R350) || \
136 (sd->Card.Type == RV380) || \
137 (sd->Card.Type == R420))
139 struct CardState {
140 ULONG pixelc, HDisplay, bpp;
142 /* Common registers */
143 ULONG ovr_clr;
144 ULONG ovr_wid_left_right;
145 ULONG ovr_wid_top_bottom;
146 ULONG ov0_scale_cntl;
147 ULONG mpp_tb_config;
148 ULONG mpp_gp_config;
149 ULONG subpic_cntl;
150 ULONG viph_control;
151 ULONG i2c_cntl_1;
152 ULONG gen_int_cntl;
153 ULONG cap0_trig_cntl;
154 ULONG cap1_trig_cntl;
155 ULONG bus_cntl;
156 ULONG surface_cntl;
157 ULONG bios_4_scratch;
158 ULONG bios_5_scratch;
159 ULONG bios_6_scratch;
161 /* Other registers to save for VT switches */
162 ULONG dp_datatype;
163 ULONG rbbm_soft_reset;
164 ULONG clock_cntl_index;
165 ULONG amcgpio_en_reg;
166 ULONG amcgpio_mask;
168 /* CRTC registers */
169 ULONG crtc_gen_cntl;
170 ULONG crtc_ext_cntl;
171 ULONG dac_cntl;
172 ULONG crtc_h_total_disp;
173 ULONG crtc_h_sync_strt_wid;
174 ULONG crtc_v_total_disp;
175 ULONG crtc_v_sync_strt_wid;
176 ULONG crtc_offset;
177 ULONG crtc_offset_cntl;
178 ULONG crtc_pitch;
179 ULONG disp_merge_cntl;
180 ULONG grph_buffer_cntl;
181 ULONG crtc_more_cntl;
183 /* CRTC2 registers */
184 ULONG crtc2_gen_cntl;
186 ULONG dac2_cntl;
187 ULONG disp_output_cntl;
188 ULONG disp_hw_debug;
189 ULONG disp2_merge_cntl;
190 ULONG grph2_buffer_cntl;
191 ULONG crtc2_h_total_disp;
192 ULONG crtc2_h_sync_strt_wid;
193 ULONG crtc2_v_total_disp;
194 ULONG crtc2_v_sync_strt_wid;
195 ULONG crtc2_offset;
196 ULONG crtc2_offset_cntl;
197 ULONG crtc2_pitch;
198 /* Flat panel registers */
199 ULONG fp_crtc_h_total_disp;
200 ULONG fp_crtc_v_total_disp;
201 ULONG fp_gen_cntl;
202 ULONG fp2_gen_cntl;
203 ULONG fp_h_sync_strt_wid;
204 ULONG fp2_h_sync_strt_wid;
205 ULONG fp_horz_stretch;
206 ULONG fp_panel_cntl;
207 ULONG fp_v_sync_strt_wid;
208 ULONG fp2_v_sync_strt_wid;
209 ULONG fp_vert_stretch;
210 ULONG lvds_gen_cntl;
211 ULONG lvds_pll_cntl;
212 ULONG tmds_pll_cntl;
213 ULONG tmds_transmitter_cntl;
215 /* Computed values for PLL */
216 ULONG dot_clock_freq;
217 ULONG pll_output_freq;
218 int feedback_div;
219 int post_div;
221 /* PLL registers */
222 unsigned ppll_ref_div;
223 unsigned ppll_div_3;
224 ULONG htotal_cntl;
226 /* Computed values for PLL2 */
227 ULONG dot_clock_freq_2;
228 ULONG pll_output_freq_2;
229 int feedback_div_2;
230 int post_div_2;
232 /* PLL2 registers */
233 ULONG p2pll_ref_div;
234 ULONG p2pll_div_0;
235 ULONG htotal_cntl2;
237 /* Pallet */
238 BOOL palette_valid;
239 ULONG palette[256];
240 ULONG palette2[256];
242 ULONG tv_dac_cntl;
245 struct Card {
246 UWORD ProductID;
247 UWORD VendorID;
248 CardType Type;
250 ULONG *MMIO;
251 UBYTE *VBIOS, *vbios_org;
252 IPTR FbAddress;
253 ULONG FbUsableSize;
254 IPTR FrameBuffer;
255 UWORD ROMHeaderStart;
256 UWORD MasterDataStart;
258 IPTR CursorStart;
260 BOOL IsIGP;
261 BOOL cursorVisible;
262 BOOL IsAtomBios;
263 BOOL IsMobility;
264 #warning TODO: Remove IsSecondary! Clone screens instead
265 BOOL IsSecondary;
266 BOOL HasSecondary;
267 BOOL R300CGWorkaround;
268 BOOL IsDellServer;
269 BOOL HasCRTC2;
270 BOOL HasSingleDAC;
271 BOOL IsDDR;
272 BOOL DDC1;
273 BOOL DDC2;
274 BOOL DDCBios;
275 BOOL OverlayOnCRTC2;
276 BOOL Busy;
278 BOOL ReversedDAC; /* TVDAC used as primary dac */
279 BOOL ReversedTMDS; /* DDC_DVI is used for external TMDS */
280 RADEONMonitorType MonType2;
281 RADEONMonitorType MonType1;
283 RADEONConnector PortInfo[2];
284 RADEONTMDSPll tmds_pll[4];
285 RADEONPLLRec pll;
287 float sclk,mclk;
289 ULONG PanelXRes, PanelYRes;
290 ULONG HBlank, HOverPlus, HSyncWidth;
291 ULONG VBlank, VOverPlus, VSyncWidth;
292 ULONG DotClock;
293 ULONG Flags;
295 ULONG DDCReg;
296 ULONG PanelPwrDly;
297 ULONG RamWidth;
298 ULONG BusCntl;
299 ULONG MemCntl;
301 ULONG FIFOSlots;
304 #define V_DBLSCAN 0x00000001
305 #define V_CSYNC 0x00000002
306 #define V_NHSYNC 0x00000004
307 #define V_NVSYNC 0x00000008
308 #define V_INTERLACE 0x10000000
309 #define RADEON_USE_RMX 0x80000000
311 #define RADEON_IDLE_ENTRY 16
312 #define RADEON_TIMEOUT 2000000
313 #define RADEON_MMIOSIZE 0x80000
315 #define RADEONWaitForFifo(sd, entries) \
316 do { \
317 if (sd->Card.FIFOSlots < entries) \
318 RADEONWaitForFifoFunction(sd, entries); \
319 sd->Card.FIFOSlots -= entries; \
320 } while (0)
323 struct ati_staticdata;
324 void SaveState(struct ati_staticdata *sd, struct CardState *save);
325 void LoadState(struct ati_staticdata *sd, struct CardState *restore);
326 void DPMS(struct ati_staticdata *sd, HIDDT_DPMSLevel level);
327 void ShowHideCursor(struct ati_staticdata *sd, BOOL visible);
328 void InitMode(struct ati_staticdata *sd, struct CardState *save,
329 ULONG width, ULONG height, UBYTE bpp, ULONG pixelc, IPTR base,
330 ULONG HDisplay, ULONG VDisplay,
331 ULONG HSyncStart, ULONG HSyncEnd, ULONG HTotal,
332 ULONG VSyncStart, ULONG VSyncEnd, ULONG VTotal);
333 BOOL RADEONInit(struct ati_staticdata *sd);
335 IPTR AllocBitmapArea(struct ati_staticdata *sd, ULONG width, ULONG height,
336 ULONG bpp, BOOL must_have);
337 VOID FreeBitmapArea(struct ati_staticdata *sd, IPTR bmp, ULONG width, ULONG height, ULONG bpp);
338 void R300CGWorkaround(struct ati_staticdata *sd);
339 unsigned RADEONINPLL(struct ati_staticdata *sd, int addr);
340 VOID SetGamma(struct ati_staticdata *sd, float r, float g, float b);
342 #endif /*RADEON_H_*/