1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
/*
* Copyright 2007 Egbert Eich <eich@novell.com>
* Copyright 2007 Luc Verhaegen <lverhaegen@novell.com>
* Copyright 2007 Matthias Hopf <mhopf@novell.com>
* Copyright 2007 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef RHD_ATOMBIOS_H_
# define RHD_ATOMBIOS_H_
//#include "radeon.h"
# ifdef ATOM_BIOS
typedef enum _AtomBiosRequestID {
ATOMBIOS_INIT,
ATOMBIOS_TEARDOWN,
# ifdef ATOM_BIOS_PARSER
ATOMBIOS_EXEC,
#endif
ATOMBIOS_ALLOCATE_FB_SCRATCH,
ATOMBIOS_GET_CONNECTORS,
ATOMBIOS_GET_PANEL_MODE,
ATOMBIOS_GET_PANEL_EDID,
GET_DEFAULT_ENGINE_CLOCK,
GET_DEFAULT_MEMORY_CLOCK,
GET_MAX_PIXEL_CLOCK_PLL_OUTPUT,
GET_MIN_PIXEL_CLOCK_PLL_OUTPUT,
GET_MAX_PIXEL_CLOCK_PLL_INPUT,
GET_MIN_PIXEL_CLOCK_PLL_INPUT,
GET_MAX_PIXEL_CLK,
GET_REF_CLOCK,
GET_FW_FB_START,
GET_FW_FB_SIZE,
ATOM_TMDS_FREQUENCY,
ATOM_TMDS_PLL_CHARGE_PUMP,
ATOM_TMDS_PLL_DUTY_CYCLE,
ATOM_TMDS_PLL_VCO_GAIN,
ATOM_TMDS_PLL_VOLTAGE_SWING,
ATOM_LVDS_SUPPORTED_REFRESH_RATE,
ATOM_LVDS_OFF_DELAY,
ATOM_LVDS_SEQ_DIG_ONTO_DE,
ATOM_LVDS_SEQ_DE_TO_BL,
ATOM_LVDS_DITHER,
ATOM_LVDS_DUALLINK,
ATOM_LVDS_24BIT,
ATOM_LVDS_GREYLVL,
ATOM_LVDS_FPDI,
ATOM_GPIO_QUERIES,
ATOM_GPIO_I2C_CLK_MASK,
ATOM_DAC1_BG_ADJ,
ATOM_DAC1_DAC_ADJ,
ATOM_DAC1_FORCE,
ATOM_DAC2_CRTC2_BG_ADJ,
ATOM_DAC2_CRTC2_DAC_ADJ,
ATOM_DAC2_CRTC2_FORCE,
ATOM_DAC2_CRTC2_MUX_REG_IND,
ATOM_DAC2_CRTC2_MUX_REG_INFO,
ATOMBIOS_GET_CV_MODES,
FUNC_END
} AtomBiosRequestID;
typedef enum _AtomBiosResult {
ATOM_SUCCESS,
ATOM_FAILED,
ATOM_NOT_IMPLEMENTED
} AtomBiosResult;
typedef struct AtomExec {
int index;
pointer pspace;
pointer *dataSpace;
} AtomExecRec, *AtomExecPtr;
typedef struct AtomFb {
unsigned int start;
unsigned int size;
} AtomFbRec, *AtomFbPtr;
typedef union AtomBiosArg
{
uint32_t val;
struct rhdConnectorInfo *connectorInfo;
unsigned char* EDIDBlock;
atomBiosHandlePtr atomhandle;
DisplayModePtr modes;
AtomExecRec exec;
AtomFbRec fb;
} AtomBiosArgRec, *AtomBiosArgPtr;
extern AtomBiosResult
RHDAtomBiosFunc(int scrnIndex, atomBiosHandlePtr handle,
AtomBiosRequestID id, AtomBiosArgPtr data);
extern Bool
RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn);
extern Bool
RADEONGetATOMConnectorInfoFromBIOSConnectorTable (ScrnInfoPtr pScrn);
extern int
atombios_clk_gating_setup(ScrnInfoPtr pScrn, Bool enable);
extern int
atombios_static_pwrmgt_setup(ScrnInfoPtr pScrn, Bool enable);
extern int
atombios_set_engine_clock(ScrnInfoPtr pScrn, uint32_t engclock);
extern int
atombios_set_memory_clock(ScrnInfoPtr pScrn, uint32_t memclock);
extern Bool
RADEONGetATOMTVInfo(xf86OutputPtr output);
extern int
atombios_external_tmds_setup(xf86OutputPtr output, int action);
extern void
atombios_get_command_table_version(atomBiosHandlePtr atomBIOS, int index, int *major, int *minor);
extern xf86MonPtr
radeon_atom_get_edid(xf86OutputPtr output);
Bool
rhdAtomASICInit(atomBiosHandlePtr handle);
# include "xf86int10.h"
# ifdef ATOM_BIOS_PARSER
# define INT8 INT8
# define INT16 INT16
# define INT32 INT32
# include "CD_Common_Types.h"
# else
# ifndef ULONG
typedef unsigned int ULONG;
# define ULONG ULONG
# endif
# ifndef UCHAR
typedef unsigned char UCHAR;
# define UCHAR UCHAR
# endif
# ifndef USHORT
typedef unsigned short USHORT;
# define USHORT USHORT
# endif
# endif
# include "atombios.h"
# include "ObjectID.h"
/*
* This works around a bug in atombios.h where
* ATOM_MAX_SUPPORTED_DEVICE_INFO is specified incorrectly.
*/
#define ATOM_MAX_SUPPORTED_DEVICE_INFO_HD (ATOM_DEVICE_RESERVEDF_INDEX+1)
typedef struct _ATOM_SUPPORTED_DEVICES_INFO_HD
{
ATOM_COMMON_TABLE_HEADER sHeader;
USHORT usDeviceSupport;
ATOM_CONNECTOR_INFO_I2C asConnInfo[ATOM_MAX_SUPPORTED_DEVICE_INFO_HD];
ATOM_CONNECTOR_INC_SRC_BITMAP asIntSrcInfo[ATOM_MAX_SUPPORTED_DEVICE_INFO_HD];
} ATOM_SUPPORTED_DEVICES_INFO_HD;
typedef struct _atomDataTables
{
unsigned char *UtilityPipeLine;
ATOM_MULTIMEDIA_CAPABILITY_INFO *MultimediaCapabilityInfo;
ATOM_MULTIMEDIA_CONFIG_INFO *MultimediaConfigInfo;
ATOM_STANDARD_VESA_TIMING *StandardVESA_Timing;
union {
void *base;
ATOM_FIRMWARE_INFO *FirmwareInfo;
ATOM_FIRMWARE_INFO_V1_2 *FirmwareInfo_V_1_2;
ATOM_FIRMWARE_INFO_V1_3 *FirmwareInfo_V_1_3;
ATOM_FIRMWARE_INFO_V1_4 *FirmwareInfo_V_1_4;
ATOM_FIRMWARE_INFO_V2_1 *FirmwareInfo_V_2_1;
} FirmwareInfo;
ATOM_DAC_INFO *DAC_Info;
union {
void *base;
ATOM_LVDS_INFO *LVDS_Info;
ATOM_LVDS_INFO_V12 *LVDS_Info_v12;
} LVDS_Info;
ATOM_TMDS_INFO *TMDS_Info;
union {
void *base;
ATOM_ANALOG_TV_INFO *AnalogTV_Info;
ATOM_ANALOG_TV_INFO_V1_2 *AnalogTV_Info_v1_2;
} AnalogTV_Info;
union {
void *base;
ATOM_SUPPORTED_DEVICES_INFO *SupportedDevicesInfo;
ATOM_SUPPORTED_DEVICES_INFO_2 *SupportedDevicesInfo_2;
ATOM_SUPPORTED_DEVICES_INFO_2d1 *SupportedDevicesInfo_2d1;
ATOM_SUPPORTED_DEVICES_INFO_HD *SupportedDevicesInfo_HD;
} SupportedDevicesInfo;
ATOM_GPIO_I2C_INFO *GPIO_I2C_Info;
ATOM_VRAM_USAGE_BY_FIRMWARE *VRAM_UsageByFirmware;
ATOM_GPIO_PIN_LUT *GPIO_Pin_LUT;
ATOM_VESA_TO_INTENAL_MODE_LUT *VESA_ToInternalModeLUT;
union {
void *base;
ATOM_COMPONENT_VIDEO_INFO *ComponentVideoInfo;
ATOM_COMPONENT_VIDEO_INFO_V21 *ComponentVideoInfo_v21;
} ComponentVideoInfo;
/**/unsigned char *PowerPlayInfo;
COMPASSIONATE_DATA *CompassionateData;
ATOM_DISPLAY_DEVICE_PRIORITY_INFO *SaveRestoreInfo;
/**/unsigned char *PPLL_SS_Info;
ATOM_OEM_INFO *OemInfo;
ATOM_XTMDS_INFO *XTMDS_Info;
ATOM_ASIC_MVDD_INFO *MclkSS_Info;
ATOM_OBJECT_HEADER *Object_Header;
INDIRECT_IO_ACCESS *IndirectIOAccess;
ATOM_MC_INIT_PARAM_TABLE *MC_InitParameter;
/**/unsigned char *ASIC_VDDC_Info;
ATOM_ASIC_INTERNAL_SS_INFO *ASIC_InternalSS_Info;
/**/unsigned char *TV_VideoMode;
union {
void *base;
ATOM_VRAM_INFO_V2 *VRAM_Info_v2;
ATOM_VRAM_INFO_V3 *VRAM_Info_v3;
} VRAM_Info;
ATOM_MEMORY_TRAINING_INFO *MemoryTrainingInfo;
union {
void *base;
ATOM_INTEGRATED_SYSTEM_INFO *IntegratedSystemInfo;
ATOM_INTEGRATED_SYSTEM_INFO_V2 *IntegratedSystemInfo_v2;
} IntegratedSystemInfo;
ATOM_ASIC_PROFILING_INFO *ASIC_ProfilingInfo;
ATOM_VOLTAGE_OBJECT_INFO *VoltageObjectInfo;
ATOM_POWER_SOURCE_INFO *PowerSourceInfo;
} atomDataTables, *atomDataTablesPtr;
typedef struct _atomBiosHandle {
int scrnIndex;
unsigned char *BIOSBase;
atomDataTablesPtr atomDataPtr;
unsigned int cmd_offset;
pointer *scratchBase;
uint32_t fbBase;
#if XSERVER_LIBPCIACCESS
struct pci_device *device;
#else
PCITAG PciTag;
#endif
unsigned int BIOSImageSize;
} atomBiosHandleRec;
# endif
extern Bool
RADEONATOMGetTVTimings(ScrnInfoPtr pScrn, int index, DisplayModePtr mode);
extern void
RADEONATOMGetIGPInfo(ScrnInfoPtr pScrn);
extern Bool
RADEONGetATOMClockInfo(ScrnInfoPtr pScrn);
extern uint32_t
radeon_get_device_index(uint32_t device_support);
extern radeon_encoder_ptr
radeon_get_encoder(xf86OutputPtr output);
extern Bool
radeon_add_encoder(ScrnInfoPtr pScrn, uint32_t encoder_id, uint32_t device_support);
extern uint32_t
radeon_get_encoder_id_from_supported_device(ScrnInfoPtr pScrn, uint32_t supported_device, int dac);
#endif /* RHD_ATOMBIOS_H_ */
|