xref: /openbmc/linux/drivers/gpu/drm/gma500/intel_bios.h (revision ead5d1f4d877e92c051e1a1ade623d0d30e71619)
1a61127c2SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2f910b411SAlan Cox /*
3f910b411SAlan Cox  * Copyright (c) 2006 Intel Corporation
4f910b411SAlan Cox  *
5f910b411SAlan Cox  * Authors:
6f910b411SAlan Cox  *    Eric Anholt <eric@anholt.net>
7f910b411SAlan Cox  */
8f910b411SAlan Cox 
99e8e4636SPatrik Jakobsson #ifndef _INTEL_BIOS_H_
109e8e4636SPatrik Jakobsson #define _INTEL_BIOS_H_
11f910b411SAlan Cox 
1251474335SSam Ravnborg struct drm_device;
13f910b411SAlan Cox 
14f910b411SAlan Cox struct vbt_header {
15f910b411SAlan Cox 	u8 signature[20];		/**< Always starts with 'VBT$' */
16f910b411SAlan Cox 	u16 version;			/**< decimal */
17f910b411SAlan Cox 	u16 header_size;		/**< in bytes */
18f910b411SAlan Cox 	u16 vbt_size;			/**< in bytes */
19f910b411SAlan Cox 	u8 vbt_checksum;
20f910b411SAlan Cox 	u8 reserved0;
21f910b411SAlan Cox 	u32 bdb_offset;			/**< from beginning of VBT */
22f910b411SAlan Cox 	u32 aim_offset[4];		/**< from beginning of VBT */
23657cd71eSEames Trinh } __packed;
24f910b411SAlan Cox 
25f910b411SAlan Cox 
26f910b411SAlan Cox struct bdb_header {
27f910b411SAlan Cox 	u8 signature[16];		/**< Always 'BIOS_DATA_BLOCK' */
28f910b411SAlan Cox 	u16 version;			/**< decimal */
29f910b411SAlan Cox 	u16 header_size;		/**< in bytes */
30f910b411SAlan Cox 	u16 bdb_size;			/**< in bytes */
31f910b411SAlan Cox };
32f910b411SAlan Cox 
33f910b411SAlan Cox /* strictly speaking, this is a "skip" block, but it has interesting info */
34f910b411SAlan Cox struct vbios_data {
35f910b411SAlan Cox 	u8 type; /* 0 == desktop, 1 == mobile */
36f910b411SAlan Cox 	u8 relstage;
37f910b411SAlan Cox 	u8 chipset;
38f910b411SAlan Cox 	u8 lvds_present:1;
39f910b411SAlan Cox 	u8 tv_present:1;
40f910b411SAlan Cox 	u8 rsvd2:6; /* finish byte */
41f910b411SAlan Cox 	u8 rsvd3[4];
42f910b411SAlan Cox 	u8 signon[155];
43f910b411SAlan Cox 	u8 copyright[61];
44f910b411SAlan Cox 	u16 code_segment;
45f910b411SAlan Cox 	u8 dos_boot_mode;
46f910b411SAlan Cox 	u8 bandwidth_percent;
47f910b411SAlan Cox 	u8 rsvd4; /* popup memory size */
48f910b411SAlan Cox 	u8 resize_pci_bios;
49f910b411SAlan Cox 	u8 rsvd5; /* is crt already on ddc2 */
50657cd71eSEames Trinh } __packed;
51f910b411SAlan Cox 
52f910b411SAlan Cox /*
53f910b411SAlan Cox  * There are several types of BIOS data blocks (BDBs), each block has
54f910b411SAlan Cox  * an ID and size in the first 3 bytes (ID in first, size in next 2).
55f910b411SAlan Cox  * Known types are listed below.
56f910b411SAlan Cox  */
57f910b411SAlan Cox #define BDB_GENERAL_FEATURES	  1
58f910b411SAlan Cox #define BDB_GENERAL_DEFINITIONS	  2
59f910b411SAlan Cox #define BDB_OLD_TOGGLE_LIST	  3
60f910b411SAlan Cox #define BDB_MODE_SUPPORT_LIST	  4
61f910b411SAlan Cox #define BDB_GENERIC_MODE_TABLE	  5
62f910b411SAlan Cox #define BDB_EXT_MMIO_REGS	  6
63f910b411SAlan Cox #define BDB_SWF_IO		  7
64f910b411SAlan Cox #define BDB_SWF_MMIO		  8
65f910b411SAlan Cox #define BDB_DOT_CLOCK_TABLE	  9
66f910b411SAlan Cox #define BDB_MODE_REMOVAL_TABLE	 10
67f910b411SAlan Cox #define BDB_CHILD_DEVICE_TABLE	 11
68f910b411SAlan Cox #define BDB_DRIVER_FEATURES	 12
69f910b411SAlan Cox #define BDB_DRIVER_PERSISTENCE	 13
70f910b411SAlan Cox #define BDB_EXT_TABLE_PTRS	 14
71f910b411SAlan Cox #define BDB_DOT_CLOCK_OVERRIDE	 15
72f910b411SAlan Cox #define BDB_DISPLAY_SELECT	 16
73f910b411SAlan Cox /* 17 rsvd */
74f910b411SAlan Cox #define BDB_DRIVER_ROTATION	 18
75f910b411SAlan Cox #define BDB_DISPLAY_REMOVE	 19
76f910b411SAlan Cox #define BDB_OEM_CUSTOM		 20
77f910b411SAlan Cox #define BDB_EFP_LIST		 21 /* workarounds for VGA hsync/vsync */
78f910b411SAlan Cox #define BDB_SDVO_LVDS_OPTIONS	 22
79f910b411SAlan Cox #define BDB_SDVO_PANEL_DTDS	 23
80f910b411SAlan Cox #define BDB_SDVO_LVDS_PNP_IDS	 24
81f910b411SAlan Cox #define BDB_SDVO_LVDS_POWER_SEQ	 25
82f910b411SAlan Cox #define BDB_TV_OPTIONS		 26
83d112a816SZhao Yakui #define BDB_EDP			 27
84f910b411SAlan Cox #define BDB_LVDS_OPTIONS	 40
85f910b411SAlan Cox #define BDB_LVDS_LFP_DATA_PTRS	 41
86f910b411SAlan Cox #define BDB_LVDS_LFP_DATA	 42
87f910b411SAlan Cox #define BDB_LVDS_BACKLIGHT	 43
88f910b411SAlan Cox #define BDB_LVDS_POWER		 44
89f910b411SAlan Cox #define BDB_SKIP		254 /* VBIOS private block, ignore */
90f910b411SAlan Cox 
91f910b411SAlan Cox struct bdb_general_features {
92f910b411SAlan Cox 	/* bits 1 */
93f910b411SAlan Cox 	u8 panel_fitting:2;
94f910b411SAlan Cox 	u8 flexaim:1;
95f910b411SAlan Cox 	u8 msg_enable:1;
96f910b411SAlan Cox 	u8 clear_screen:3;
97f910b411SAlan Cox 	u8 color_flip:1;
98f910b411SAlan Cox 
99f910b411SAlan Cox 	/* bits 2 */
100f910b411SAlan Cox 	u8 download_ext_vbt:1;
101f910b411SAlan Cox 	u8 enable_ssc:1;
102f910b411SAlan Cox 	u8 ssc_freq:1;
103f910b411SAlan Cox 	u8 enable_lfp_on_override:1;
104f910b411SAlan Cox 	u8 disable_ssc_ddt:1;
105f910b411SAlan Cox 	u8 rsvd8:3; /* finish byte */
106f910b411SAlan Cox 
107f910b411SAlan Cox 	/* bits 3 */
108f910b411SAlan Cox 	u8 disable_smooth_vision:1;
109f910b411SAlan Cox 	u8 single_dvi:1;
110f910b411SAlan Cox 	u8 rsvd9:6; /* finish byte */
111f910b411SAlan Cox 
112f910b411SAlan Cox 	/* bits 4 */
113f910b411SAlan Cox 	u8 legacy_monitor_detect;
114f910b411SAlan Cox 
115f910b411SAlan Cox 	/* bits 5 */
116f910b411SAlan Cox 	u8 int_crt_support:1;
117f910b411SAlan Cox 	u8 int_tv_support:1;
1181fb28e9eSAlan Cox 	u8 int_efp_support:1;
1191fb28e9eSAlan Cox 	u8 dp_ssc_enb:1;	/* PCH attached eDP supports SSC */
1201fb28e9eSAlan Cox 	u8 dp_ssc_freq:1;	/* SSC freq for PCH attached eDP */
1211fb28e9eSAlan Cox 	u8 rsvd11:3; /* finish byte */
122657cd71eSEames Trinh } __packed;
123f910b411SAlan Cox 
1241fb28e9eSAlan Cox /* pre-915 */
1251fb28e9eSAlan Cox #define GPIO_PIN_DVI_LVDS	0x03 /* "DVI/LVDS DDC GPIO pins" */
1261fb28e9eSAlan Cox #define GPIO_PIN_ADD_I2C	0x05 /* "ADDCARD I2C GPIO pins" */
1271fb28e9eSAlan Cox #define GPIO_PIN_ADD_DDC	0x04 /* "ADDCARD DDC GPIO pins" */
1281fb28e9eSAlan Cox #define GPIO_PIN_ADD_DDC_I2C	0x06 /* "ADDCARD DDC/I2C GPIO pins" */
1291fb28e9eSAlan Cox 
1301fb28e9eSAlan Cox /* Pre 915 */
1311fb28e9eSAlan Cox #define DEVICE_TYPE_NONE	0x00
1321fb28e9eSAlan Cox #define DEVICE_TYPE_CRT		0x01
1331fb28e9eSAlan Cox #define DEVICE_TYPE_TV		0x09
1341fb28e9eSAlan Cox #define DEVICE_TYPE_EFP		0x12
1351fb28e9eSAlan Cox #define DEVICE_TYPE_LFP		0x22
1361fb28e9eSAlan Cox /* On 915+ */
1371fb28e9eSAlan Cox #define DEVICE_TYPE_CRT_DPMS		0x6001
1381fb28e9eSAlan Cox #define DEVICE_TYPE_CRT_DPMS_HOTPLUG	0x4001
1391fb28e9eSAlan Cox #define DEVICE_TYPE_TV_COMPOSITE	0x0209
1401fb28e9eSAlan Cox #define DEVICE_TYPE_TV_MACROVISION	0x0289
1411fb28e9eSAlan Cox #define DEVICE_TYPE_TV_RF_COMPOSITE	0x020c
1421fb28e9eSAlan Cox #define DEVICE_TYPE_TV_SVIDEO_COMPOSITE	0x0609
1431fb28e9eSAlan Cox #define DEVICE_TYPE_TV_SCART		0x0209
1441fb28e9eSAlan Cox #define DEVICE_TYPE_TV_CODEC_HOTPLUG_PWR 0x6009
1451fb28e9eSAlan Cox #define DEVICE_TYPE_EFP_HOTPLUG_PWR	0x6012
1461fb28e9eSAlan Cox #define DEVICE_TYPE_EFP_DVI_HOTPLUG_PWR	0x6052
1471fb28e9eSAlan Cox #define DEVICE_TYPE_EFP_DVI_I		0x6053
1481fb28e9eSAlan Cox #define DEVICE_TYPE_EFP_DVI_D_DUAL	0x6152
1491fb28e9eSAlan Cox #define DEVICE_TYPE_EFP_DVI_D_HDCP	0x60d2
1501fb28e9eSAlan Cox #define DEVICE_TYPE_OPENLDI_HOTPLUG_PWR	0x6062
1511fb28e9eSAlan Cox #define DEVICE_TYPE_OPENLDI_DUALPIX	0x6162
1521fb28e9eSAlan Cox #define DEVICE_TYPE_LFP_PANELLINK	0x5012
1531fb28e9eSAlan Cox #define DEVICE_TYPE_LFP_CMOS_PWR	0x5042
1541fb28e9eSAlan Cox #define DEVICE_TYPE_LFP_LVDS_PWR	0x5062
1551fb28e9eSAlan Cox #define DEVICE_TYPE_LFP_LVDS_DUAL	0x5162
1561fb28e9eSAlan Cox #define DEVICE_TYPE_LFP_LVDS_DUAL_HDCP	0x51e2
1571fb28e9eSAlan Cox 
1581fb28e9eSAlan Cox #define DEVICE_CFG_NONE		0x00
1591fb28e9eSAlan Cox #define DEVICE_CFG_12BIT_DVOB	0x01
1601fb28e9eSAlan Cox #define DEVICE_CFG_12BIT_DVOC	0x02
1611fb28e9eSAlan Cox #define DEVICE_CFG_24BIT_DVOBC	0x09
1621fb28e9eSAlan Cox #define DEVICE_CFG_24BIT_DVOCB	0x0a
1631fb28e9eSAlan Cox #define DEVICE_CFG_DUAL_DVOB	0x11
1641fb28e9eSAlan Cox #define DEVICE_CFG_DUAL_DVOC	0x12
1651fb28e9eSAlan Cox #define DEVICE_CFG_DUAL_DVOBC	0x13
1661fb28e9eSAlan Cox #define DEVICE_CFG_DUAL_LINK_DVOBC	0x19
1671fb28e9eSAlan Cox #define DEVICE_CFG_DUAL_LINK_DVOCB	0x1a
1681fb28e9eSAlan Cox 
1691fb28e9eSAlan Cox #define DEVICE_WIRE_NONE	0x00
1701fb28e9eSAlan Cox #define DEVICE_WIRE_DVOB	0x01
1711fb28e9eSAlan Cox #define DEVICE_WIRE_DVOC	0x02
1721fb28e9eSAlan Cox #define DEVICE_WIRE_DVOBC	0x03
1731fb28e9eSAlan Cox #define DEVICE_WIRE_DVOBB	0x05
1741fb28e9eSAlan Cox #define DEVICE_WIRE_DVOCC	0x06
1751fb28e9eSAlan Cox #define DEVICE_WIRE_DVOB_MASTER 0x0d
1761fb28e9eSAlan Cox #define DEVICE_WIRE_DVOC_MASTER 0x0e
1771fb28e9eSAlan Cox 
1781fb28e9eSAlan Cox #define DEVICE_PORT_DVOA	0x00 /* none on 845+ */
1791fb28e9eSAlan Cox #define DEVICE_PORT_DVOB	0x01
1801fb28e9eSAlan Cox #define DEVICE_PORT_DVOC	0x02
1811fb28e9eSAlan Cox 
1821fb28e9eSAlan Cox struct child_device_config {
1831fb28e9eSAlan Cox 	u16 handle;
1841fb28e9eSAlan Cox 	u16 device_type;
1851fb28e9eSAlan Cox 	u8  device_id[10]; /* ascii string */
1861fb28e9eSAlan Cox 	u16 addin_offset;
1871fb28e9eSAlan Cox 	u8  dvo_port; /* See Device_PORT_* above */
1881fb28e9eSAlan Cox 	u8  i2c_pin;
1891fb28e9eSAlan Cox 	u8  slave_addr;
1901fb28e9eSAlan Cox 	u8  ddc_pin;
1911fb28e9eSAlan Cox 	u16 edid_ptr;
1921fb28e9eSAlan Cox 	u8  dvo_cfg; /* See DEVICE_CFG_* above */
1931fb28e9eSAlan Cox 	u8  dvo2_port;
1941fb28e9eSAlan Cox 	u8  i2c2_pin;
1951fb28e9eSAlan Cox 	u8  slave2_addr;
1961fb28e9eSAlan Cox 	u8  ddc2_pin;
1971fb28e9eSAlan Cox 	u8  capabilities;
1981fb28e9eSAlan Cox 	u8  dvo_wiring;/* See DEVICE_WIRE_* above */
1991fb28e9eSAlan Cox 	u8  dvo2_wiring;
2001fb28e9eSAlan Cox 	u16 extended_type;
2011fb28e9eSAlan Cox 	u8  dvo_function;
202657cd71eSEames Trinh } __packed;
2031fb28e9eSAlan Cox 
2041fb28e9eSAlan Cox 
205f910b411SAlan Cox struct bdb_general_definitions {
206f910b411SAlan Cox 	/* DDC GPIO */
207f910b411SAlan Cox 	u8 crt_ddc_gmbus_pin;
208f910b411SAlan Cox 
209f910b411SAlan Cox 	/* DPMS bits */
210f910b411SAlan Cox 	u8 dpms_acpi:1;
211f910b411SAlan Cox 	u8 skip_boot_crt_detect:1;
212f910b411SAlan Cox 	u8 dpms_aim:1;
213f910b411SAlan Cox 	u8 rsvd1:5; /* finish byte */
214f910b411SAlan Cox 
215f910b411SAlan Cox 	/* boot device bits */
216f910b411SAlan Cox 	u8 boot_display[2];
217f910b411SAlan Cox 	u8 child_dev_size;
218f910b411SAlan Cox 
2191fb28e9eSAlan Cox 	/*
2201fb28e9eSAlan Cox 	 * Device info:
2211fb28e9eSAlan Cox 	 * If TV is present, it'll be at devices[0].
2221fb28e9eSAlan Cox 	 * LVDS will be next, either devices[0] or [1], if present.
2231fb28e9eSAlan Cox 	 * On some platforms the number of device is 6. But could be as few as
2241fb28e9eSAlan Cox 	 * 4 if both TV and LVDS are missing.
2251fb28e9eSAlan Cox 	 * And the device num is related with the size of general definition
2261fb28e9eSAlan Cox 	 * block. It is obtained by using the following formula:
2271fb28e9eSAlan Cox 	 * number = (block_size - sizeof(bdb_general_definitions))/
2281fb28e9eSAlan Cox 	 *	     sizeof(child_device_config);
2291fb28e9eSAlan Cox 	 */
230*1895a4fcSGustavo A. R. Silva 	struct child_device_config devices[];
231f910b411SAlan Cox };
232f910b411SAlan Cox 
233f910b411SAlan Cox struct bdb_lvds_options {
234f910b411SAlan Cox 	u8 panel_type;
235f910b411SAlan Cox 	u8 rsvd1;
236f910b411SAlan Cox 	/* LVDS capabilities, stored in a dword */
237f910b411SAlan Cox 	u8 pfit_mode:2;
238f910b411SAlan Cox 	u8 pfit_text_mode_enhanced:1;
239f910b411SAlan Cox 	u8 pfit_gfx_mode_enhanced:1;
240f910b411SAlan Cox 	u8 pfit_ratio_auto:1;
241f910b411SAlan Cox 	u8 pixel_dither:1;
242f910b411SAlan Cox 	u8 lvds_edid:1;
243f910b411SAlan Cox 	u8 rsvd2:1;
244f910b411SAlan Cox 	u8 rsvd4;
245657cd71eSEames Trinh } __packed;
246f910b411SAlan Cox 
247f910b411SAlan Cox struct bdb_lvds_backlight {
248f910b411SAlan Cox 	u8 type:2;
249f910b411SAlan Cox 	u8 pol:1;
250f910b411SAlan Cox 	u8 gpio:3;
251f910b411SAlan Cox 	u8 gmbus:2;
252f910b411SAlan Cox 	u16 freq;
253f910b411SAlan Cox 	u8 minbrightness;
254f910b411SAlan Cox 	u8 i2caddr;
255f910b411SAlan Cox 	u8 brightnesscmd;
256f910b411SAlan Cox 	/*FIXME: more...*/
257657cd71eSEames Trinh } __packed;
258f910b411SAlan Cox 
259f910b411SAlan Cox /* LFP pointer table contains entries to the struct below */
260f910b411SAlan Cox struct bdb_lvds_lfp_data_ptr {
261f910b411SAlan Cox 	u16 fp_timing_offset; /* offsets are from start of bdb */
262f910b411SAlan Cox 	u8 fp_table_size;
263f910b411SAlan Cox 	u16 dvo_timing_offset;
264f910b411SAlan Cox 	u8 dvo_table_size;
265f910b411SAlan Cox 	u16 panel_pnp_id_offset;
266f910b411SAlan Cox 	u8 pnp_table_size;
267657cd71eSEames Trinh } __packed;
268f910b411SAlan Cox 
269f910b411SAlan Cox struct bdb_lvds_lfp_data_ptrs {
270f910b411SAlan Cox 	u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
271f910b411SAlan Cox 	struct bdb_lvds_lfp_data_ptr ptr[16];
272657cd71eSEames Trinh } __packed;
273f910b411SAlan Cox 
274f910b411SAlan Cox /* LFP data has 3 blocks per entry */
275f910b411SAlan Cox struct lvds_fp_timing {
276f910b411SAlan Cox 	u16 x_res;
277f910b411SAlan Cox 	u16 y_res;
278f910b411SAlan Cox 	u32 lvds_reg;
279f910b411SAlan Cox 	u32 lvds_reg_val;
280f910b411SAlan Cox 	u32 pp_on_reg;
281f910b411SAlan Cox 	u32 pp_on_reg_val;
282f910b411SAlan Cox 	u32 pp_off_reg;
283f910b411SAlan Cox 	u32 pp_off_reg_val;
284f910b411SAlan Cox 	u32 pp_cycle_reg;
285f910b411SAlan Cox 	u32 pp_cycle_reg_val;
286f910b411SAlan Cox 	u32 pfit_reg;
287f910b411SAlan Cox 	u32 pfit_reg_val;
288f910b411SAlan Cox 	u16 terminator;
289657cd71eSEames Trinh } __packed;
290f910b411SAlan Cox 
291f910b411SAlan Cox struct lvds_dvo_timing {
292f910b411SAlan Cox 	u16 clock;		/**< In 10khz */
293f910b411SAlan Cox 	u8 hactive_lo;
294f910b411SAlan Cox 	u8 hblank_lo;
295f910b411SAlan Cox 	u8 hblank_hi:4;
296f910b411SAlan Cox 	u8 hactive_hi:4;
297f910b411SAlan Cox 	u8 vactive_lo;
298f910b411SAlan Cox 	u8 vblank_lo;
299f910b411SAlan Cox 	u8 vblank_hi:4;
300f910b411SAlan Cox 	u8 vactive_hi:4;
301f910b411SAlan Cox 	u8 hsync_off_lo;
302f910b411SAlan Cox 	u8 hsync_pulse_width;
303f910b411SAlan Cox 	u8 vsync_pulse_width:4;
304f910b411SAlan Cox 	u8 vsync_off:4;
305f910b411SAlan Cox 	u8 rsvd0:6;
306f910b411SAlan Cox 	u8 hsync_off_hi:2;
307f910b411SAlan Cox 	u8 h_image;
308f910b411SAlan Cox 	u8 v_image;
309f910b411SAlan Cox 	u8 max_hv;
310f910b411SAlan Cox 	u8 h_border;
311f910b411SAlan Cox 	u8 v_border;
312f910b411SAlan Cox 	u8 rsvd1:3;
313f910b411SAlan Cox 	u8 digital:2;
314f910b411SAlan Cox 	u8 vsync_positive:1;
315f910b411SAlan Cox 	u8 hsync_positive:1;
316f910b411SAlan Cox 	u8 rsvd2:1;
317657cd71eSEames Trinh } __packed;
318f910b411SAlan Cox 
319f910b411SAlan Cox struct lvds_pnp_id {
320f910b411SAlan Cox 	u16 mfg_name;
321f910b411SAlan Cox 	u16 product_code;
322f910b411SAlan Cox 	u32 serial;
323f910b411SAlan Cox 	u8 mfg_week;
324f910b411SAlan Cox 	u8 mfg_year;
325657cd71eSEames Trinh } __packed;
326f910b411SAlan Cox 
327f910b411SAlan Cox struct bdb_lvds_lfp_data_entry {
328f910b411SAlan Cox 	struct lvds_fp_timing fp_timing;
329f910b411SAlan Cox 	struct lvds_dvo_timing dvo_timing;
330f910b411SAlan Cox 	struct lvds_pnp_id pnp_id;
331657cd71eSEames Trinh } __packed;
332f910b411SAlan Cox 
333f910b411SAlan Cox struct bdb_lvds_lfp_data {
334f910b411SAlan Cox 	struct bdb_lvds_lfp_data_entry data[16];
335657cd71eSEames Trinh } __packed;
336f910b411SAlan Cox 
337f910b411SAlan Cox struct aimdb_header {
338f910b411SAlan Cox 	char signature[16];
339f910b411SAlan Cox 	char oem_device[20];
340f910b411SAlan Cox 	u16 aimdb_version;
341f910b411SAlan Cox 	u16 aimdb_header_size;
342f910b411SAlan Cox 	u16 aimdb_size;
343657cd71eSEames Trinh } __packed;
344f910b411SAlan Cox 
345f910b411SAlan Cox struct aimdb_block {
346f910b411SAlan Cox 	u8 aimdb_id;
347f910b411SAlan Cox 	u16 aimdb_size;
348657cd71eSEames Trinh } __packed;
349f910b411SAlan Cox 
350f910b411SAlan Cox struct vch_panel_data {
351f910b411SAlan Cox 	u16 fp_timing_offset;
352f910b411SAlan Cox 	u8 fp_timing_size;
353f910b411SAlan Cox 	u16 dvo_timing_offset;
354f910b411SAlan Cox 	u8 dvo_timing_size;
355f910b411SAlan Cox 	u16 text_fitting_offset;
356f910b411SAlan Cox 	u8 text_fitting_size;
357f910b411SAlan Cox 	u16 graphics_fitting_offset;
358f910b411SAlan Cox 	u8 graphics_fitting_size;
359657cd71eSEames Trinh } __packed;
360f910b411SAlan Cox 
361f910b411SAlan Cox struct vch_bdb_22 {
362f910b411SAlan Cox 	struct aimdb_block aimdb_block;
363f910b411SAlan Cox 	struct vch_panel_data panels[16];
364657cd71eSEames Trinh } __packed;
365f910b411SAlan Cox 
366f910b411SAlan Cox struct bdb_sdvo_lvds_options {
367f910b411SAlan Cox 	u8 panel_backlight;
368f910b411SAlan Cox 	u8 h40_set_panel_type;
369f910b411SAlan Cox 	u8 panel_type;
370f910b411SAlan Cox 	u8 ssc_clk_freq;
371f910b411SAlan Cox 	u16 als_low_trip;
372f910b411SAlan Cox 	u16 als_high_trip;
373f910b411SAlan Cox 	u8 sclalarcoeff_tab_row_num;
374f910b411SAlan Cox 	u8 sclalarcoeff_tab_row_size;
375f910b411SAlan Cox 	u8 coefficient[8];
376f910b411SAlan Cox 	u8 panel_misc_bits_1;
377f910b411SAlan Cox 	u8 panel_misc_bits_2;
378f910b411SAlan Cox 	u8 panel_misc_bits_3;
379f910b411SAlan Cox 	u8 panel_misc_bits_4;
380657cd71eSEames Trinh } __packed;
381f910b411SAlan Cox 
382d112a816SZhao Yakui #define BDB_DRIVER_FEATURE_NO_LVDS		0
383d112a816SZhao Yakui #define BDB_DRIVER_FEATURE_INT_LVDS		1
384d112a816SZhao Yakui #define BDB_DRIVER_FEATURE_SDVO_LVDS		2
385d112a816SZhao Yakui #define BDB_DRIVER_FEATURE_EDP			3
386d112a816SZhao Yakui 
387642c52fcSAlan Cox struct bdb_driver_features {
388642c52fcSAlan Cox 	u8 boot_dev_algorithm:1;
389642c52fcSAlan Cox 	u8 block_display_switch:1;
390642c52fcSAlan Cox 	u8 allow_display_switch:1;
391642c52fcSAlan Cox 	u8 hotplug_dvo:1;
392642c52fcSAlan Cox 	u8 dual_view_zoom:1;
393642c52fcSAlan Cox 	u8 int15h_hook:1;
394642c52fcSAlan Cox 	u8 sprite_in_clone:1;
395642c52fcSAlan Cox 	u8 primary_lfp_id:1;
396642c52fcSAlan Cox 
397642c52fcSAlan Cox 	u16 boot_mode_x;
398642c52fcSAlan Cox 	u16 boot_mode_y;
399642c52fcSAlan Cox 	u8 boot_mode_bpp;
400642c52fcSAlan Cox 	u8 boot_mode_refresh;
401642c52fcSAlan Cox 
402642c52fcSAlan Cox 	u16 enable_lfp_primary:1;
403642c52fcSAlan Cox 	u16 selective_mode_pruning:1;
404642c52fcSAlan Cox 	u16 dual_frequency:1;
405642c52fcSAlan Cox 	u16 render_clock_freq:1; /* 0: high freq; 1: low freq */
406642c52fcSAlan Cox 	u16 nt_clone_support:1;
407642c52fcSAlan Cox 	u16 power_scheme_ui:1; /* 0: CUI; 1: 3rd party */
408642c52fcSAlan Cox 	u16 sprite_display_assign:1; /* 0: secondary; 1: primary */
409642c52fcSAlan Cox 	u16 cui_aspect_scaling:1;
410642c52fcSAlan Cox 	u16 preserve_aspect_ratio:1;
411642c52fcSAlan Cox 	u16 sdvo_device_power_down:1;
412642c52fcSAlan Cox 	u16 crt_hotplug:1;
413642c52fcSAlan Cox 	u16 lvds_config:2;
414642c52fcSAlan Cox 	u16 tv_hotplug:1;
415642c52fcSAlan Cox 	u16 hdmi_config:2;
416642c52fcSAlan Cox 
417642c52fcSAlan Cox 	u8 static_display:1;
418642c52fcSAlan Cox 	u8 reserved2:7;
419642c52fcSAlan Cox 	u16 legacy_crt_max_x;
420642c52fcSAlan Cox 	u16 legacy_crt_max_y;
421642c52fcSAlan Cox 	u8 legacy_crt_max_refresh;
422642c52fcSAlan Cox 
423642c52fcSAlan Cox 	u8 hdmi_termination;
424642c52fcSAlan Cox 	u8 custom_vbt_version;
425657cd71eSEames Trinh } __packed;
426f910b411SAlan Cox 
427d112a816SZhao Yakui #define EDP_18BPP	0
428d112a816SZhao Yakui #define EDP_24BPP	1
429d112a816SZhao Yakui #define EDP_30BPP	2
430d112a816SZhao Yakui #define EDP_RATE_1_62	0
431d112a816SZhao Yakui #define EDP_RATE_2_7	1
432d112a816SZhao Yakui #define EDP_LANE_1	0
433d112a816SZhao Yakui #define EDP_LANE_2	1
434d112a816SZhao Yakui #define EDP_LANE_4	3
435d112a816SZhao Yakui #define EDP_PREEMPHASIS_NONE	0
436d112a816SZhao Yakui #define EDP_PREEMPHASIS_3_5dB	1
437d112a816SZhao Yakui #define EDP_PREEMPHASIS_6dB	2
438d112a816SZhao Yakui #define EDP_PREEMPHASIS_9_5dB	3
439d112a816SZhao Yakui #define EDP_VSWING_0_4V		0
440d112a816SZhao Yakui #define EDP_VSWING_0_6V		1
441d112a816SZhao Yakui #define EDP_VSWING_0_8V		2
442d112a816SZhao Yakui #define EDP_VSWING_1_2V		3
443d112a816SZhao Yakui 
444d112a816SZhao Yakui struct edp_power_seq {
445d112a816SZhao Yakui 	u16 t1_t3;
446d112a816SZhao Yakui 	u16 t8;
447d112a816SZhao Yakui 	u16 t9;
448d112a816SZhao Yakui 	u16 t10;
449d112a816SZhao Yakui 	u16 t11_t12;
450d112a816SZhao Yakui } __attribute__ ((packed));
451d112a816SZhao Yakui 
452d112a816SZhao Yakui struct edp_link_params {
453d112a816SZhao Yakui 	u8 rate:4;
454d112a816SZhao Yakui 	u8 lanes:4;
455d112a816SZhao Yakui 	u8 preemphasis:4;
456d112a816SZhao Yakui 	u8 vswing:4;
457d112a816SZhao Yakui } __attribute__ ((packed));
458d112a816SZhao Yakui 
459d112a816SZhao Yakui struct bdb_edp {
460d112a816SZhao Yakui 	struct edp_power_seq power_seqs[16];
461d112a816SZhao Yakui 	u32 color_depth;
462d112a816SZhao Yakui 	u32 sdrrs_msa_timing_delay;
463d112a816SZhao Yakui 	struct edp_link_params link_params[16];
464d112a816SZhao Yakui } __attribute__ ((packed));
465d112a816SZhao Yakui 
4660317c6ceSDan Carpenter extern int psb_intel_init_bios(struct drm_device *dev);
467f910b411SAlan Cox extern void psb_intel_destroy_bios(struct drm_device *dev);
468f910b411SAlan Cox 
469f910b411SAlan Cox /*
470f910b411SAlan Cox  * Driver<->VBIOS interaction occurs through scratch bits in
471f910b411SAlan Cox  * GR18 & SWF*.
472f910b411SAlan Cox  */
473f910b411SAlan Cox 
474f910b411SAlan Cox /* GR18 bits are set on display switch and hotkey events */
475f910b411SAlan Cox #define GR18_DRIVER_SWITCH_EN	(1<<7) /* 0: VBIOS control, 1: driver control */
476f910b411SAlan Cox #define GR18_HOTKEY_MASK	0x78 /* See also SWF4 15:0 */
477f910b411SAlan Cox #define   GR18_HK_NONE		(0x0<<3)
478f910b411SAlan Cox #define   GR18_HK_LFP_STRETCH	(0x1<<3)
479f910b411SAlan Cox #define   GR18_HK_TOGGLE_DISP	(0x2<<3)
480f910b411SAlan Cox #define   GR18_HK_DISP_SWITCH	(0x4<<3) /* see SWF14 15:0 for what to enable */
481f910b411SAlan Cox #define   GR18_HK_POPUP_DISABLED (0x6<<3)
482f910b411SAlan Cox #define   GR18_HK_POPUP_ENABLED	(0x7<<3)
483f910b411SAlan Cox #define   GR18_HK_PFIT		(0x8<<3)
484f910b411SAlan Cox #define   GR18_HK_APM_CHANGE	(0xa<<3)
485f910b411SAlan Cox #define   GR18_HK_MULTIPLE	(0xc<<3)
486f910b411SAlan Cox #define GR18_USER_INT_EN	(1<<2)
487f910b411SAlan Cox #define GR18_A0000_FLUSH_EN	(1<<1)
488f910b411SAlan Cox #define GR18_SMM_EN		(1<<0)
489f910b411SAlan Cox 
490f910b411SAlan Cox /* Set by driver, cleared by VBIOS */
491f910b411SAlan Cox #define SWF00_YRES_SHIFT	16
492f910b411SAlan Cox #define SWF00_XRES_SHIFT	0
493f910b411SAlan Cox #define SWF00_RES_MASK		0xffff
494f910b411SAlan Cox 
495f910b411SAlan Cox /* Set by VBIOS at boot time and driver at runtime */
496f910b411SAlan Cox #define SWF01_TV2_FORMAT_SHIFT	8
497f910b411SAlan Cox #define SWF01_TV1_FORMAT_SHIFT	0
498f910b411SAlan Cox #define SWF01_TV_FORMAT_MASK	0xffff
499f910b411SAlan Cox 
500f910b411SAlan Cox #define SWF10_VBIOS_BLC_I2C_EN	(1<<29)
501f910b411SAlan Cox #define SWF10_GTT_OVERRIDE_EN	(1<<28)
502f910b411SAlan Cox #define SWF10_LFP_DPMS_OVR	(1<<27) /* override DPMS on display switch */
503f910b411SAlan Cox #define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
504f910b411SAlan Cox #define   SWF10_OLD_TOGGLE	0x0
505f910b411SAlan Cox #define   SWF10_TOGGLE_LIST_1	0x1
506f910b411SAlan Cox #define   SWF10_TOGGLE_LIST_2	0x2
507f910b411SAlan Cox #define   SWF10_TOGGLE_LIST_3	0x3
508f910b411SAlan Cox #define   SWF10_TOGGLE_LIST_4	0x4
509f910b411SAlan Cox #define SWF10_PANNING_EN	(1<<23)
510f910b411SAlan Cox #define SWF10_DRIVER_LOADED	(1<<22)
511f910b411SAlan Cox #define SWF10_EXTENDED_DESKTOP	(1<<21)
512f910b411SAlan Cox #define SWF10_EXCLUSIVE_MODE	(1<<20)
513f910b411SAlan Cox #define SWF10_OVERLAY_EN	(1<<19)
514f910b411SAlan Cox #define SWF10_PLANEB_HOLDOFF	(1<<18)
515f910b411SAlan Cox #define SWF10_PLANEA_HOLDOFF	(1<<17)
516f910b411SAlan Cox #define SWF10_VGA_HOLDOFF	(1<<16)
517f910b411SAlan Cox #define SWF10_ACTIVE_DISP_MASK	0xffff
518f910b411SAlan Cox #define   SWF10_PIPEB_LFP2	(1<<15)
519f910b411SAlan Cox #define   SWF10_PIPEB_EFP2	(1<<14)
520f910b411SAlan Cox #define   SWF10_PIPEB_TV2	(1<<13)
521f910b411SAlan Cox #define   SWF10_PIPEB_CRT2	(1<<12)
522f910b411SAlan Cox #define   SWF10_PIPEB_LFP	(1<<11)
523f910b411SAlan Cox #define   SWF10_PIPEB_EFP	(1<<10)
524f910b411SAlan Cox #define   SWF10_PIPEB_TV	(1<<9)
525f910b411SAlan Cox #define   SWF10_PIPEB_CRT	(1<<8)
526f910b411SAlan Cox #define   SWF10_PIPEA_LFP2	(1<<7)
527f910b411SAlan Cox #define   SWF10_PIPEA_EFP2	(1<<6)
528f910b411SAlan Cox #define   SWF10_PIPEA_TV2	(1<<5)
529f910b411SAlan Cox #define   SWF10_PIPEA_CRT2	(1<<4)
530f910b411SAlan Cox #define   SWF10_PIPEA_LFP	(1<<3)
531f910b411SAlan Cox #define   SWF10_PIPEA_EFP	(1<<2)
532f910b411SAlan Cox #define   SWF10_PIPEA_TV	(1<<1)
533f910b411SAlan Cox #define   SWF10_PIPEA_CRT	(1<<0)
534f910b411SAlan Cox 
535f910b411SAlan Cox #define SWF11_MEMORY_SIZE_SHIFT	16
536f910b411SAlan Cox #define SWF11_SV_TEST_EN	(1<<15)
537f910b411SAlan Cox #define SWF11_IS_AGP		(1<<14)
538f910b411SAlan Cox #define SWF11_DISPLAY_HOLDOFF	(1<<13)
539f910b411SAlan Cox #define SWF11_DPMS_REDUCED	(1<<12)
540f910b411SAlan Cox #define SWF11_IS_VBE_MODE	(1<<11)
541f910b411SAlan Cox #define SWF11_PIPEB_ACCESS	(1<<10) /* 0 here means pipe a */
542f910b411SAlan Cox #define SWF11_DPMS_MASK		0x07
543f910b411SAlan Cox #define   SWF11_DPMS_OFF	(1<<2)
544f910b411SAlan Cox #define   SWF11_DPMS_SUSPEND	(1<<1)
545f910b411SAlan Cox #define   SWF11_DPMS_STANDBY	(1<<0)
546f910b411SAlan Cox #define   SWF11_DPMS_ON		0
547f910b411SAlan Cox 
548f910b411SAlan Cox #define SWF14_GFX_PFIT_EN	(1<<31)
549f910b411SAlan Cox #define SWF14_TEXT_PFIT_EN	(1<<30)
550f910b411SAlan Cox #define SWF14_LID_STATUS_CLOSED	(1<<29) /* 0 here means open */
551f910b411SAlan Cox #define SWF14_POPUP_EN		(1<<28)
552f910b411SAlan Cox #define SWF14_DISPLAY_HOLDOFF	(1<<27)
553f910b411SAlan Cox #define SWF14_DISP_DETECT_EN	(1<<26)
554f910b411SAlan Cox #define SWF14_DOCKING_STATUS_DOCKED (1<<25) /* 0 here means undocked */
555f910b411SAlan Cox #define SWF14_DRIVER_STATUS	(1<<24)
556f910b411SAlan Cox #define SWF14_OS_TYPE_WIN9X	(1<<23)
557f910b411SAlan Cox #define SWF14_OS_TYPE_WINNT	(1<<22)
558f910b411SAlan Cox /* 21:19 rsvd */
559f910b411SAlan Cox #define SWF14_PM_TYPE_MASK	0x00070000
560f910b411SAlan Cox #define   SWF14_PM_ACPI_VIDEO	(0x4 << 16)
561f910b411SAlan Cox #define   SWF14_PM_ACPI		(0x3 << 16)
562f910b411SAlan Cox #define   SWF14_PM_APM_12	(0x2 << 16)
563f910b411SAlan Cox #define   SWF14_PM_APM_11	(0x1 << 16)
564f910b411SAlan Cox #define SWF14_HK_REQUEST_MASK	0x0000ffff /* see GR18 6:3 for event type */
565f910b411SAlan Cox 	  /* if GR18 indicates a display switch */
566f910b411SAlan Cox #define   SWF14_DS_PIPEB_LFP2_EN (1<<15)
567f910b411SAlan Cox #define   SWF14_DS_PIPEB_EFP2_EN (1<<14)
568f910b411SAlan Cox #define   SWF14_DS_PIPEB_TV2_EN  (1<<13)
569f910b411SAlan Cox #define   SWF14_DS_PIPEB_CRT2_EN (1<<12)
570f910b411SAlan Cox #define   SWF14_DS_PIPEB_LFP_EN  (1<<11)
571f910b411SAlan Cox #define   SWF14_DS_PIPEB_EFP_EN  (1<<10)
572f910b411SAlan Cox #define   SWF14_DS_PIPEB_TV_EN	 (1<<9)
573f910b411SAlan Cox #define   SWF14_DS_PIPEB_CRT_EN  (1<<8)
574f910b411SAlan Cox #define   SWF14_DS_PIPEA_LFP2_EN (1<<7)
575f910b411SAlan Cox #define   SWF14_DS_PIPEA_EFP2_EN (1<<6)
576f910b411SAlan Cox #define   SWF14_DS_PIPEA_TV2_EN  (1<<5)
577f910b411SAlan Cox #define   SWF14_DS_PIPEA_CRT2_EN (1<<4)
578f910b411SAlan Cox #define   SWF14_DS_PIPEA_LFP_EN  (1<<3)
579f910b411SAlan Cox #define   SWF14_DS_PIPEA_EFP_EN  (1<<2)
580f910b411SAlan Cox #define   SWF14_DS_PIPEA_TV_EN	 (1<<1)
581f910b411SAlan Cox #define   SWF14_DS_PIPEA_CRT_EN  (1<<0)
582f910b411SAlan Cox 	  /* if GR18 indicates a panel fitting request */
583f910b411SAlan Cox #define   SWF14_PFIT_EN		(1<<0) /* 0 means disable */
584f910b411SAlan Cox 	  /* if GR18 indicates an APM change request */
585f910b411SAlan Cox #define   SWF14_APM_HIBERNATE	0x4
586f910b411SAlan Cox #define   SWF14_APM_SUSPEND	0x3
587f910b411SAlan Cox #define   SWF14_APM_STANDBY	0x1
588f910b411SAlan Cox #define   SWF14_APM_RESTORE	0x0
589f910b411SAlan Cox 
5901fb28e9eSAlan Cox /* Add the device class for LFP, TV, HDMI */
5911fb28e9eSAlan Cox #define	 DEVICE_TYPE_INT_LFP	0x1022
5921fb28e9eSAlan Cox #define	 DEVICE_TYPE_INT_TV	0x1009
5931fb28e9eSAlan Cox #define	 DEVICE_TYPE_HDMI	0x60D2
5941fb28e9eSAlan Cox #define	 DEVICE_TYPE_DP		0x68C6
5951fb28e9eSAlan Cox #define	 DEVICE_TYPE_eDP	0x78C6
5961fb28e9eSAlan Cox 
5971fb28e9eSAlan Cox /* define the DVO port for HDMI output type */
5981fb28e9eSAlan Cox #define		DVO_B		1
5991fb28e9eSAlan Cox #define		DVO_C		2
6001fb28e9eSAlan Cox #define		DVO_D		3
6011fb28e9eSAlan Cox 
6021fb28e9eSAlan Cox /* define the PORT for DP output type */
6031fb28e9eSAlan Cox #define		PORT_IDPB	7
6041fb28e9eSAlan Cox #define		PORT_IDPC	8
6051fb28e9eSAlan Cox #define		PORT_IDPD	9
6061fb28e9eSAlan Cox 
6079e8e4636SPatrik Jakobsson #endif /* _INTEL_BIOS_H_ */
608