intel_bios.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  1. /*
  2. * Copyright © 2006 Intel Corporation
  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 (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. *
  23. * Authors:
  24. * Eric Anholt <eric@anholt.net>
  25. *
  26. */
  27. #ifndef _INTEL_BIOS_H_
  28. #define _INTEL_BIOS_H_
  29. /**
  30. * struct vbt_header - VBT Header structure
  31. * @signature: VBT signature, always starts with "$VBT"
  32. * @version: Version of this structure
  33. * @header_size: Size of this structure
  34. * @vbt_size: Size of VBT (VBT Header, BDB Header and data blocks)
  35. * @vbt_checksum: Checksum
  36. * @reserved0: Reserved
  37. * @bdb_offset: Offset of &struct bdb_header from beginning of VBT
  38. * @aim_offset: Offsets of add-in data blocks from beginning of VBT
  39. */
  40. struct vbt_header {
  41. u8 signature[20];
  42. u16 version;
  43. u16 header_size;
  44. u16 vbt_size;
  45. u8 vbt_checksum;
  46. u8 reserved0;
  47. u32 bdb_offset;
  48. u32 aim_offset[4];
  49. } __packed;
  50. /**
  51. * struct bdb_header - BDB Header structure
  52. * @signature: BDB signature "BIOS_DATA_BLOCK"
  53. * @version: Version of the data block definitions
  54. * @header_size: Size of this structure
  55. * @bdb_size: Size of BDB (BDB Header and data blocks)
  56. */
  57. struct bdb_header {
  58. u8 signature[16];
  59. u16 version;
  60. u16 header_size;
  61. u16 bdb_size;
  62. } __packed;
  63. /* strictly speaking, this is a "skip" block, but it has interesting info */
  64. struct vbios_data {
  65. u8 type; /* 0 == desktop, 1 == mobile */
  66. u8 relstage;
  67. u8 chipset;
  68. u8 lvds_present:1;
  69. u8 tv_present:1;
  70. u8 rsvd2:6; /* finish byte */
  71. u8 rsvd3[4];
  72. u8 signon[155];
  73. u8 copyright[61];
  74. u16 code_segment;
  75. u8 dos_boot_mode;
  76. u8 bandwidth_percent;
  77. u8 rsvd4; /* popup memory size */
  78. u8 resize_pci_bios;
  79. u8 rsvd5; /* is crt already on ddc2 */
  80. } __packed;
  81. /*
  82. * There are several types of BIOS data blocks (BDBs), each block has
  83. * an ID and size in the first 3 bytes (ID in first, size in next 2).
  84. * Known types are listed below.
  85. */
  86. #define BDB_GENERAL_FEATURES 1
  87. #define BDB_GENERAL_DEFINITIONS 2
  88. #define BDB_OLD_TOGGLE_LIST 3
  89. #define BDB_MODE_SUPPORT_LIST 4
  90. #define BDB_GENERIC_MODE_TABLE 5
  91. #define BDB_EXT_MMIO_REGS 6
  92. #define BDB_SWF_IO 7
  93. #define BDB_SWF_MMIO 8
  94. #define BDB_PSR 9
  95. #define BDB_MODE_REMOVAL_TABLE 10
  96. #define BDB_CHILD_DEVICE_TABLE 11
  97. #define BDB_DRIVER_FEATURES 12
  98. #define BDB_DRIVER_PERSISTENCE 13
  99. #define BDB_EXT_TABLE_PTRS 14
  100. #define BDB_DOT_CLOCK_OVERRIDE 15
  101. #define BDB_DISPLAY_SELECT 16
  102. /* 17 rsvd */
  103. #define BDB_DRIVER_ROTATION 18
  104. #define BDB_DISPLAY_REMOVE 19
  105. #define BDB_OEM_CUSTOM 20
  106. #define BDB_EFP_LIST 21 /* workarounds for VGA hsync/vsync */
  107. #define BDB_SDVO_LVDS_OPTIONS 22
  108. #define BDB_SDVO_PANEL_DTDS 23
  109. #define BDB_SDVO_LVDS_PNP_IDS 24
  110. #define BDB_SDVO_LVDS_POWER_SEQ 25
  111. #define BDB_TV_OPTIONS 26
  112. #define BDB_EDP 27
  113. #define BDB_LVDS_OPTIONS 40
  114. #define BDB_LVDS_LFP_DATA_PTRS 41
  115. #define BDB_LVDS_LFP_DATA 42
  116. #define BDB_LVDS_BACKLIGHT 43
  117. #define BDB_LVDS_POWER 44
  118. #define BDB_MIPI_CONFIG 52
  119. #define BDB_MIPI_SEQUENCE 53
  120. #define BDB_SKIP 254 /* VBIOS private block, ignore */
  121. struct bdb_general_features {
  122. /* bits 1 */
  123. u8 panel_fitting:2;
  124. u8 flexaim:1;
  125. u8 msg_enable:1;
  126. u8 clear_screen:3;
  127. u8 color_flip:1;
  128. /* bits 2 */
  129. u8 download_ext_vbt:1;
  130. u8 enable_ssc:1;
  131. u8 ssc_freq:1;
  132. u8 enable_lfp_on_override:1;
  133. u8 disable_ssc_ddt:1;
  134. u8 rsvd7:1;
  135. u8 display_clock_mode:1;
  136. u8 rsvd8:1; /* finish byte */
  137. /* bits 3 */
  138. u8 disable_smooth_vision:1;
  139. u8 single_dvi:1;
  140. u8 rsvd9:1;
  141. u8 fdi_rx_polarity_inverted:1;
  142. u8 rsvd10:4; /* finish byte */
  143. /* bits 4 */
  144. u8 legacy_monitor_detect;
  145. /* bits 5 */
  146. u8 int_crt_support:1;
  147. u8 int_tv_support:1;
  148. u8 int_efp_support:1;
  149. u8 dp_ssc_enb:1; /* PCH attached eDP supports SSC */
  150. u8 dp_ssc_freq:1; /* SSC freq for PCH attached eDP */
  151. u8 rsvd11:3; /* finish byte */
  152. } __packed;
  153. /* pre-915 */
  154. #define GPIO_PIN_DVI_LVDS 0x03 /* "DVI/LVDS DDC GPIO pins" */
  155. #define GPIO_PIN_ADD_I2C 0x05 /* "ADDCARD I2C GPIO pins" */
  156. #define GPIO_PIN_ADD_DDC 0x04 /* "ADDCARD DDC GPIO pins" */
  157. #define GPIO_PIN_ADD_DDC_I2C 0x06 /* "ADDCARD DDC/I2C GPIO pins" */
  158. /* Pre 915 */
  159. #define DEVICE_TYPE_NONE 0x00
  160. #define DEVICE_TYPE_CRT 0x01
  161. #define DEVICE_TYPE_TV 0x09
  162. #define DEVICE_TYPE_EFP 0x12
  163. #define DEVICE_TYPE_LFP 0x22
  164. /* On 915+ */
  165. #define DEVICE_TYPE_CRT_DPMS 0x6001
  166. #define DEVICE_TYPE_CRT_DPMS_HOTPLUG 0x4001
  167. #define DEVICE_TYPE_TV_COMPOSITE 0x0209
  168. #define DEVICE_TYPE_TV_MACROVISION 0x0289
  169. #define DEVICE_TYPE_TV_RF_COMPOSITE 0x020c
  170. #define DEVICE_TYPE_TV_SVIDEO_COMPOSITE 0x0609
  171. #define DEVICE_TYPE_TV_SCART 0x0209
  172. #define DEVICE_TYPE_TV_CODEC_HOTPLUG_PWR 0x6009
  173. #define DEVICE_TYPE_EFP_HOTPLUG_PWR 0x6012
  174. #define DEVICE_TYPE_EFP_DVI_HOTPLUG_PWR 0x6052
  175. #define DEVICE_TYPE_EFP_DVI_I 0x6053
  176. #define DEVICE_TYPE_EFP_DVI_D_DUAL 0x6152
  177. #define DEVICE_TYPE_EFP_DVI_D_HDCP 0x60d2
  178. #define DEVICE_TYPE_OPENLDI_HOTPLUG_PWR 0x6062
  179. #define DEVICE_TYPE_OPENLDI_DUALPIX 0x6162
  180. #define DEVICE_TYPE_LFP_PANELLINK 0x5012
  181. #define DEVICE_TYPE_LFP_CMOS_PWR 0x5042
  182. #define DEVICE_TYPE_LFP_LVDS_PWR 0x5062
  183. #define DEVICE_TYPE_LFP_LVDS_DUAL 0x5162
  184. #define DEVICE_TYPE_LFP_LVDS_DUAL_HDCP 0x51e2
  185. #define DEVICE_CFG_NONE 0x00
  186. #define DEVICE_CFG_12BIT_DVOB 0x01
  187. #define DEVICE_CFG_12BIT_DVOC 0x02
  188. #define DEVICE_CFG_24BIT_DVOBC 0x09
  189. #define DEVICE_CFG_24BIT_DVOCB 0x0a
  190. #define DEVICE_CFG_DUAL_DVOB 0x11
  191. #define DEVICE_CFG_DUAL_DVOC 0x12
  192. #define DEVICE_CFG_DUAL_DVOBC 0x13
  193. #define DEVICE_CFG_DUAL_LINK_DVOBC 0x19
  194. #define DEVICE_CFG_DUAL_LINK_DVOCB 0x1a
  195. #define DEVICE_WIRE_NONE 0x00
  196. #define DEVICE_WIRE_DVOB 0x01
  197. #define DEVICE_WIRE_DVOC 0x02
  198. #define DEVICE_WIRE_DVOBC 0x03
  199. #define DEVICE_WIRE_DVOBB 0x05
  200. #define DEVICE_WIRE_DVOCC 0x06
  201. #define DEVICE_WIRE_DVOB_MASTER 0x0d
  202. #define DEVICE_WIRE_DVOC_MASTER 0x0e
  203. #define DEVICE_PORT_DVOA 0x00 /* none on 845+ */
  204. #define DEVICE_PORT_DVOB 0x01
  205. #define DEVICE_PORT_DVOC 0x02
  206. /*
  207. * We used to keep this struct but without any version control. We should avoid
  208. * using it in the future, but it should be safe to keep using it in the old
  209. * code. Do not change; we rely on its size.
  210. */
  211. struct old_child_dev_config {
  212. u16 handle;
  213. u16 device_type;
  214. u8 device_id[10]; /* ascii string */
  215. u16 addin_offset;
  216. u8 dvo_port; /* See Device_PORT_* above */
  217. u8 i2c_pin;
  218. u8 slave_addr;
  219. u8 ddc_pin;
  220. u16 edid_ptr;
  221. u8 dvo_cfg; /* See DEVICE_CFG_* above */
  222. u8 dvo2_port;
  223. u8 i2c2_pin;
  224. u8 slave2_addr;
  225. u8 ddc2_pin;
  226. u8 capabilities;
  227. u8 dvo_wiring;/* See DEVICE_WIRE_* above */
  228. u8 dvo2_wiring;
  229. u16 extended_type;
  230. u8 dvo_function;
  231. } __packed;
  232. /* This one contains field offsets that are known to be common for all BDB
  233. * versions. Notice that the meaning of the contents contents may still change,
  234. * but at least the offsets are consistent. */
  235. /* Definitions for flags_1 */
  236. #define IBOOST_ENABLE (1<<3)
  237. struct common_child_dev_config {
  238. u16 handle;
  239. u16 device_type;
  240. u8 not_common1[12];
  241. u8 dvo_port;
  242. u8 not_common2[2];
  243. u8 ddc_pin;
  244. u16 edid_ptr;
  245. u8 obsolete;
  246. u8 flags_1;
  247. u8 not_common3[13];
  248. u8 iboost_level;
  249. } __packed;
  250. /* This field changes depending on the BDB version, so the most reliable way to
  251. * read it is by checking the BDB version and reading the raw pointer. */
  252. union child_device_config {
  253. /* This one is safe to be used anywhere, but the code should still check
  254. * the BDB version. */
  255. u8 raw[33];
  256. /* This one should only be kept for legacy code. */
  257. struct old_child_dev_config old;
  258. /* This one should also be safe to use anywhere, even without version
  259. * checks. */
  260. struct common_child_dev_config common;
  261. } __packed;
  262. struct bdb_general_definitions {
  263. /* DDC GPIO */
  264. u8 crt_ddc_gmbus_pin;
  265. /* DPMS bits */
  266. u8 dpms_acpi:1;
  267. u8 skip_boot_crt_detect:1;
  268. u8 dpms_aim:1;
  269. u8 rsvd1:5; /* finish byte */
  270. /* boot device bits */
  271. u8 boot_display[2];
  272. u8 child_dev_size;
  273. /*
  274. * Device info:
  275. * If TV is present, it'll be at devices[0].
  276. * LVDS will be next, either devices[0] or [1], if present.
  277. * On some platforms the number of device is 6. But could be as few as
  278. * 4 if both TV and LVDS are missing.
  279. * And the device num is related with the size of general definition
  280. * block. It is obtained by using the following formula:
  281. * number = (block_size - sizeof(bdb_general_definitions))/
  282. * defs->child_dev_size;
  283. */
  284. uint8_t devices[0];
  285. } __packed;
  286. /* Mask for DRRS / Panel Channel / SSC / BLT control bits extraction */
  287. #define MODE_MASK 0x3
  288. struct bdb_lvds_options {
  289. u8 panel_type;
  290. u8 rsvd1;
  291. /* LVDS capabilities, stored in a dword */
  292. u8 pfit_mode:2;
  293. u8 pfit_text_mode_enhanced:1;
  294. u8 pfit_gfx_mode_enhanced:1;
  295. u8 pfit_ratio_auto:1;
  296. u8 pixel_dither:1;
  297. u8 lvds_edid:1;
  298. u8 rsvd2:1;
  299. u8 rsvd4;
  300. /* LVDS Panel channel bits stored here */
  301. u32 lvds_panel_channel_bits;
  302. /* LVDS SSC (Spread Spectrum Clock) bits stored here. */
  303. u16 ssc_bits;
  304. u16 ssc_freq;
  305. u16 ssc_ddt;
  306. /* Panel color depth defined here */
  307. u16 panel_color_depth;
  308. /* LVDS panel type bits stored here */
  309. u32 dps_panel_type_bits;
  310. /* LVDS backlight control type bits stored here */
  311. u32 blt_control_type_bits;
  312. } __packed;
  313. /* LFP pointer table contains entries to the struct below */
  314. struct bdb_lvds_lfp_data_ptr {
  315. u16 fp_timing_offset; /* offsets are from start of bdb */
  316. u8 fp_table_size;
  317. u16 dvo_timing_offset;
  318. u8 dvo_table_size;
  319. u16 panel_pnp_id_offset;
  320. u8 pnp_table_size;
  321. } __packed;
  322. struct bdb_lvds_lfp_data_ptrs {
  323. u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
  324. struct bdb_lvds_lfp_data_ptr ptr[16];
  325. } __packed;
  326. /* LFP data has 3 blocks per entry */
  327. struct lvds_fp_timing {
  328. u16 x_res;
  329. u16 y_res;
  330. u32 lvds_reg;
  331. u32 lvds_reg_val;
  332. u32 pp_on_reg;
  333. u32 pp_on_reg_val;
  334. u32 pp_off_reg;
  335. u32 pp_off_reg_val;
  336. u32 pp_cycle_reg;
  337. u32 pp_cycle_reg_val;
  338. u32 pfit_reg;
  339. u32 pfit_reg_val;
  340. u16 terminator;
  341. } __packed;
  342. struct lvds_dvo_timing {
  343. u16 clock; /**< In 10khz */
  344. u8 hactive_lo;
  345. u8 hblank_lo;
  346. u8 hblank_hi:4;
  347. u8 hactive_hi:4;
  348. u8 vactive_lo;
  349. u8 vblank_lo;
  350. u8 vblank_hi:4;
  351. u8 vactive_hi:4;
  352. u8 hsync_off_lo;
  353. u8 hsync_pulse_width;
  354. u8 vsync_pulse_width:4;
  355. u8 vsync_off:4;
  356. u8 rsvd0:6;
  357. u8 hsync_off_hi:2;
  358. u8 h_image;
  359. u8 v_image;
  360. u8 max_hv;
  361. u8 h_border;
  362. u8 v_border;
  363. u8 rsvd1:3;
  364. u8 digital:2;
  365. u8 vsync_positive:1;
  366. u8 hsync_positive:1;
  367. u8 rsvd2:1;
  368. } __packed;
  369. struct lvds_pnp_id {
  370. u16 mfg_name;
  371. u16 product_code;
  372. u32 serial;
  373. u8 mfg_week;
  374. u8 mfg_year;
  375. } __packed;
  376. struct bdb_lvds_lfp_data_entry {
  377. struct lvds_fp_timing fp_timing;
  378. struct lvds_dvo_timing dvo_timing;
  379. struct lvds_pnp_id pnp_id;
  380. } __packed;
  381. struct bdb_lvds_lfp_data {
  382. struct bdb_lvds_lfp_data_entry data[16];
  383. } __packed;
  384. #define BDB_BACKLIGHT_TYPE_NONE 0
  385. #define BDB_BACKLIGHT_TYPE_PWM 2
  386. struct bdb_lfp_backlight_data_entry {
  387. u8 type:2;
  388. u8 active_low_pwm:1;
  389. u8 obsolete1:5;
  390. u16 pwm_freq_hz;
  391. u8 min_brightness;
  392. u8 obsolete2;
  393. u8 obsolete3;
  394. } __packed;
  395. struct bdb_lfp_backlight_data {
  396. u8 entry_size;
  397. struct bdb_lfp_backlight_data_entry data[16];
  398. u8 level[16];
  399. } __packed;
  400. struct aimdb_header {
  401. char signature[16];
  402. char oem_device[20];
  403. u16 aimdb_version;
  404. u16 aimdb_header_size;
  405. u16 aimdb_size;
  406. } __packed;
  407. struct aimdb_block {
  408. u8 aimdb_id;
  409. u16 aimdb_size;
  410. } __packed;
  411. struct vch_panel_data {
  412. u16 fp_timing_offset;
  413. u8 fp_timing_size;
  414. u16 dvo_timing_offset;
  415. u8 dvo_timing_size;
  416. u16 text_fitting_offset;
  417. u8 text_fitting_size;
  418. u16 graphics_fitting_offset;
  419. u8 graphics_fitting_size;
  420. } __packed;
  421. struct vch_bdb_22 {
  422. struct aimdb_block aimdb_block;
  423. struct vch_panel_data panels[16];
  424. } __packed;
  425. struct bdb_sdvo_lvds_options {
  426. u8 panel_backlight;
  427. u8 h40_set_panel_type;
  428. u8 panel_type;
  429. u8 ssc_clk_freq;
  430. u16 als_low_trip;
  431. u16 als_high_trip;
  432. u8 sclalarcoeff_tab_row_num;
  433. u8 sclalarcoeff_tab_row_size;
  434. u8 coefficient[8];
  435. u8 panel_misc_bits_1;
  436. u8 panel_misc_bits_2;
  437. u8 panel_misc_bits_3;
  438. u8 panel_misc_bits_4;
  439. } __packed;
  440. #define BDB_DRIVER_FEATURE_NO_LVDS 0
  441. #define BDB_DRIVER_FEATURE_INT_LVDS 1
  442. #define BDB_DRIVER_FEATURE_SDVO_LVDS 2
  443. #define BDB_DRIVER_FEATURE_EDP 3
  444. struct bdb_driver_features {
  445. u8 boot_dev_algorithm:1;
  446. u8 block_display_switch:1;
  447. u8 allow_display_switch:1;
  448. u8 hotplug_dvo:1;
  449. u8 dual_view_zoom:1;
  450. u8 int15h_hook:1;
  451. u8 sprite_in_clone:1;
  452. u8 primary_lfp_id:1;
  453. u16 boot_mode_x;
  454. u16 boot_mode_y;
  455. u8 boot_mode_bpp;
  456. u8 boot_mode_refresh;
  457. u16 enable_lfp_primary:1;
  458. u16 selective_mode_pruning:1;
  459. u16 dual_frequency:1;
  460. u16 render_clock_freq:1; /* 0: high freq; 1: low freq */
  461. u16 nt_clone_support:1;
  462. u16 power_scheme_ui:1; /* 0: CUI; 1: 3rd party */
  463. u16 sprite_display_assign:1; /* 0: secondary; 1: primary */
  464. u16 cui_aspect_scaling:1;
  465. u16 preserve_aspect_ratio:1;
  466. u16 sdvo_device_power_down:1;
  467. u16 crt_hotplug:1;
  468. u16 lvds_config:2;
  469. u16 tv_hotplug:1;
  470. u16 hdmi_config:2;
  471. u8 static_display:1;
  472. u8 reserved2:7;
  473. u16 legacy_crt_max_x;
  474. u16 legacy_crt_max_y;
  475. u8 legacy_crt_max_refresh;
  476. u8 hdmi_termination;
  477. u8 custom_vbt_version;
  478. /* Driver features data block */
  479. u16 rmpm_enabled:1;
  480. u16 s2ddt_enabled:1;
  481. u16 dpst_enabled:1;
  482. u16 bltclt_enabled:1;
  483. u16 adb_enabled:1;
  484. u16 drrs_enabled:1;
  485. u16 grs_enabled:1;
  486. u16 gpmt_enabled:1;
  487. u16 tbt_enabled:1;
  488. u16 psr_enabled:1;
  489. u16 ips_enabled:1;
  490. u16 reserved3:4;
  491. u16 pc_feature_valid:1;
  492. } __packed;
  493. #define EDP_18BPP 0
  494. #define EDP_24BPP 1
  495. #define EDP_30BPP 2
  496. #define EDP_RATE_1_62 0
  497. #define EDP_RATE_2_7 1
  498. #define EDP_LANE_1 0
  499. #define EDP_LANE_2 1
  500. #define EDP_LANE_4 3
  501. #define EDP_PREEMPHASIS_NONE 0
  502. #define EDP_PREEMPHASIS_3_5dB 1
  503. #define EDP_PREEMPHASIS_6dB 2
  504. #define EDP_PREEMPHASIS_9_5dB 3
  505. #define EDP_VSWING_0_4V 0
  506. #define EDP_VSWING_0_6V 1
  507. #define EDP_VSWING_0_8V 2
  508. #define EDP_VSWING_1_2V 3
  509. struct edp_power_seq {
  510. u16 t1_t3;
  511. u16 t8;
  512. u16 t9;
  513. u16 t10;
  514. u16 t11_t12;
  515. } __packed;
  516. struct edp_link_params {
  517. u8 rate:4;
  518. u8 lanes:4;
  519. u8 preemphasis:4;
  520. u8 vswing:4;
  521. } __packed;
  522. struct bdb_edp {
  523. struct edp_power_seq power_seqs[16];
  524. u32 color_depth;
  525. struct edp_link_params link_params[16];
  526. u32 sdrrs_msa_timing_delay;
  527. /* ith bit indicates enabled/disabled for (i+1)th panel */
  528. u16 edp_s3d_feature;
  529. u16 edp_t3_optimization;
  530. u64 edp_vswing_preemph; /* v173 */
  531. } __packed;
  532. struct psr_table {
  533. /* Feature bits */
  534. u8 full_link:1;
  535. u8 require_aux_to_wakeup:1;
  536. u8 feature_bits_rsvd:6;
  537. /* Wait times */
  538. u8 idle_frames:4;
  539. u8 lines_to_wait:3;
  540. u8 wait_times_rsvd:1;
  541. /* TP wake up time in multiple of 100 */
  542. u16 tp1_wakeup_time;
  543. u16 tp2_tp3_wakeup_time;
  544. } __packed;
  545. struct bdb_psr {
  546. struct psr_table psr_table[16];
  547. } __packed;
  548. /*
  549. * Driver<->VBIOS interaction occurs through scratch bits in
  550. * GR18 & SWF*.
  551. */
  552. /* GR18 bits are set on display switch and hotkey events */
  553. #define GR18_DRIVER_SWITCH_EN (1<<7) /* 0: VBIOS control, 1: driver control */
  554. #define GR18_HOTKEY_MASK 0x78 /* See also SWF4 15:0 */
  555. #define GR18_HK_NONE (0x0<<3)
  556. #define GR18_HK_LFP_STRETCH (0x1<<3)
  557. #define GR18_HK_TOGGLE_DISP (0x2<<3)
  558. #define GR18_HK_DISP_SWITCH (0x4<<3) /* see SWF14 15:0 for what to enable */
  559. #define GR18_HK_POPUP_DISABLED (0x6<<3)
  560. #define GR18_HK_POPUP_ENABLED (0x7<<3)
  561. #define GR18_HK_PFIT (0x8<<3)
  562. #define GR18_HK_APM_CHANGE (0xa<<3)
  563. #define GR18_HK_MULTIPLE (0xc<<3)
  564. #define GR18_USER_INT_EN (1<<2)
  565. #define GR18_A0000_FLUSH_EN (1<<1)
  566. #define GR18_SMM_EN (1<<0)
  567. /* Set by driver, cleared by VBIOS */
  568. #define SWF00_YRES_SHIFT 16
  569. #define SWF00_XRES_SHIFT 0
  570. #define SWF00_RES_MASK 0xffff
  571. /* Set by VBIOS at boot time and driver at runtime */
  572. #define SWF01_TV2_FORMAT_SHIFT 8
  573. #define SWF01_TV1_FORMAT_SHIFT 0
  574. #define SWF01_TV_FORMAT_MASK 0xffff
  575. #define SWF10_VBIOS_BLC_I2C_EN (1<<29)
  576. #define SWF10_GTT_OVERRIDE_EN (1<<28)
  577. #define SWF10_LFP_DPMS_OVR (1<<27) /* override DPMS on display switch */
  578. #define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
  579. #define SWF10_OLD_TOGGLE 0x0
  580. #define SWF10_TOGGLE_LIST_1 0x1
  581. #define SWF10_TOGGLE_LIST_2 0x2
  582. #define SWF10_TOGGLE_LIST_3 0x3
  583. #define SWF10_TOGGLE_LIST_4 0x4
  584. #define SWF10_PANNING_EN (1<<23)
  585. #define SWF10_DRIVER_LOADED (1<<22)
  586. #define SWF10_EXTENDED_DESKTOP (1<<21)
  587. #define SWF10_EXCLUSIVE_MODE (1<<20)
  588. #define SWF10_OVERLAY_EN (1<<19)
  589. #define SWF10_PLANEB_HOLDOFF (1<<18)
  590. #define SWF10_PLANEA_HOLDOFF (1<<17)
  591. #define SWF10_VGA_HOLDOFF (1<<16)
  592. #define SWF10_ACTIVE_DISP_MASK 0xffff
  593. #define SWF10_PIPEB_LFP2 (1<<15)
  594. #define SWF10_PIPEB_EFP2 (1<<14)
  595. #define SWF10_PIPEB_TV2 (1<<13)
  596. #define SWF10_PIPEB_CRT2 (1<<12)
  597. #define SWF10_PIPEB_LFP (1<<11)
  598. #define SWF10_PIPEB_EFP (1<<10)
  599. #define SWF10_PIPEB_TV (1<<9)
  600. #define SWF10_PIPEB_CRT (1<<8)
  601. #define SWF10_PIPEA_LFP2 (1<<7)
  602. #define SWF10_PIPEA_EFP2 (1<<6)
  603. #define SWF10_PIPEA_TV2 (1<<5)
  604. #define SWF10_PIPEA_CRT2 (1<<4)
  605. #define SWF10_PIPEA_LFP (1<<3)
  606. #define SWF10_PIPEA_EFP (1<<2)
  607. #define SWF10_PIPEA_TV (1<<1)
  608. #define SWF10_PIPEA_CRT (1<<0)
  609. #define SWF11_MEMORY_SIZE_SHIFT 16
  610. #define SWF11_SV_TEST_EN (1<<15)
  611. #define SWF11_IS_AGP (1<<14)
  612. #define SWF11_DISPLAY_HOLDOFF (1<<13)
  613. #define SWF11_DPMS_REDUCED (1<<12)
  614. #define SWF11_IS_VBE_MODE (1<<11)
  615. #define SWF11_PIPEB_ACCESS (1<<10) /* 0 here means pipe a */
  616. #define SWF11_DPMS_MASK 0x07
  617. #define SWF11_DPMS_OFF (1<<2)
  618. #define SWF11_DPMS_SUSPEND (1<<1)
  619. #define SWF11_DPMS_STANDBY (1<<0)
  620. #define SWF11_DPMS_ON 0
  621. #define SWF14_GFX_PFIT_EN (1<<31)
  622. #define SWF14_TEXT_PFIT_EN (1<<30)
  623. #define SWF14_LID_STATUS_CLOSED (1<<29) /* 0 here means open */
  624. #define SWF14_POPUP_EN (1<<28)
  625. #define SWF14_DISPLAY_HOLDOFF (1<<27)
  626. #define SWF14_DISP_DETECT_EN (1<<26)
  627. #define SWF14_DOCKING_STATUS_DOCKED (1<<25) /* 0 here means undocked */
  628. #define SWF14_DRIVER_STATUS (1<<24)
  629. #define SWF14_OS_TYPE_WIN9X (1<<23)
  630. #define SWF14_OS_TYPE_WINNT (1<<22)
  631. /* 21:19 rsvd */
  632. #define SWF14_PM_TYPE_MASK 0x00070000
  633. #define SWF14_PM_ACPI_VIDEO (0x4 << 16)
  634. #define SWF14_PM_ACPI (0x3 << 16)
  635. #define SWF14_PM_APM_12 (0x2 << 16)
  636. #define SWF14_PM_APM_11 (0x1 << 16)
  637. #define SWF14_HK_REQUEST_MASK 0x0000ffff /* see GR18 6:3 for event type */
  638. /* if GR18 indicates a display switch */
  639. #define SWF14_DS_PIPEB_LFP2_EN (1<<15)
  640. #define SWF14_DS_PIPEB_EFP2_EN (1<<14)
  641. #define SWF14_DS_PIPEB_TV2_EN (1<<13)
  642. #define SWF14_DS_PIPEB_CRT2_EN (1<<12)
  643. #define SWF14_DS_PIPEB_LFP_EN (1<<11)
  644. #define SWF14_DS_PIPEB_EFP_EN (1<<10)
  645. #define SWF14_DS_PIPEB_TV_EN (1<<9)
  646. #define SWF14_DS_PIPEB_CRT_EN (1<<8)
  647. #define SWF14_DS_PIPEA_LFP2_EN (1<<7)
  648. #define SWF14_DS_PIPEA_EFP2_EN (1<<6)
  649. #define SWF14_DS_PIPEA_TV2_EN (1<<5)
  650. #define SWF14_DS_PIPEA_CRT2_EN (1<<4)
  651. #define SWF14_DS_PIPEA_LFP_EN (1<<3)
  652. #define SWF14_DS_PIPEA_EFP_EN (1<<2)
  653. #define SWF14_DS_PIPEA_TV_EN (1<<1)
  654. #define SWF14_DS_PIPEA_CRT_EN (1<<0)
  655. /* if GR18 indicates a panel fitting request */
  656. #define SWF14_PFIT_EN (1<<0) /* 0 means disable */
  657. /* if GR18 indicates an APM change request */
  658. #define SWF14_APM_HIBERNATE 0x4
  659. #define SWF14_APM_SUSPEND 0x3
  660. #define SWF14_APM_STANDBY 0x1
  661. #define SWF14_APM_RESTORE 0x0
  662. /* Add the device class for LFP, TV, HDMI */
  663. #define DEVICE_TYPE_INT_LFP 0x1022
  664. #define DEVICE_TYPE_INT_TV 0x1009
  665. #define DEVICE_TYPE_HDMI 0x60D2
  666. #define DEVICE_TYPE_DP 0x68C6
  667. #define DEVICE_TYPE_eDP 0x78C6
  668. #define DEVICE_TYPE_CLASS_EXTENSION (1 << 15)
  669. #define DEVICE_TYPE_POWER_MANAGEMENT (1 << 14)
  670. #define DEVICE_TYPE_HOTPLUG_SIGNALING (1 << 13)
  671. #define DEVICE_TYPE_INTERNAL_CONNECTOR (1 << 12)
  672. #define DEVICE_TYPE_NOT_HDMI_OUTPUT (1 << 11)
  673. #define DEVICE_TYPE_MIPI_OUTPUT (1 << 10)
  674. #define DEVICE_TYPE_COMPOSITE_OUTPUT (1 << 9)
  675. #define DEVICE_TYPE_DUAL_CHANNEL (1 << 8)
  676. #define DEVICE_TYPE_HIGH_SPEED_LINK (1 << 6)
  677. #define DEVICE_TYPE_LVDS_SINGALING (1 << 5)
  678. #define DEVICE_TYPE_TMDS_DVI_SIGNALING (1 << 4)
  679. #define DEVICE_TYPE_VIDEO_SIGNALING (1 << 3)
  680. #define DEVICE_TYPE_DISPLAYPORT_OUTPUT (1 << 2)
  681. #define DEVICE_TYPE_DIGITAL_OUTPUT (1 << 1)
  682. #define DEVICE_TYPE_ANALOG_OUTPUT (1 << 0)
  683. /*
  684. * Bits we care about when checking for DEVICE_TYPE_eDP
  685. * Depending on the system, the other bits may or may not
  686. * be set for eDP outputs.
  687. */
  688. #define DEVICE_TYPE_eDP_BITS \
  689. (DEVICE_TYPE_INTERNAL_CONNECTOR | \
  690. DEVICE_TYPE_MIPI_OUTPUT | \
  691. DEVICE_TYPE_COMPOSITE_OUTPUT | \
  692. DEVICE_TYPE_DUAL_CHANNEL | \
  693. DEVICE_TYPE_LVDS_SINGALING | \
  694. DEVICE_TYPE_TMDS_DVI_SIGNALING | \
  695. DEVICE_TYPE_VIDEO_SIGNALING | \
  696. DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
  697. DEVICE_TYPE_ANALOG_OUTPUT)
  698. /* define the DVO port for HDMI output type */
  699. #define DVO_B 1
  700. #define DVO_C 2
  701. #define DVO_D 3
  702. /* Possible values for the "DVO Port" field for versions >= 155: */
  703. #define DVO_PORT_HDMIA 0
  704. #define DVO_PORT_HDMIB 1
  705. #define DVO_PORT_HDMIC 2
  706. #define DVO_PORT_HDMID 3
  707. #define DVO_PORT_LVDS 4
  708. #define DVO_PORT_TV 5
  709. #define DVO_PORT_CRT 6
  710. #define DVO_PORT_DPB 7
  711. #define DVO_PORT_DPC 8
  712. #define DVO_PORT_DPD 9
  713. #define DVO_PORT_DPA 10
  714. #define DVO_PORT_DPE 11
  715. #define DVO_PORT_HDMIE 12
  716. #define DVO_PORT_MIPIA 21
  717. #define DVO_PORT_MIPIB 22
  718. #define DVO_PORT_MIPIC 23
  719. #define DVO_PORT_MIPID 24
  720. /* Block 52 contains MIPI Panel info
  721. * 6 such enteries will there. Index into correct
  722. * entery is based on the panel_index in #40 LFP
  723. */
  724. #define MAX_MIPI_CONFIGURATIONS 6
  725. #define MIPI_DSI_UNDEFINED_PANEL_ID 0
  726. #define MIPI_DSI_GENERIC_PANEL_ID 1
  727. /*
  728. * PMIC vs SoC Backlight support specified in pwm_blc
  729. * field in mipi_config block below.
  730. */
  731. #define PPS_BLC_PMIC 0
  732. #define PPS_BLC_SOC 1
  733. struct mipi_config {
  734. u16 panel_id;
  735. /* General Params */
  736. u32 enable_dithering:1;
  737. u32 rsvd1:1;
  738. u32 is_bridge:1;
  739. u32 panel_arch_type:2;
  740. u32 is_cmd_mode:1;
  741. #define NON_BURST_SYNC_PULSE 0x1
  742. #define NON_BURST_SYNC_EVENTS 0x2
  743. #define BURST_MODE 0x3
  744. u32 video_transfer_mode:2;
  745. u32 cabc_supported:1;
  746. u32 pwm_blc:1;
  747. /* Bit 13:10 */
  748. #define PIXEL_FORMAT_RGB565 0x1
  749. #define PIXEL_FORMAT_RGB666 0x2
  750. #define PIXEL_FORMAT_RGB666_LOOSELY_PACKED 0x3
  751. #define PIXEL_FORMAT_RGB888 0x4
  752. u32 videomode_color_format:4;
  753. /* Bit 15:14 */
  754. #define ENABLE_ROTATION_0 0x0
  755. #define ENABLE_ROTATION_90 0x1
  756. #define ENABLE_ROTATION_180 0x2
  757. #define ENABLE_ROTATION_270 0x3
  758. u32 rotation:2;
  759. u32 bta_enabled:1;
  760. u32 rsvd2:15;
  761. /* 2 byte Port Description */
  762. #define DUAL_LINK_NOT_SUPPORTED 0
  763. #define DUAL_LINK_FRONT_BACK 1
  764. #define DUAL_LINK_PIXEL_ALT 2
  765. u16 dual_link:2;
  766. u16 lane_cnt:2;
  767. u16 pixel_overlap:3;
  768. u16 rsvd3:9;
  769. u16 rsvd4;
  770. u8 rsvd5;
  771. u32 target_burst_mode_freq;
  772. u32 dsi_ddr_clk;
  773. u32 bridge_ref_clk;
  774. #define BYTE_CLK_SEL_20MHZ 0
  775. #define BYTE_CLK_SEL_10MHZ 1
  776. #define BYTE_CLK_SEL_5MHZ 2
  777. u8 byte_clk_sel:2;
  778. u8 rsvd6:6;
  779. /* DPHY Flags */
  780. u16 dphy_param_valid:1;
  781. u16 eot_pkt_disabled:1;
  782. u16 enable_clk_stop:1;
  783. u16 rsvd7:13;
  784. u32 hs_tx_timeout;
  785. u32 lp_rx_timeout;
  786. u32 turn_around_timeout;
  787. u32 device_reset_timer;
  788. u32 master_init_timer;
  789. u32 dbi_bw_timer;
  790. u32 lp_byte_clk_val;
  791. /* 4 byte Dphy Params */
  792. u32 prepare_cnt:6;
  793. u32 rsvd8:2;
  794. u32 clk_zero_cnt:8;
  795. u32 trail_cnt:5;
  796. u32 rsvd9:3;
  797. u32 exit_zero_cnt:6;
  798. u32 rsvd10:2;
  799. u32 clk_lane_switch_cnt;
  800. u32 hl_switch_cnt;
  801. u32 rsvd11[6];
  802. /* timings based on dphy spec */
  803. u8 tclk_miss;
  804. u8 tclk_post;
  805. u8 rsvd12;
  806. u8 tclk_pre;
  807. u8 tclk_prepare;
  808. u8 tclk_settle;
  809. u8 tclk_term_enable;
  810. u8 tclk_trail;
  811. u16 tclk_prepare_clkzero;
  812. u8 rsvd13;
  813. u8 td_term_enable;
  814. u8 teot;
  815. u8 ths_exit;
  816. u8 ths_prepare;
  817. u16 ths_prepare_hszero;
  818. u8 rsvd14;
  819. u8 ths_settle;
  820. u8 ths_skip;
  821. u8 ths_trail;
  822. u8 tinit;
  823. u8 tlpx;
  824. u8 rsvd15[3];
  825. /* GPIOs */
  826. u8 panel_enable;
  827. u8 bl_enable;
  828. u8 pwm_enable;
  829. u8 reset_r_n;
  830. u8 pwr_down_r;
  831. u8 stdby_r_n;
  832. } __packed;
  833. /* Block 52 contains MIPI configuration block
  834. * 6 * bdb_mipi_config, followed by 6 pps data
  835. * block below
  836. *
  837. * all delays has a unit of 100us
  838. */
  839. struct mipi_pps_data {
  840. u16 panel_on_delay;
  841. u16 bl_enable_delay;
  842. u16 bl_disable_delay;
  843. u16 panel_off_delay;
  844. u16 panel_power_cycle_delay;
  845. } __packed;
  846. struct bdb_mipi_config {
  847. struct mipi_config config[MAX_MIPI_CONFIGURATIONS];
  848. struct mipi_pps_data pps[MAX_MIPI_CONFIGURATIONS];
  849. } __packed;
  850. /* Block 53 contains MIPI sequences as needed by the panel
  851. * for enabling it. This block can be variable in size and
  852. * can be maximum of 6 blocks
  853. */
  854. struct bdb_mipi_sequence {
  855. u8 version;
  856. u8 data[0];
  857. } __packed;
  858. /* MIPI Sequnece Block definitions */
  859. enum mipi_seq {
  860. MIPI_SEQ_END = 0,
  861. MIPI_SEQ_ASSERT_RESET,
  862. MIPI_SEQ_INIT_OTP,
  863. MIPI_SEQ_DISPLAY_ON,
  864. MIPI_SEQ_DISPLAY_OFF,
  865. MIPI_SEQ_DEASSERT_RESET,
  866. MIPI_SEQ_BACKLIGHT_ON, /* sequence block v2+ */
  867. MIPI_SEQ_BACKLIGHT_OFF, /* sequence block v2+ */
  868. MIPI_SEQ_TEAR_ON, /* sequence block v2+ */
  869. MIPI_SEQ_TEAR_OFF, /* sequence block v3+ */
  870. MIPI_SEQ_POWER_ON, /* sequence block v3+ */
  871. MIPI_SEQ_POWER_OFF, /* sequence block v3+ */
  872. MIPI_SEQ_MAX
  873. };
  874. enum mipi_seq_element {
  875. MIPI_SEQ_ELEM_END = 0,
  876. MIPI_SEQ_ELEM_SEND_PKT,
  877. MIPI_SEQ_ELEM_DELAY,
  878. MIPI_SEQ_ELEM_GPIO,
  879. MIPI_SEQ_ELEM_I2C, /* sequence block v2+ */
  880. MIPI_SEQ_ELEM_SPI, /* sequence block v3+ */
  881. MIPI_SEQ_ELEM_PMIC, /* sequence block v3+ */
  882. MIPI_SEQ_ELEM_MAX
  883. };
  884. enum mipi_gpio_pin_index {
  885. MIPI_GPIO_UNDEFINED = 0,
  886. MIPI_GPIO_PANEL_ENABLE,
  887. MIPI_GPIO_BL_ENABLE,
  888. MIPI_GPIO_PWM_ENABLE,
  889. MIPI_GPIO_RESET_N,
  890. MIPI_GPIO_PWR_DOWN_R,
  891. MIPI_GPIO_STDBY_RST_N,
  892. MIPI_GPIO_MAX
  893. };
  894. #endif /* _INTEL_BIOS_H_ */