1 | /*␊ |
2 | * ati_resolution.h␊ |
3 | * ␊ |
4 | *␊ |
5 | * Created by Le Bidou on 19/03/10.␊ |
6 | * Copyright 2010 ---. All rights reserved.␊ |
7 | *␊ |
8 | */␊ |
9 | ␊ |
10 | #ifndef _ATI_RESOLUTION_H_␊ |
11 | #define _ATI_RESOLUTION_H_␊ |
12 | ␊ |
13 | #include "libsaio.h"␊ |
14 | #include "autoresolution.h"␊ |
15 | ␊ |
16 | ␊ |
17 | ␊ |
18 | /****************************************************************************/␉␊ |
19 | /*Shortatombios.h parts: */␊ |
20 | /*Portion I: Definitions shared between VBIOS and Driver */␊ |
21 | /****************************************************************************/␊ |
22 | ␊ |
23 | ␊ |
24 | #define ATOM_VERSION_MAJOR 0x00020000␊ |
25 | #define ATOM_VERSION_MINOR 0x00000002␊ |
26 | ␊ |
27 | #define ATOM_HEADER_VERSION (ATOM_VERSION_MAJOR | ATOM_VERSION_MINOR)␊ |
28 | ␊ |
29 | typedef unsigned char␉␉BOOLEAN;␊ |
30 | typedef signed char␉␉␉INT8;␊ |
31 | typedef unsigned char␉␉UINT8;␊ |
32 | typedef signed short␉␉INT16;␊ |
33 | typedef unsigned short␉␉UINT16;␊ |
34 | typedef signed long␉␉␉INT32;␊ |
35 | typedef unsigned long␉␉UINT32;␊ |
36 | typedef unsigned char␉␉CHAR8;␊ |
37 | typedef unsigned short␉␉CHAR16;␊ |
38 | typedef unsigned short␉␉USHORT;␊ |
39 | typedef unsigned char␉␉UCHAR;␊ |
40 | typedef␉unsigned long␉␉ULONG;␊ |
41 | ␊ |
42 | #pragma pack(1) /* BIOS data must use byte aligment */␊ |
43 | ␊ |
44 | /* Define offset to location of ROM header. */␊ |
45 | ␊ |
46 | #define OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER␉␉0x00000048L␊ |
47 | #define OFFSET_TO_ATOM_ROM_IMAGE_SIZE␉␉␉␉ 0x00000002L␊ |
48 | ␊ |
49 | typedef struct _ATOM_COMMON_TABLE_HEADER␊ |
50 | {␊ |
51 | USHORT usStructureSize;␊ |
52 | UCHAR ucTableFormatRevision; /*Change it when the Parser is not backward compatible */␊ |
53 | UCHAR ucTableContentRevision; /*Change it only when the table needs to change but the firmware */␊ |
54 | /*Image can't be updated, while Driver needs to carry the new table! */␊ |
55 | }ATOM_COMMON_TABLE_HEADER;␊ |
56 | ␊ |
57 | typedef struct _ATOM_ROM_HEADER␊ |
58 | {␊ |
59 | ATOM_COMMON_TABLE_HEADER␉␉sHeader;␊ |
60 | UCHAR␉ uaFirmWareSignature[4]; /*Signature to distinguish between Atombios and non-atombios, ␊ |
61 | atombios should init it as "ATOM", don't change the position */␊ |
62 | USHORT usBiosRuntimeSegmentAddress;␊ |
63 | USHORT usProtectedModeInfoOffset;␊ |
64 | USHORT usConfigFilenameOffset;␊ |
65 | USHORT usCRC_BlockOffset;␊ |
66 | USHORT usBIOS_BootupMessageOffset;␊ |
67 | USHORT usInt10Offset;␊ |
68 | USHORT usPciBusDevInitCode;␊ |
69 | USHORT usIoBaseAddress;␊ |
70 | USHORT usSubsystemVendorID;␊ |
71 | USHORT usSubsystemID;␊ |
72 | USHORT usPCI_InfoOffset; ␊ |
73 | USHORT usMasterCommandTableOffset; /*Offset for SW to get all command table offsets, Don't change the position */␊ |
74 | USHORT usMasterDataTableOffset; /*Offset for SW to get all data table offsets, Don't change the position */␊ |
75 | UCHAR ucExtendedFunctionCode;␊ |
76 | UCHAR ucReserved;␊ |
77 | }ATOM_ROM_HEADER;␊ |
78 | ␊ |
79 | /****************************************************************************/␉␊ |
80 | // Structure used in Data.mtb␊ |
81 | /****************************************************************************/␉␊ |
82 | typedef struct _ATOM_MASTER_LIST_OF_DATA_TABLES␊ |
83 | {␊ |
84 | USHORT UtilityPipeLine;␉ // Offest for the utility to get parser info,Don't change this position!␊ |
85 | USHORT MultimediaCapabilityInfo; // Only used by MM Lib,latest version 1.1, not configuable from Bios, need to include the table to build Bios ␊ |
86 | USHORT MultimediaConfigInfo; // Only used by MM Lib,latest version 2.1, not configuable from Bios, need to include the table to build Bios␊ |
87 | USHORT StandardVESA_Timing; // Only used by Bios␊ |
88 | USHORT FirmwareInfo; // Shared by various SW components,latest version 1.4␊ |
89 | USHORT DAC_Info; // Will be obsolete from R600␊ |
90 | USHORT LVDS_Info; // Shared by various SW components,latest version 1.1 ␊ |
91 | USHORT TMDS_Info; // Will be obsolete from R600␊ |
92 | USHORT AnalogTV_Info; // Shared by various SW components,latest version 1.1 ␊ |
93 | USHORT SupportedDevicesInfo; // Will be obsolete from R600␊ |
94 | USHORT GPIO_I2C_Info; // Shared by various SW components,latest version 1.2 will be used from R600 ␊ |
95 | USHORT VRAM_UsageByFirmware; // Shared by various SW components,latest version 1.3 will be used from R600␊ |
96 | USHORT GPIO_Pin_LUT; // Shared by various SW components,latest version 1.1␊ |
97 | USHORT VESA_ToInternalModeLUT; // Only used by Bios␊ |
98 | USHORT ComponentVideoInfo; // Shared by various SW components,latest version 2.1 will be used from R600␊ |
99 | USHORT PowerPlayInfo; // Shared by various SW components,latest version 2.1,new design from R600␊ |
100 | USHORT CompassionateData; // Will be obsolete from R600␊ |
101 | USHORT SaveRestoreInfo; // Only used by Bios␊ |
102 | USHORT PPLL_SS_Info; // Shared by various SW components,latest version 1.2, used to call SS_Info, change to new name because of int ASIC SS info␊ |
103 | USHORT OemInfo; // Defined and used by external SW, should be obsolete soon␊ |
104 | USHORT XTMDS_Info; // Will be obsolete from R600␊ |
105 | USHORT MclkSS_Info; // Shared by various SW components,latest version 1.1, only enabled when ext SS chip is used␊ |
106 | USHORT Object_Header; // Shared by various SW components,latest version 1.1␊ |
107 | USHORT IndirectIOAccess; // Only used by Bios,this table position can't change at all!!␊ |
108 | USHORT MC_InitParameter; // Only used by command table␊ |
109 | USHORT ASIC_VDDC_Info;␉␉␉␉␉␉// Will be obsolete from R600␊ |
110 | USHORT ASIC_InternalSS_Info;␉␉␉// New tabel name from R600, used to be called "ASIC_MVDDC_Info"␊ |
111 | USHORT TV_VideoMode;␉␉␉␉␉␉␉// Only used by command table␊ |
112 | USHORT VRAM_Info;␉␉␉␉␉␉␉␉// Only used by command table, latest version 1.3␊ |
113 | USHORT MemoryTrainingInfo;␉␉␉␉// Used for VBIOS and Diag utility for memory training purpose since R600. the new table rev start from 2.1␊ |
114 | USHORT IntegratedSystemInfo;␉␉␉// Shared by various SW components␊ |
115 | USHORT ASIC_ProfilingInfo;␉␉␉␉// New table name from R600, used to be called "ASIC_VDDCI_Info" for pre-R600␊ |
116 | USHORT VoltageObjectInfo;␉␉␉␉// Shared by various SW components, latest version 1.1␊ |
117 | ␉USHORT␉␉␉␉PowerSourceInfo;␉␉␉␉␉// Shared by various SW components, latest versoin 1.1␊ |
118 | }ATOM_MASTER_LIST_OF_DATA_TABLES;␊ |
119 | ␊ |
120 | typedef struct _ATOM_MASTER_DATA_TABLE␊ |
121 | { ␊ |
122 | ATOM_COMMON_TABLE_HEADER sHeader; ␊ |
123 | ATOM_MASTER_LIST_OF_DATA_TABLES ListOfDataTables;␊ |
124 | }ATOM_MASTER_DATA_TABLE;␊ |
125 | ␊ |
126 | typedef union _ATOM_MODE_MISC_INFO_ACCESS␊ |
127 | { ␊ |
128 | ␉USHORT usAccess;␊ |
129 | }ATOM_MODE_MISC_INFO_ACCESS;␊ |
130 | ␊ |
131 | /****************************************************************************/␉␊ |
132 | // Structure used in StandardVESA_TimingTable␊ |
133 | // AnalogTV_InfoTable ␊ |
134 | // ComponentVideoInfoTable␊ |
135 | /****************************************************************************/␉␊ |
136 | typedef struct _ATOM_MODE_TIMING␊ |
137 | {␊ |
138 | USHORT usCRTC_H_Total;␊ |
139 | USHORT usCRTC_H_Disp;␊ |
140 | USHORT usCRTC_H_SyncStart;␊ |
141 | USHORT usCRTC_H_SyncWidth;␊ |
142 | USHORT usCRTC_V_Total;␊ |
143 | USHORT usCRTC_V_Disp;␊ |
144 | USHORT usCRTC_V_SyncStart;␊ |
145 | USHORT usCRTC_V_SyncWidth;␊ |
146 | USHORT usPixelClock;␉␉␉␉␉ //in 10Khz unit␊ |
147 | ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo;␊ |
148 | USHORT usCRTC_OverscanRight;␊ |
149 | USHORT usCRTC_OverscanLeft;␊ |
150 | USHORT usCRTC_OverscanBottom;␊ |
151 | USHORT usCRTC_OverscanTop;␊ |
152 | USHORT usReserve;␊ |
153 | UCHAR ucInternalModeNumber;␊ |
154 | UCHAR ucRefreshRate;␊ |
155 | }ATOM_MODE_TIMING;␊ |
156 | ␊ |
157 | typedef struct _ATOM_DTD_FORMAT␊ |
158 | {␊ |
159 | USHORT usPixClk;␊ |
160 | USHORT usHActive;␊ |
161 | USHORT usHBlanking_Time;␊ |
162 | USHORT usVActive;␊ |
163 | USHORT usVBlanking_Time;␉␉␉␊ |
164 | USHORT usHSyncOffset;␊ |
165 | USHORT usHSyncWidth;␊ |
166 | USHORT usVSyncOffset;␊ |
167 | USHORT usVSyncWidth;␊ |
168 | USHORT usImageHSize;␊ |
169 | USHORT usImageVSize;␊ |
170 | UCHAR ucHBorder;␊ |
171 | UCHAR ucVBorder;␊ |
172 | ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo;␊ |
173 | UCHAR ucInternalModeNumber;␊ |
174 | UCHAR ucRefreshRate;␊ |
175 | }ATOM_DTD_FORMAT;␊ |
176 | ␊ |
177 | typedef struct _ATOM_LVDS_INFO_V12␊ |
178 | {␊ |
179 | ATOM_COMMON_TABLE_HEADER sHeader; ␊ |
180 | ATOM_DTD_FORMAT sLCDTiming;␊ |
181 | USHORT usExtInfoTableOffset;␊ |
182 | USHORT usSupportedRefreshRate; //Refer to panel info table in ATOMBIOS extension Spec.␊ |
183 | USHORT usOffDelayInMs;␊ |
184 | UCHAR ucPowerSequenceDigOntoDEin10Ms;␊ |
185 | UCHAR ucPowerSequenceDEtoBLOnin10Ms;␊ |
186 | UCHAR ucLVDS_Misc; // Bit0:{=0:single, =1:dual},Bit1 {=0:666RGB, =1:888RGB},Bit2:3:{Grey level}␊ |
187 | // Bit4:{=0:LDI format for RGB888, =1 FPDI format for RGB888}␊ |
188 | // Bit5:{=0:Spatial Dithering disabled;1 Spatial Dithering enabled}␊ |
189 | // Bit6:{=0:Temporal Dithering disabled;1 Temporal Dithering enabled}␊ |
190 | UCHAR ucPanelDefaultRefreshRate;␊ |
191 | UCHAR ucPanelIdentification;␊ |
192 | UCHAR ucSS_Id;␊ |
193 | USHORT usLCDVenderID;␊ |
194 | USHORT usLCDProductID;␊ |
195 | UCHAR ucLCDPanel_SpecialHandlingCap; ␊ |
196 | ␉UCHAR␉␉␉␉␉␉␉␉ucPanelInfoSize;␉␉␉␉␉// start from ATOM_DTD_FORMAT to end of panel info, include ExtInfoTable␊ |
197 | UCHAR ucReserved[2];␊ |
198 | }ATOM_LVDS_INFO_V12;␊ |
199 | ␊ |
200 | ␊ |
201 | /****************************************************************************/␉␊ |
202 | /*Original ati_resolution.h parts: */␊ |
203 | /****************************************************************************/␊ |
204 | ␊ |
205 | ␊ |
206 | typedef struct _ATOM_STANDARD_VESA_TIMING␊ |
207 | {␊ |
208 | ATOM_COMMON_TABLE_HEADER sHeader; ␊ |
209 | char * ␉␉␉␉ aModeTimings; // 16 is not the real array number, just for initial allocation␊ |
210 | }ATOM_STANDARD_VESA_TIMING;␊ |
211 | ␊ |
212 | ␊ |
213 | #define ATI_SIGNATURE1 "ATI MOBILITY RADEON"␊ |
214 | #define ATI_SIGNATURE2 "ATI Technologies Inc"␊ |
215 | ␊ |
216 | typedef struct {␊ |
217 | unsigned char *base;␊ |
218 | ATOM_ROM_HEADER *AtomRomHeader;␊ |
219 | unsigned short *MasterCommandTables;␊ |
220 | unsigned short *MasterDataTables;␊ |
221 | } bios_tables_t;␊ |
222 | ␊ |
223 | char detect_ati_bios_type(vbios_map * map);␊ |
224 | ␊ |
225 | vbios_map * open_ati_vbios(vbios_map * map, bios_tables_t ati_tables);␊ |
226 | ␊ |
227 | bool ati_set_mode_1(vbios_map* map, UInt8 idx, UInt32* x, UInt32* y);␊ |
228 | bool ati_set_mode_2(vbios_map* map, UInt8 idx, UInt32* x, UInt32* y);␊ |
229 | ␊ |
230 | ␊ |
231 | ␊ |
232 | #endif |