/drivers/gpu/drm/radeon/atombios.h

https://bitbucket.org/ndreys/linux-sunxi · C++ Header · 7023 lines · 5042 code · 904 blank · 1077 comment · 0 complexity · f2ab490678c143dc82c49f5a70d2d18b MD5 · raw file

Large files are truncated click here to view the full file

  1. /*
  2. * Copyright 2006-2007 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. */
  22. /****************************************************************************/
  23. /*Portion I: Definitions shared between VBIOS and Driver */
  24. /****************************************************************************/
  25. #ifndef _ATOMBIOS_H
  26. #define _ATOMBIOS_H
  27. #define ATOM_VERSION_MAJOR 0x00020000
  28. #define ATOM_VERSION_MINOR 0x00000002
  29. #define ATOM_HEADER_VERSION (ATOM_VERSION_MAJOR | ATOM_VERSION_MINOR)
  30. /* Endianness should be specified before inclusion,
  31. * default to little endian
  32. */
  33. #ifndef ATOM_BIG_ENDIAN
  34. #error Endian not specified
  35. #endif
  36. #ifdef _H2INC
  37. #ifndef ULONG
  38. typedef unsigned long ULONG;
  39. #endif
  40. #ifndef UCHAR
  41. typedef unsigned char UCHAR;
  42. #endif
  43. #ifndef USHORT
  44. typedef unsigned short USHORT;
  45. #endif
  46. #endif
  47. #define ATOM_DAC_A 0
  48. #define ATOM_DAC_B 1
  49. #define ATOM_EXT_DAC 2
  50. #define ATOM_CRTC1 0
  51. #define ATOM_CRTC2 1
  52. #define ATOM_CRTC3 2
  53. #define ATOM_CRTC4 3
  54. #define ATOM_CRTC5 4
  55. #define ATOM_CRTC6 5
  56. #define ATOM_CRTC_INVALID 0xFF
  57. #define ATOM_DIGA 0
  58. #define ATOM_DIGB 1
  59. #define ATOM_PPLL1 0
  60. #define ATOM_PPLL2 1
  61. #define ATOM_DCPLL 2
  62. #define ATOM_PPLL0 2
  63. #define ATOM_EXT_PLL1 8
  64. #define ATOM_EXT_PLL2 9
  65. #define ATOM_EXT_CLOCK 10
  66. #define ATOM_PPLL_INVALID 0xFF
  67. #define ENCODER_REFCLK_SRC_P1PLL 0
  68. #define ENCODER_REFCLK_SRC_P2PLL 1
  69. #define ENCODER_REFCLK_SRC_DCPLL 2
  70. #define ENCODER_REFCLK_SRC_EXTCLK 3
  71. #define ENCODER_REFCLK_SRC_INVALID 0xFF
  72. #define ATOM_SCALER1 0
  73. #define ATOM_SCALER2 1
  74. #define ATOM_SCALER_DISABLE 0
  75. #define ATOM_SCALER_CENTER 1
  76. #define ATOM_SCALER_EXPANSION 2
  77. #define ATOM_SCALER_MULTI_EX 3
  78. #define ATOM_DISABLE 0
  79. #define ATOM_ENABLE 1
  80. #define ATOM_LCD_BLOFF (ATOM_DISABLE+2)
  81. #define ATOM_LCD_BLON (ATOM_ENABLE+2)
  82. #define ATOM_LCD_BL_BRIGHTNESS_CONTROL (ATOM_ENABLE+3)
  83. #define ATOM_LCD_SELFTEST_START (ATOM_DISABLE+5)
  84. #define ATOM_LCD_SELFTEST_STOP (ATOM_ENABLE+5)
  85. #define ATOM_ENCODER_INIT (ATOM_DISABLE+7)
  86. #define ATOM_GET_STATUS (ATOM_DISABLE+8)
  87. #define ATOM_BLANKING 1
  88. #define ATOM_BLANKING_OFF 0
  89. #define ATOM_CURSOR1 0
  90. #define ATOM_CURSOR2 1
  91. #define ATOM_ICON1 0
  92. #define ATOM_ICON2 1
  93. #define ATOM_CRT1 0
  94. #define ATOM_CRT2 1
  95. #define ATOM_TV_NTSC 1
  96. #define ATOM_TV_NTSCJ 2
  97. #define ATOM_TV_PAL 3
  98. #define ATOM_TV_PALM 4
  99. #define ATOM_TV_PALCN 5
  100. #define ATOM_TV_PALN 6
  101. #define ATOM_TV_PAL60 7
  102. #define ATOM_TV_SECAM 8
  103. #define ATOM_TV_CV 16
  104. #define ATOM_DAC1_PS2 1
  105. #define ATOM_DAC1_CV 2
  106. #define ATOM_DAC1_NTSC 3
  107. #define ATOM_DAC1_PAL 4
  108. #define ATOM_DAC2_PS2 ATOM_DAC1_PS2
  109. #define ATOM_DAC2_CV ATOM_DAC1_CV
  110. #define ATOM_DAC2_NTSC ATOM_DAC1_NTSC
  111. #define ATOM_DAC2_PAL ATOM_DAC1_PAL
  112. #define ATOM_PM_ON 0
  113. #define ATOM_PM_STANDBY 1
  114. #define ATOM_PM_SUSPEND 2
  115. #define ATOM_PM_OFF 3
  116. /* Bit0:{=0:single, =1:dual},
  117. Bit1 {=0:666RGB, =1:888RGB},
  118. Bit2:3:{Grey level}
  119. Bit4:{=0:LDI format for RGB888, =1 FPDI format for RGB888}*/
  120. #define ATOM_PANEL_MISC_DUAL 0x00000001
  121. #define ATOM_PANEL_MISC_888RGB 0x00000002
  122. #define ATOM_PANEL_MISC_GREY_LEVEL 0x0000000C
  123. #define ATOM_PANEL_MISC_FPDI 0x00000010
  124. #define ATOM_PANEL_MISC_GREY_LEVEL_SHIFT 2
  125. #define ATOM_PANEL_MISC_SPATIAL 0x00000020
  126. #define ATOM_PANEL_MISC_TEMPORAL 0x00000040
  127. #define ATOM_PANEL_MISC_API_ENABLED 0x00000080
  128. #define MEMTYPE_DDR1 "DDR1"
  129. #define MEMTYPE_DDR2 "DDR2"
  130. #define MEMTYPE_DDR3 "DDR3"
  131. #define MEMTYPE_DDR4 "DDR4"
  132. #define ASIC_BUS_TYPE_PCI "PCI"
  133. #define ASIC_BUS_TYPE_AGP "AGP"
  134. #define ASIC_BUS_TYPE_PCIE "PCI_EXPRESS"
  135. /* Maximum size of that FireGL flag string */
  136. #define ATOM_FIREGL_FLAG_STRING "FGL" //Flag used to enable FireGL Support
  137. #define ATOM_MAX_SIZE_OF_FIREGL_FLAG_STRING 3 //sizeof( ATOM_FIREGL_FLAG_STRING )
  138. #define ATOM_FAKE_DESKTOP_STRING "DSK" //Flag used to enable mobile ASIC on Desktop
  139. #define ATOM_MAX_SIZE_OF_FAKE_DESKTOP_STRING ATOM_MAX_SIZE_OF_FIREGL_FLAG_STRING
  140. #define ATOM_M54T_FLAG_STRING "M54T" //Flag used to enable M54T Support
  141. #define ATOM_MAX_SIZE_OF_M54T_FLAG_STRING 4 //sizeof( ATOM_M54T_FLAG_STRING )
  142. #define HW_ASSISTED_I2C_STATUS_FAILURE 2
  143. #define HW_ASSISTED_I2C_STATUS_SUCCESS 1
  144. #pragma pack(1) /* BIOS data must use byte aligment */
  145. /* Define offset to location of ROM header. */
  146. #define OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER 0x00000048L
  147. #define OFFSET_TO_ATOM_ROM_IMAGE_SIZE 0x00000002L
  148. #define OFFSET_TO_ATOMBIOS_ASIC_BUS_MEM_TYPE 0x94
  149. #define MAXSIZE_OF_ATOMBIOS_ASIC_BUS_MEM_TYPE 20 /* including the terminator 0x0! */
  150. #define OFFSET_TO_GET_ATOMBIOS_STRINGS_NUMBER 0x002f
  151. #define OFFSET_TO_GET_ATOMBIOS_STRINGS_START 0x006e
  152. /* Common header for all ROM Data tables.
  153. Every table pointed _ATOM_MASTER_DATA_TABLE has this common header.
  154. And the pointer actually points to this header. */
  155. typedef struct _ATOM_COMMON_TABLE_HEADER
  156. {
  157. USHORT usStructureSize;
  158. UCHAR ucTableFormatRevision; /*Change it when the Parser is not backward compatible */
  159. UCHAR ucTableContentRevision; /*Change it only when the table needs to change but the firmware */
  160. /*Image can't be updated, while Driver needs to carry the new table! */
  161. }ATOM_COMMON_TABLE_HEADER;
  162. /****************************************************************************/
  163. // Structure stores the ROM header.
  164. /****************************************************************************/
  165. typedef struct _ATOM_ROM_HEADER
  166. {
  167. ATOM_COMMON_TABLE_HEADER sHeader;
  168. UCHAR uaFirmWareSignature[4]; /*Signature to distinguish between Atombios and non-atombios,
  169. atombios should init it as "ATOM", don't change the position */
  170. USHORT usBiosRuntimeSegmentAddress;
  171. USHORT usProtectedModeInfoOffset;
  172. USHORT usConfigFilenameOffset;
  173. USHORT usCRC_BlockOffset;
  174. USHORT usBIOS_BootupMessageOffset;
  175. USHORT usInt10Offset;
  176. USHORT usPciBusDevInitCode;
  177. USHORT usIoBaseAddress;
  178. USHORT usSubsystemVendorID;
  179. USHORT usSubsystemID;
  180. USHORT usPCI_InfoOffset;
  181. USHORT usMasterCommandTableOffset; /*Offset for SW to get all command table offsets, Don't change the position */
  182. USHORT usMasterDataTableOffset; /*Offset for SW to get all data table offsets, Don't change the position */
  183. UCHAR ucExtendedFunctionCode;
  184. UCHAR ucReserved;
  185. }ATOM_ROM_HEADER;
  186. /*==============================Command Table Portion==================================== */
  187. #ifdef UEFI_BUILD
  188. #define UTEMP USHORT
  189. #define USHORT void*
  190. #endif
  191. /****************************************************************************/
  192. // Structures used in Command.mtb
  193. /****************************************************************************/
  194. typedef struct _ATOM_MASTER_LIST_OF_COMMAND_TABLES{
  195. USHORT ASIC_Init; //Function Table, used by various SW components,latest version 1.1
  196. USHORT GetDisplaySurfaceSize; //Atomic Table, Used by Bios when enabling HW ICON
  197. USHORT ASIC_RegistersInit; //Atomic Table, indirectly used by various SW components,called from ASIC_Init
  198. USHORT VRAM_BlockVenderDetection; //Atomic Table, used only by Bios
  199. USHORT DIGxEncoderControl; //Only used by Bios
  200. USHORT MemoryControllerInit; //Atomic Table, indirectly used by various SW components,called from ASIC_Init
  201. USHORT EnableCRTCMemReq; //Function Table,directly used by various SW components,latest version 2.1
  202. USHORT MemoryParamAdjust; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock if needed
  203. USHORT DVOEncoderControl; //Function Table,directly used by various SW components,latest version 1.2
  204. USHORT GPIOPinControl; //Atomic Table, only used by Bios
  205. USHORT SetEngineClock; //Function Table,directly used by various SW components,latest version 1.1
  206. USHORT SetMemoryClock; //Function Table,directly used by various SW components,latest version 1.1
  207. USHORT SetPixelClock; //Function Table,directly used by various SW components,latest version 1.2
  208. USHORT DynamicClockGating; //Atomic Table, indirectly used by various SW components,called from ASIC_Init
  209. USHORT ResetMemoryDLL; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock
  210. USHORT ResetMemoryDevice; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock
  211. USHORT MemoryPLLInit;
  212. USHORT AdjustDisplayPll; //only used by Bios
  213. USHORT AdjustMemoryController; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock
  214. USHORT EnableASIC_StaticPwrMgt; //Atomic Table, only used by Bios
  215. USHORT ASIC_StaticPwrMgtStatusChange; //Obsolete , only used by Bios
  216. USHORT DAC_LoadDetection; //Atomic Table, directly used by various SW components,latest version 1.2
  217. USHORT LVTMAEncoderControl; //Atomic Table,directly used by various SW components,latest version 1.3
  218. USHORT LCD1OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1
  219. USHORT DAC1EncoderControl; //Atomic Table, directly used by various SW components,latest version 1.1
  220. USHORT DAC2EncoderControl; //Atomic Table, directly used by various SW components,latest version 1.1
  221. USHORT DVOOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1
  222. USHORT CV1OutputControl; //Atomic Table, Atomic Table, Obsolete from Ry6xx, use DAC2 Output instead
  223. USHORT GetConditionalGoldenSetting; //only used by Bios
  224. USHORT TVEncoderControl; //Function Table,directly used by various SW components,latest version 1.1
  225. USHORT TMDSAEncoderControl; //Atomic Table, directly used by various SW components,latest version 1.3
  226. USHORT LVDSEncoderControl; //Atomic Table, directly used by various SW components,latest version 1.3
  227. USHORT TV1OutputControl; //Atomic Table, Obsolete from Ry6xx, use DAC2 Output instead
  228. USHORT EnableScaler; //Atomic Table, used only by Bios
  229. USHORT BlankCRTC; //Atomic Table, directly used by various SW components,latest version 1.1
  230. USHORT EnableCRTC; //Atomic Table, directly used by various SW components,latest version 1.1
  231. USHORT GetPixelClock; //Atomic Table, directly used by various SW components,latest version 1.1
  232. USHORT EnableVGA_Render; //Function Table,directly used by various SW components,latest version 1.1
  233. USHORT GetSCLKOverMCLKRatio; //Atomic Table, only used by Bios
  234. USHORT SetCRTC_Timing; //Atomic Table, directly used by various SW components,latest version 1.1
  235. USHORT SetCRTC_OverScan; //Atomic Table, used by various SW components,latest version 1.1
  236. USHORT SetCRTC_Replication; //Atomic Table, used only by Bios
  237. USHORT SelectCRTC_Source; //Atomic Table, directly used by various SW components,latest version 1.1
  238. USHORT EnableGraphSurfaces; //Atomic Table, used only by Bios
  239. USHORT UpdateCRTC_DoubleBufferRegisters;
  240. USHORT LUT_AutoFill; //Atomic Table, only used by Bios
  241. USHORT EnableHW_IconCursor; //Atomic Table, only used by Bios
  242. USHORT GetMemoryClock; //Atomic Table, directly used by various SW components,latest version 1.1
  243. USHORT GetEngineClock; //Atomic Table, directly used by various SW components,latest version 1.1
  244. USHORT SetCRTC_UsingDTDTiming; //Atomic Table, directly used by various SW components,latest version 1.1
  245. USHORT ExternalEncoderControl; //Atomic Table, directly used by various SW components,latest version 2.1
  246. USHORT LVTMAOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1
  247. USHORT VRAM_BlockDetectionByStrap; //Atomic Table, used only by Bios
  248. USHORT MemoryCleanUp; //Atomic Table, only used by Bios
  249. USHORT ProcessI2cChannelTransaction; //Function Table,only used by Bios
  250. USHORT WriteOneByteToHWAssistedI2C; //Function Table,indirectly used by various SW components
  251. USHORT ReadHWAssistedI2CStatus; //Atomic Table, indirectly used by various SW components
  252. USHORT SpeedFanControl; //Function Table,indirectly used by various SW components,called from ASIC_Init
  253. USHORT PowerConnectorDetection; //Atomic Table, directly used by various SW components,latest version 1.1
  254. USHORT MC_Synchronization; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock
  255. USHORT ComputeMemoryEnginePLL; //Atomic Table, indirectly used by various SW components,called from SetMemory/EngineClock
  256. USHORT MemoryRefreshConversion; //Atomic Table, indirectly used by various SW components,called from SetMemory or SetEngineClock
  257. USHORT VRAM_GetCurrentInfoBlock; //Atomic Table, used only by Bios
  258. USHORT DynamicMemorySettings; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock
  259. USHORT MemoryTraining; //Atomic Table, used only by Bios
  260. USHORT EnableSpreadSpectrumOnPPLL; //Atomic Table, directly used by various SW components,latest version 1.2
  261. USHORT TMDSAOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1
  262. USHORT SetVoltage; //Function Table,directly and/or indirectly used by various SW components,latest version 1.1
  263. USHORT DAC1OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1
  264. USHORT DAC2OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1
  265. USHORT SetupHWAssistedI2CStatus; //Function Table,only used by Bios, obsolete soon.Switch to use "ReadEDIDFromHWAssistedI2C"
  266. USHORT ClockSource; //Atomic Table, indirectly used by various SW components,called from ASIC_Init
  267. USHORT MemoryDeviceInit; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock
  268. USHORT EnableYUV; //Atomic Table, indirectly used by various SW components,called from EnableVGARender
  269. USHORT DIG1EncoderControl; //Atomic Table,directly used by various SW components,latest version 1.1
  270. USHORT DIG2EncoderControl; //Atomic Table,directly used by various SW components,latest version 1.1
  271. USHORT DIG1TransmitterControl; //Atomic Table,directly used by various SW components,latest version 1.1
  272. USHORT DIG2TransmitterControl; //Atomic Table,directly used by various SW components,latest version 1.1
  273. USHORT ProcessAuxChannelTransaction; //Function Table,only used by Bios
  274. USHORT DPEncoderService; //Function Table,only used by Bios
  275. }ATOM_MASTER_LIST_OF_COMMAND_TABLES;
  276. // For backward compatible
  277. #define ReadEDIDFromHWAssistedI2C ProcessI2cChannelTransaction
  278. #define UNIPHYTransmitterControl DIG1TransmitterControl
  279. #define LVTMATransmitterControl DIG2TransmitterControl
  280. #define SetCRTC_DPM_State GetConditionalGoldenSetting
  281. #define SetUniphyInstance ASIC_StaticPwrMgtStatusChange
  282. #define HPDInterruptService ReadHWAssistedI2CStatus
  283. #define EnableVGA_Access GetSCLKOverMCLKRatio
  284. #define GetDispObjectInfo EnableYUV
  285. typedef struct _ATOM_MASTER_COMMAND_TABLE
  286. {
  287. ATOM_COMMON_TABLE_HEADER sHeader;
  288. ATOM_MASTER_LIST_OF_COMMAND_TABLES ListOfCommandTables;
  289. }ATOM_MASTER_COMMAND_TABLE;
  290. /****************************************************************************/
  291. // Structures used in every command table
  292. /****************************************************************************/
  293. typedef struct _ATOM_TABLE_ATTRIBUTE
  294. {
  295. #if ATOM_BIG_ENDIAN
  296. USHORT UpdatedByUtility:1; //[15]=Table updated by utility flag
  297. USHORT PS_SizeInBytes:7; //[14:8]=Size of parameter space in Bytes (multiple of a dword),
  298. USHORT WS_SizeInBytes:8; //[7:0]=Size of workspace in Bytes (in multiple of a dword),
  299. #else
  300. USHORT WS_SizeInBytes:8; //[7:0]=Size of workspace in Bytes (in multiple of a dword),
  301. USHORT PS_SizeInBytes:7; //[14:8]=Size of parameter space in Bytes (multiple of a dword),
  302. USHORT UpdatedByUtility:1; //[15]=Table updated by utility flag
  303. #endif
  304. }ATOM_TABLE_ATTRIBUTE;
  305. typedef union _ATOM_TABLE_ATTRIBUTE_ACCESS
  306. {
  307. ATOM_TABLE_ATTRIBUTE sbfAccess;
  308. USHORT susAccess;
  309. }ATOM_TABLE_ATTRIBUTE_ACCESS;
  310. /****************************************************************************/
  311. // Common header for all command tables.
  312. // Every table pointed by _ATOM_MASTER_COMMAND_TABLE has this common header.
  313. // And the pointer actually points to this header.
  314. /****************************************************************************/
  315. typedef struct _ATOM_COMMON_ROM_COMMAND_TABLE_HEADER
  316. {
  317. ATOM_COMMON_TABLE_HEADER CommonHeader;
  318. ATOM_TABLE_ATTRIBUTE TableAttribute;
  319. }ATOM_COMMON_ROM_COMMAND_TABLE_HEADER;
  320. /****************************************************************************/
  321. // Structures used by ComputeMemoryEnginePLLTable
  322. /****************************************************************************/
  323. #define COMPUTE_MEMORY_PLL_PARAM 1
  324. #define COMPUTE_ENGINE_PLL_PARAM 2
  325. #define ADJUST_MC_SETTING_PARAM 3
  326. /****************************************************************************/
  327. // Structures used by AdjustMemoryControllerTable
  328. /****************************************************************************/
  329. typedef struct _ATOM_ADJUST_MEMORY_CLOCK_FREQ
  330. {
  331. #if ATOM_BIG_ENDIAN
  332. ULONG ulPointerReturnFlag:1; // BYTE_3[7]=1 - Return the pointer to the right Data Block; BYTE_3[7]=0 - Program the right Data Block
  333. ULONG ulMemoryModuleNumber:7; // BYTE_3[6:0]
  334. ULONG ulClockFreq:24;
  335. #else
  336. ULONG ulClockFreq:24;
  337. ULONG ulMemoryModuleNumber:7; // BYTE_3[6:0]
  338. ULONG ulPointerReturnFlag:1; // BYTE_3[7]=1 - Return the pointer to the right Data Block; BYTE_3[7]=0 - Program the right Data Block
  339. #endif
  340. }ATOM_ADJUST_MEMORY_CLOCK_FREQ;
  341. #define POINTER_RETURN_FLAG 0x80
  342. typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS
  343. {
  344. ULONG ulClock; //When returen, it's the re-calculated clock based on given Fb_div Post_Div and ref_div
  345. UCHAR ucAction; //0:reserved //1:Memory //2:Engine
  346. UCHAR ucReserved; //may expand to return larger Fbdiv later
  347. UCHAR ucFbDiv; //return value
  348. UCHAR ucPostDiv; //return value
  349. }COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS;
  350. typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V2
  351. {
  352. ULONG ulClock; //When return, [23:0] return real clock
  353. UCHAR ucAction; //0:reserved;COMPUTE_MEMORY_PLL_PARAM:Memory;COMPUTE_ENGINE_PLL_PARAM:Engine. it return ref_div to be written to register
  354. USHORT usFbDiv; //return Feedback value to be written to register
  355. UCHAR ucPostDiv; //return post div to be written to register
  356. }COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V2;
  357. #define COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS
  358. #define SET_CLOCK_FREQ_MASK 0x00FFFFFF //Clock change tables only take bit [23:0] as the requested clock value
  359. #define USE_NON_BUS_CLOCK_MASK 0x01000000 //Applicable to both memory and engine clock change, when set, it uses another clock as the temporary clock (engine uses memory and vice versa)
  360. #define USE_MEMORY_SELF_REFRESH_MASK 0x02000000 //Only applicable to memory clock change, when set, using memory self refresh during clock transition
  361. #define SKIP_INTERNAL_MEMORY_PARAMETER_CHANGE 0x04000000 //Only applicable to memory clock change, when set, the table will skip predefined internal memory parameter change
  362. #define FIRST_TIME_CHANGE_CLOCK 0x08000000 //Applicable to both memory and engine clock change,when set, it means this is 1st time to change clock after ASIC bootup
  363. #define SKIP_SW_PROGRAM_PLL 0x10000000 //Applicable to both memory and engine clock change, when set, it means the table will not program SPLL/MPLL
  364. #define USE_SS_ENABLED_PIXEL_CLOCK USE_NON_BUS_CLOCK_MASK
  365. #define b3USE_NON_BUS_CLOCK_MASK 0x01 //Applicable to both memory and engine clock change, when set, it uses another clock as the temporary clock (engine uses memory and vice versa)
  366. #define b3USE_MEMORY_SELF_REFRESH 0x02 //Only applicable to memory clock change, when set, using memory self refresh during clock transition
  367. #define b3SKIP_INTERNAL_MEMORY_PARAMETER_CHANGE 0x04 //Only applicable to memory clock change, when set, the table will skip predefined internal memory parameter change
  368. #define b3FIRST_TIME_CHANGE_CLOCK 0x08 //Applicable to both memory and engine clock change,when set, it means this is 1st time to change clock after ASIC bootup
  369. #define b3SKIP_SW_PROGRAM_PLL 0x10 //Applicable to both memory and engine clock change, when set, it means the table will not program SPLL/MPLL
  370. typedef struct _ATOM_COMPUTE_CLOCK_FREQ
  371. {
  372. #if ATOM_BIG_ENDIAN
  373. ULONG ulComputeClockFlag:8; // =1: COMPUTE_MEMORY_PLL_PARAM, =2: COMPUTE_ENGINE_PLL_PARAM
  374. ULONG ulClockFreq:24; // in unit of 10kHz
  375. #else
  376. ULONG ulClockFreq:24; // in unit of 10kHz
  377. ULONG ulComputeClockFlag:8; // =1: COMPUTE_MEMORY_PLL_PARAM, =2: COMPUTE_ENGINE_PLL_PARAM
  378. #endif
  379. }ATOM_COMPUTE_CLOCK_FREQ;
  380. typedef struct _ATOM_S_MPLL_FB_DIVIDER
  381. {
  382. USHORT usFbDivFrac;
  383. USHORT usFbDiv;
  384. }ATOM_S_MPLL_FB_DIVIDER;
  385. typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V3
  386. {
  387. union
  388. {
  389. ATOM_COMPUTE_CLOCK_FREQ ulClock; //Input Parameter
  390. ATOM_S_MPLL_FB_DIVIDER ulFbDiv; //Output Parameter
  391. };
  392. UCHAR ucRefDiv; //Output Parameter
  393. UCHAR ucPostDiv; //Output Parameter
  394. UCHAR ucCntlFlag; //Output Parameter
  395. UCHAR ucReserved;
  396. }COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V3;
  397. // ucCntlFlag
  398. #define ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN 1
  399. #define ATOM_PLL_CNTL_FLAG_MPLL_VCO_MODE 2
  400. #define ATOM_PLL_CNTL_FLAG_FRACTION_DISABLE 4
  401. #define ATOM_PLL_CNTL_FLAG_SPLL_ISPARE_9 8
  402. // V4 are only used for APU which PLL outside GPU
  403. typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V4
  404. {
  405. #if ATOM_BIG_ENDIAN
  406. ULONG ucPostDiv; //return parameter: post divider which is used to program to register directly
  407. ULONG ulClock:24; //Input= target clock, output = actual clock
  408. #else
  409. ULONG ulClock:24; //Input= target clock, output = actual clock
  410. ULONG ucPostDiv; //return parameter: post divider which is used to program to register directly
  411. #endif
  412. }COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V4;
  413. typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5
  414. {
  415. union
  416. {
  417. ATOM_COMPUTE_CLOCK_FREQ ulClock; //Input Parameter
  418. ATOM_S_MPLL_FB_DIVIDER ulFbDiv; //Output Parameter
  419. };
  420. UCHAR ucRefDiv; //Output Parameter
  421. UCHAR ucPostDiv; //Output Parameter
  422. union
  423. {
  424. UCHAR ucCntlFlag; //Output Flags
  425. UCHAR ucInputFlag; //Input Flags. ucInputFlag[0] - Strobe(1)/Performance(0) mode
  426. };
  427. UCHAR ucReserved;
  428. }COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5;
  429. // ucInputFlag
  430. #define ATOM_PLL_INPUT_FLAG_PLL_STROBE_MODE_EN 1 // 1-StrobeMode, 0-PerformanceMode
  431. typedef struct _DYNAMICE_MEMORY_SETTINGS_PARAMETER
  432. {
  433. ATOM_COMPUTE_CLOCK_FREQ ulClock;
  434. ULONG ulReserved[2];
  435. }DYNAMICE_MEMORY_SETTINGS_PARAMETER;
  436. typedef struct _DYNAMICE_ENGINE_SETTINGS_PARAMETER
  437. {
  438. ATOM_COMPUTE_CLOCK_FREQ ulClock;
  439. ULONG ulMemoryClock;
  440. ULONG ulReserved;
  441. }DYNAMICE_ENGINE_SETTINGS_PARAMETER;
  442. /****************************************************************************/
  443. // Structures used by SetEngineClockTable
  444. /****************************************************************************/
  445. typedef struct _SET_ENGINE_CLOCK_PARAMETERS
  446. {
  447. ULONG ulTargetEngineClock; //In 10Khz unit
  448. }SET_ENGINE_CLOCK_PARAMETERS;
  449. typedef struct _SET_ENGINE_CLOCK_PS_ALLOCATION
  450. {
  451. ULONG ulTargetEngineClock; //In 10Khz unit
  452. COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION sReserved;
  453. }SET_ENGINE_CLOCK_PS_ALLOCATION;
  454. /****************************************************************************/
  455. // Structures used by SetMemoryClockTable
  456. /****************************************************************************/
  457. typedef struct _SET_MEMORY_CLOCK_PARAMETERS
  458. {
  459. ULONG ulTargetMemoryClock; //In 10Khz unit
  460. }SET_MEMORY_CLOCK_PARAMETERS;
  461. typedef struct _SET_MEMORY_CLOCK_PS_ALLOCATION
  462. {
  463. ULONG ulTargetMemoryClock; //In 10Khz unit
  464. COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION sReserved;
  465. }SET_MEMORY_CLOCK_PS_ALLOCATION;
  466. /****************************************************************************/
  467. // Structures used by ASIC_Init.ctb
  468. /****************************************************************************/
  469. typedef struct _ASIC_INIT_PARAMETERS
  470. {
  471. ULONG ulDefaultEngineClock; //In 10Khz unit
  472. ULONG ulDefaultMemoryClock; //In 10Khz unit
  473. }ASIC_INIT_PARAMETERS;
  474. typedef struct _ASIC_INIT_PS_ALLOCATION
  475. {
  476. ASIC_INIT_PARAMETERS sASICInitClocks;
  477. SET_ENGINE_CLOCK_PS_ALLOCATION sReserved; //Caller doesn't need to init this structure
  478. }ASIC_INIT_PS_ALLOCATION;
  479. /****************************************************************************/
  480. // Structure used by DynamicClockGatingTable.ctb
  481. /****************************************************************************/
  482. typedef struct _DYNAMIC_CLOCK_GATING_PARAMETERS
  483. {
  484. UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE
  485. UCHAR ucPadding[3];
  486. }DYNAMIC_CLOCK_GATING_PARAMETERS;
  487. #define DYNAMIC_CLOCK_GATING_PS_ALLOCATION DYNAMIC_CLOCK_GATING_PARAMETERS
  488. /****************************************************************************/
  489. // Structure used by EnableASIC_StaticPwrMgtTable.ctb
  490. /****************************************************************************/
  491. typedef struct _ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS
  492. {
  493. UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE
  494. UCHAR ucPadding[3];
  495. }ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS;
  496. #define ENABLE_ASIC_STATIC_PWR_MGT_PS_ALLOCATION ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS
  497. /****************************************************************************/
  498. // Structures used by DAC_LoadDetectionTable.ctb
  499. /****************************************************************************/
  500. typedef struct _DAC_LOAD_DETECTION_PARAMETERS
  501. {
  502. USHORT usDeviceID; //{ATOM_DEVICE_CRTx_SUPPORT,ATOM_DEVICE_TVx_SUPPORT,ATOM_DEVICE_CVx_SUPPORT}
  503. UCHAR ucDacType; //{ATOM_DAC_A,ATOM_DAC_B, ATOM_EXT_DAC}
  504. UCHAR ucMisc; //Valid only when table revision =1.3 and above
  505. }DAC_LOAD_DETECTION_PARAMETERS;
  506. // DAC_LOAD_DETECTION_PARAMETERS.ucMisc
  507. #define DAC_LOAD_MISC_YPrPb 0x01
  508. typedef struct _DAC_LOAD_DETECTION_PS_ALLOCATION
  509. {
  510. DAC_LOAD_DETECTION_PARAMETERS sDacload;
  511. ULONG Reserved[2];// Don't set this one, allocation for EXT DAC
  512. }DAC_LOAD_DETECTION_PS_ALLOCATION;
  513. /****************************************************************************/
  514. // Structures used by DAC1EncoderControlTable.ctb and DAC2EncoderControlTable.ctb
  515. /****************************************************************************/
  516. typedef struct _DAC_ENCODER_CONTROL_PARAMETERS
  517. {
  518. USHORT usPixelClock; // in 10KHz; for bios convenient
  519. UCHAR ucDacStandard; // See definition of ATOM_DACx_xxx, For DEC3.0, bit 7 used as internal flag to indicate DAC2 (==1) or DAC1 (==0)
  520. UCHAR ucAction; // 0: turn off encoder
  521. // 1: setup and turn on encoder
  522. // 7: ATOM_ENCODER_INIT Initialize DAC
  523. }DAC_ENCODER_CONTROL_PARAMETERS;
  524. #define DAC_ENCODER_CONTROL_PS_ALLOCATION DAC_ENCODER_CONTROL_PARAMETERS
  525. /****************************************************************************/
  526. // Structures used by DIG1EncoderControlTable
  527. // DIG2EncoderControlTable
  528. // ExternalEncoderControlTable
  529. /****************************************************************************/
  530. typedef struct _DIG_ENCODER_CONTROL_PARAMETERS
  531. {
  532. USHORT usPixelClock; // in 10KHz; for bios convenient
  533. UCHAR ucConfig;
  534. // [2] Link Select:
  535. // =0: PHY linkA if bfLane<3
  536. // =1: PHY linkB if bfLanes<3
  537. // =0: PHY linkA+B if bfLanes=3
  538. // [3] Transmitter Sel
  539. // =0: UNIPHY or PCIEPHY
  540. // =1: LVTMA
  541. UCHAR ucAction; // =0: turn off encoder
  542. // =1: turn on encoder
  543. UCHAR ucEncoderMode;
  544. // =0: DP encoder
  545. // =1: LVDS encoder
  546. // =2: DVI encoder
  547. // =3: HDMI encoder
  548. // =4: SDVO encoder
  549. UCHAR ucLaneNum; // how many lanes to enable
  550. UCHAR ucReserved[2];
  551. }DIG_ENCODER_CONTROL_PARAMETERS;
  552. #define DIG_ENCODER_CONTROL_PS_ALLOCATION DIG_ENCODER_CONTROL_PARAMETERS
  553. #define EXTERNAL_ENCODER_CONTROL_PARAMETER DIG_ENCODER_CONTROL_PARAMETERS
  554. //ucConfig
  555. #define ATOM_ENCODER_CONFIG_DPLINKRATE_MASK 0x01
  556. #define ATOM_ENCODER_CONFIG_DPLINKRATE_1_62GHZ 0x00
  557. #define ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ 0x01
  558. #define ATOM_ENCODER_CONFIG_DPLINKRATE_5_40GHZ 0x02
  559. #define ATOM_ENCODER_CONFIG_LINK_SEL_MASK 0x04
  560. #define ATOM_ENCODER_CONFIG_LINKA 0x00
  561. #define ATOM_ENCODER_CONFIG_LINKB 0x04
  562. #define ATOM_ENCODER_CONFIG_LINKA_B ATOM_TRANSMITTER_CONFIG_LINKA
  563. #define ATOM_ENCODER_CONFIG_LINKB_A ATOM_ENCODER_CONFIG_LINKB
  564. #define ATOM_ENCODER_CONFIG_TRANSMITTER_SEL_MASK 0x08
  565. #define ATOM_ENCODER_CONFIG_UNIPHY 0x00
  566. #define ATOM_ENCODER_CONFIG_LVTMA 0x08
  567. #define ATOM_ENCODER_CONFIG_TRANSMITTER1 0x00
  568. #define ATOM_ENCODER_CONFIG_TRANSMITTER2 0x08
  569. #define ATOM_ENCODER_CONFIG_DIGB 0x80 // VBIOS Internal use, outside SW should set this bit=0
  570. // ucAction
  571. // ATOM_ENABLE: Enable Encoder
  572. // ATOM_DISABLE: Disable Encoder
  573. //ucEncoderMode
  574. #define ATOM_ENCODER_MODE_DP 0
  575. #define ATOM_ENCODER_MODE_LVDS 1
  576. #define ATOM_ENCODER_MODE_DVI 2
  577. #define ATOM_ENCODER_MODE_HDMI 3
  578. #define ATOM_ENCODER_MODE_SDVO 4
  579. #define ATOM_ENCODER_MODE_DP_AUDIO 5
  580. #define ATOM_ENCODER_MODE_TV 13
  581. #define ATOM_ENCODER_MODE_CV 14
  582. #define ATOM_ENCODER_MODE_CRT 15
  583. #define ATOM_ENCODER_MODE_DVO 16
  584. #define ATOM_ENCODER_MODE_DP_SST ATOM_ENCODER_MODE_DP // For DP1.2
  585. #define ATOM_ENCODER_MODE_DP_MST 5 // For DP1.2
  586. typedef struct _ATOM_DIG_ENCODER_CONFIG_V2
  587. {
  588. #if ATOM_BIG_ENDIAN
  589. UCHAR ucReserved1:2;
  590. UCHAR ucTransmitterSel:2; // =0: UniphyAB, =1: UniphyCD =2: UniphyEF
  591. UCHAR ucLinkSel:1; // =0: linkA/C/E =1: linkB/D/F
  592. UCHAR ucReserved:1;
  593. UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz
  594. #else
  595. UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz
  596. UCHAR ucReserved:1;
  597. UCHAR ucLinkSel:1; // =0: linkA/C/E =1: linkB/D/F
  598. UCHAR ucTransmitterSel:2; // =0: UniphyAB, =1: UniphyCD =2: UniphyEF
  599. UCHAR ucReserved1:2;
  600. #endif
  601. }ATOM_DIG_ENCODER_CONFIG_V2;
  602. typedef struct _DIG_ENCODER_CONTROL_PARAMETERS_V2
  603. {
  604. USHORT usPixelClock; // in 10KHz; for bios convenient
  605. ATOM_DIG_ENCODER_CONFIG_V2 acConfig;
  606. UCHAR ucAction;
  607. UCHAR ucEncoderMode;
  608. // =0: DP encoder
  609. // =1: LVDS encoder
  610. // =2: DVI encoder
  611. // =3: HDMI encoder
  612. // =4: SDVO encoder
  613. UCHAR ucLaneNum; // how many lanes to enable
  614. UCHAR ucStatus; // = DP_LINK_TRAINING_COMPLETE or DP_LINK_TRAINING_INCOMPLETE, only used by VBIOS with command ATOM_ENCODER_CMD_QUERY_DP_LINK_TRAINING_STATUS
  615. UCHAR ucReserved;
  616. }DIG_ENCODER_CONTROL_PARAMETERS_V2;
  617. //ucConfig
  618. #define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_MASK 0x01
  619. #define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_1_62GHZ 0x00
  620. #define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_2_70GHZ 0x01
  621. #define ATOM_ENCODER_CONFIG_V2_LINK_SEL_MASK 0x04
  622. #define ATOM_ENCODER_CONFIG_V2_LINKA 0x00
  623. #define ATOM_ENCODER_CONFIG_V2_LINKB 0x04
  624. #define ATOM_ENCODER_CONFIG_V2_TRANSMITTER_SEL_MASK 0x18
  625. #define ATOM_ENCODER_CONFIG_V2_TRANSMITTER1 0x00
  626. #define ATOM_ENCODER_CONFIG_V2_TRANSMITTER2 0x08
  627. #define ATOM_ENCODER_CONFIG_V2_TRANSMITTER3 0x10
  628. // ucAction:
  629. // ATOM_DISABLE
  630. // ATOM_ENABLE
  631. #define ATOM_ENCODER_CMD_DP_LINK_TRAINING_START 0x08
  632. #define ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN1 0x09
  633. #define ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN2 0x0a
  634. #define ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN3 0x13
  635. #define ATOM_ENCODER_CMD_DP_LINK_TRAINING_COMPLETE 0x0b
  636. #define ATOM_ENCODER_CMD_DP_VIDEO_OFF 0x0c
  637. #define ATOM_ENCODER_CMD_DP_VIDEO_ON 0x0d
  638. #define ATOM_ENCODER_CMD_QUERY_DP_LINK_TRAINING_STATUS 0x0e
  639. #define ATOM_ENCODER_CMD_SETUP 0x0f
  640. #define ATOM_ENCODER_CMD_SETUP_PANEL_MODE 0x10
  641. // ucStatus
  642. #define ATOM_ENCODER_STATUS_LINK_TRAINING_COMPLETE 0x10
  643. #define ATOM_ENCODER_STATUS_LINK_TRAINING_INCOMPLETE 0x00
  644. //ucTableFormatRevision=1
  645. //ucTableContentRevision=3
  646. // Following function ENABLE sub-function will be used by driver when TMDS/HDMI/LVDS is used, disable function will be used by driver
  647. typedef struct _ATOM_DIG_ENCODER_CONFIG_V3
  648. {
  649. #if ATOM_BIG_ENDIAN
  650. UCHAR ucReserved1:1;
  651. UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F)
  652. UCHAR ucReserved:3;
  653. UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz
  654. #else
  655. UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz
  656. UCHAR ucReserved:3;
  657. UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F)
  658. UCHAR ucReserved1:1;
  659. #endif
  660. }ATOM_DIG_ENCODER_CONFIG_V3;
  661. #define ATOM_ENCODER_CONFIG_V3_DPLINKRATE_MASK 0x03
  662. #define ATOM_ENCODER_CONFIG_V3_DPLINKRATE_1_62GHZ 0x00
  663. #define ATOM_ENCODER_CONFIG_V3_DPLINKRATE_2_70GHZ 0x01
  664. #define ATOM_ENCODER_CONFIG_V3_ENCODER_SEL 0x70
  665. #define ATOM_ENCODER_CONFIG_V3_DIG0_ENCODER 0x00
  666. #define ATOM_ENCODER_CONFIG_V3_DIG1_ENCODER 0x10
  667. #define ATOM_ENCODER_CONFIG_V3_DIG2_ENCODER 0x20
  668. #define ATOM_ENCODER_CONFIG_V3_DIG3_ENCODER 0x30
  669. #define ATOM_ENCODER_CONFIG_V3_DIG4_ENCODER 0x40
  670. #define ATOM_ENCODER_CONFIG_V3_DIG5_ENCODER 0x50
  671. typedef struct _DIG_ENCODER_CONTROL_PARAMETERS_V3
  672. {
  673. USHORT usPixelClock; // in 10KHz; for bios convenient
  674. ATOM_DIG_ENCODER_CONFIG_V3 acConfig;
  675. UCHAR ucAction;
  676. union {
  677. UCHAR ucEncoderMode;
  678. // =0: DP encoder
  679. // =1: LVDS encoder
  680. // =2: DVI encoder
  681. // =3: HDMI encoder
  682. // =4: SDVO encoder
  683. // =5: DP audio
  684. UCHAR ucPanelMode; // only valid when ucAction == ATOM_ENCODER_CMD_SETUP_PANEL_MODE
  685. // =0: external DP
  686. // =1: internal DP2
  687. // =0x11: internal DP1 for NutMeg/Travis DP translator
  688. };
  689. UCHAR ucLaneNum; // how many lanes to enable
  690. UCHAR ucBitPerColor; // only valid for DP mode when ucAction = ATOM_ENCODER_CMD_SETUP
  691. UCHAR ucReserved;
  692. }DIG_ENCODER_CONTROL_PARAMETERS_V3;
  693. //ucTableFormatRevision=1
  694. //ucTableContentRevision=4
  695. // start from NI
  696. // Following function ENABLE sub-function will be used by driver when TMDS/HDMI/LVDS is used, disable function will be used by driver
  697. typedef struct _ATOM_DIG_ENCODER_CONFIG_V4
  698. {
  699. #if ATOM_BIG_ENDIAN
  700. UCHAR ucReserved1:1;
  701. UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F)
  702. UCHAR ucReserved:2;
  703. UCHAR ucDPLinkRate:2; // =0: 1.62Ghz, =1: 2.7Ghz, 2=5.4Ghz <= Changed comparing to previous version
  704. #else
  705. UCHAR ucDPLinkRate:2; // =0: 1.62Ghz, =1: 2.7Ghz, 2=5.4Ghz <= Changed comparing to previous version
  706. UCHAR ucReserved:2;
  707. UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F)
  708. UCHAR ucReserved1:1;
  709. #endif
  710. }ATOM_DIG_ENCODER_CONFIG_V4;
  711. #define ATOM_ENCODER_CONFIG_V4_DPLINKRATE_MASK 0x03
  712. #define ATOM_ENCODER_CONFIG_V4_DPLINKRATE_1_62GHZ 0x00
  713. #define ATOM_ENCODER_CONFIG_V4_DPLINKRATE_2_70GHZ 0x01
  714. #define ATOM_ENCODER_CONFIG_V4_DPLINKRATE_5_40GHZ 0x02
  715. #define ATOM_ENCODER_CONFIG_V4_ENCODER_SEL 0x70
  716. #define ATOM_ENCODER_CONFIG_V4_DIG0_ENCODER 0x00
  717. #define ATOM_ENCODER_CONFIG_V4_DIG1_ENCODER 0x10
  718. #define ATOM_ENCODER_CONFIG_V4_DIG2_ENCODER 0x20
  719. #define ATOM_ENCODER_CONFIG_V4_DIG3_ENCODER 0x30
  720. #define ATOM_ENCODER_CONFIG_V4_DIG4_ENCODER 0x40
  721. #define ATOM_ENCODER_CONFIG_V4_DIG5_ENCODER 0x50
  722. typedef struct _DIG_ENCODER_CONTROL_PARAMETERS_V4
  723. {
  724. USHORT usPixelClock; // in 10KHz; for bios convenient
  725. union{
  726. ATOM_DIG_ENCODER_CONFIG_V4 acConfig;
  727. UCHAR ucConfig;
  728. };
  729. UCHAR ucAction;
  730. union {
  731. UCHAR ucEncoderMode;
  732. // =0: DP encoder
  733. // =1: LVDS encoder
  734. // =2: DVI encoder
  735. // =3: HDMI encoder
  736. // =4: SDVO encoder
  737. // =5: DP audio
  738. UCHAR ucPanelMode; // only valid when ucAction == ATOM_ENCODER_CMD_SETUP_PANEL_MODE
  739. // =0: external DP
  740. // =1: internal DP2
  741. // =0x11: internal DP1 for NutMeg/Travis DP translator
  742. };
  743. UCHAR ucLaneNum; // how many lanes to enable
  744. UCHAR ucBitPerColor; // only valid for DP mode when ucAction = ATOM_ENCODER_CMD_SETUP
  745. UCHAR ucHPD_ID; // HPD ID (1-6). =0 means to skip HDP programming. New comparing to previous version
  746. }DIG_ENCODER_CONTROL_PARAMETERS_V4;
  747. // define ucBitPerColor:
  748. #define PANEL_BPC_UNDEFINE 0x00
  749. #define PANEL_6BIT_PER_COLOR 0x01
  750. #define PANEL_8BIT_PER_COLOR 0x02
  751. #define PANEL_10BIT_PER_COLOR 0x03
  752. #define PANEL_12BIT_PER_COLOR 0x04
  753. #define PANEL_16BIT_PER_COLOR 0x05
  754. //define ucPanelMode
  755. #define DP_PANEL_MODE_EXTERNAL_DP_MODE 0x00
  756. #define DP_PANEL_MODE_INTERNAL_DP2_MODE 0x01
  757. #define DP_PANEL_MODE_INTERNAL_DP1_MODE 0x11
  758. /****************************************************************************/
  759. // Structures used by UNIPHYTransmitterControlTable
  760. // LVTMATransmitterControlTable
  761. // DVOOutputControlTable
  762. /****************************************************************************/
  763. typedef struct _ATOM_DP_VS_MODE
  764. {
  765. UCHAR ucLaneSel;
  766. UCHAR ucLaneSet;
  767. }ATOM_DP_VS_MODE;
  768. typedef struct _DIG_TRANSMITTER_CONTROL_PARAMETERS
  769. {
  770. union
  771. {
  772. USHORT usPixelClock; // in 10KHz; for bios convenient
  773. USHORT usInitInfo; // when init uniphy,lower 8bit is used for connector type defined in objectid.h
  774. ATOM_DP_VS_MODE asMode; // DP Voltage swing mode
  775. };
  776. UCHAR ucConfig;
  777. // [0]=0: 4 lane Link,
  778. // =1: 8 lane Link ( Dual Links TMDS )
  779. // [1]=0: InCoherent mode
  780. // =1: Coherent Mode
  781. // [2] Link Select:
  782. // =0: PHY linkA if bfLane<3
  783. // =1: PHY linkB if bfLanes<3
  784. // =0: PHY linkA+B if bfLanes=3
  785. // [5:4]PCIE lane Sel
  786. // =0: lane 0~3 or 0~7
  787. // =1: lane 4~7
  788. // =2: lane 8~11 or 8~15
  789. // =3: lane 12~15
  790. UCHAR ucAction; // =0: turn off encoder
  791. // =1: turn on encoder
  792. UCHAR ucReserved[4];
  793. }DIG_TRANSMITTER_CONTROL_PARAMETERS;
  794. #define DIG_TRANSMITTER_CONTROL_PS_ALLOCATION DIG_TRANSMITTER_CONTROL_PARAMETERS
  795. //ucInitInfo
  796. #define ATOM_TRAMITTER_INITINFO_CONNECTOR_MASK 0x00ff
  797. //ucConfig
  798. #define ATOM_TRANSMITTER_CONFIG_8LANE_LINK 0x01
  799. #define ATOM_TRANSMITTER_CONFIG_COHERENT 0x02
  800. #define ATOM_TRANSMITTER_CONFIG_LINK_SEL_MASK 0x04
  801. #define ATOM_TRANSMITTER_CONFIG_LINKA 0x00
  802. #define ATOM_TRANSMITTER_CONFIG_LINKB 0x04
  803. #define ATOM_TRANSMITTER_CONFIG_LINKA_B 0x00
  804. #define ATOM_TRANSMITTER_CONFIG_LINKB_A 0x04
  805. #define ATOM_TRANSMITTER_CONFIG_ENCODER_SEL_MASK 0x08 // only used when ATOM_TRANSMITTER_ACTION_ENABLE
  806. #define ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER 0x00 // only used when ATOM_TRANSMITTER_ACTION_ENABLE
  807. #define ATOM_TRANSMITTER_CONFIG_DIG2_ENCODER 0x08 // only used when ATOM_TRANSMITTER_ACTION_ENABLE
  808. #define ATOM_TRANSMITTER_CONFIG_CLKSRC_MASK 0x30
  809. #define ATOM_TRANSMITTER_CONFIG_CLKSRC_PPLL 0x00
  810. #define ATOM_TRANSMITTER_CONFIG_CLKSRC_PCIE 0x20
  811. #define ATOM_TRANSMITTER_CONFIG_CLKSRC_XTALIN 0x30
  812. #define ATOM_TRANSMITTER_CONFIG_LANE_SEL_MASK 0xc0
  813. #define ATOM_TRANSMITTER_CONFIG_LANE_0_3 0x00
  814. #define ATOM_TRANSMITTER_CONFIG_LANE_0_7 0x00
  815. #define ATOM_TRANSMITTER_CONFIG_LANE_4_7 0x40
  816. #define ATOM_TRANSMITTER_CONFIG_LANE_8_11 0x80
  817. #define ATOM_TRANSMITTER_CONFIG_LANE_8_15 0x80
  818. #define ATOM_TRANSMITTER_CONFIG_LANE_12_15 0xc0
  819. //ucAction
  820. #define ATOM_TRANSMITTER_ACTION_DISABLE 0
  821. #define ATOM_TRANSMITTER_ACTION_ENABLE 1
  822. #define ATOM_TRANSMITTER_ACTION_LCD_BLOFF 2
  823. #define ATOM_TRANSMITTER_ACTION_LCD_BLON 3
  824. #define ATOM_TRANSMITTER_ACTION_BL_BRIGHTNESS_CONTROL 4
  825. #define ATOM_TRANSMITTER_ACTION_LCD_SELFTEST_START 5
  826. #define ATOM_TRANSMITTER_ACTION_LCD_SELFTEST_STOP 6
  827. #define ATOM_TRANSMITTER_ACTION_INIT 7
  828. #define ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT 8
  829. #define ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT 9
  830. #define ATOM_TRANSMITTER_ACTION_SETUP 10
  831. #define ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH 11
  832. #define ATOM_TRANSMITTER_ACTION_POWER_ON 12
  833. #define ATOM_TRANSMITTER_ACTION_POWER_OFF 13
  834. // Following are used for DigTransmitterControlTable ver1.2
  835. typedef struct _ATOM_DIG_TRANSMITTER_CONFIG_V2
  836. {
  837. #if ATOM_BIG_ENDIAN
  838. UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB )
  839. // =1 Dig Transmitter 2 ( Uniphy CD )
  840. // =2 Dig Transmitter 3 ( Uniphy EF )
  841. UCHAR ucReserved:1;
  842. UCHAR fDPConnector:1; //bit4=0: DP connector =1: None DP connector
  843. UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA( DIG inst0 ). =1: Data/clk path source from DIGB ( DIG inst1 )
  844. UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E
  845. // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F
  846. UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode )
  847. UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector
  848. #else
  849. UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector
  850. UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode )
  851. UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E
  852. // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F
  853. UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA( DIG inst0 ). =1: Data/clk path source from DIGB ( DIG inst1 )
  854. UCHAR fDPConnector:1; //bit4=0: DP connector =1: None DP connector
  855. UCHAR ucReserved:1;
  856. UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB )
  857. // =1 Dig Transmitter 2 ( Uniphy CD )
  858. // =2 Dig Transmitter 3 ( Uniphy EF )
  859. #endif
  860. }ATOM_DIG_TRANSMITTER_CONFIG_V2;
  861. //ucConfig
  862. //Bit0
  863. #define ATOM_TRANSMITTER_CONFIG_V2_DUAL_LINK_CONNECTOR 0x01
  864. //Bit1
  865. #define ATOM_TRANSMITTER_CONFIG_V2_COHERENT 0x02
  866. //Bit2
  867. #define ATOM_TRANSMITTER_CONFIG_V2_LINK_SEL_MASK 0x04
  868. #define ATOM_TRANSMITTER_CONFIG_V2_LINKA 0x00
  869. #define ATOM_TRANSMITTER_CONFIG_V2_LINKB 0x04
  870. // Bit3
  871. #define ATOM_TRANSMITTER_CONFIG_V2_ENCODER_SEL_MASK 0x08
  872. #define ATOM_TRANSMITTER_CONFIG_V2_DIG1_ENCODER 0x00 // only used when ucAction == ATOM_TRANSMITTER_ACTION_ENABLE or ATOM_TRANSMITTER_ACTION_SETUP
  873. #define ATOM_TRANSMITTER_CONFIG_V2_DIG2_ENCODER 0x08 // only used when ucAction == ATOM_TRANSMITTER_ACTION_ENABLE or ATOM_TRANSMITTER_ACTION_SETUP
  874. // Bit4
  875. #define ATOM_TRASMITTER_CONFIG_V2_DP_CONNECTOR 0x10
  876. // Bit7:6
  877. #define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER_SEL_MASK 0xC0
  878. #define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER1 0x00 //AB
  879. #define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER2 0x40 //CD
  880. #define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER3 0x80 //EF
  881. typedef struct _DIG_TRANSMITTER_CONTROL_PARAMETERS_V2
  882. {
  883. union
  884. {
  885. USHORT usPixelClock; // in 10KHz; for bios convenient
  886. USHORT usInitInfo; // when init uniphy,lower 8bit is used for connector type defined in objectid.h
  887. ATOM_DP_VS_MODE asMode; // DP Voltage swing mode
  888. };
  889. ATOM_DIG_TRANSMITTER_CONFIG_V2 acConfig;
  890. UCHAR ucAction; // define as ATOM_TRANSMITER_ACTION_XXX
  891. UCHAR ucReserved[4];
  892. }DIG_TRANSMITTER_CONTROL_PARAMETERS_V2;
  893. typedef struct _ATOM_DIG_TRANSMITTER_CONFIG_V3
  894. {
  895. #if ATOM_BIG_ENDIAN
  896. UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB )…