Subversion Repositories Kolibri OS

Rev

Rev 3746 | Rev 5060 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3746 Rev 4560
Line 37... Line 37...
37
	u16 vbt_size;			/**< in bytes */
37
	u16 vbt_size;			/**< in bytes */
38
	u8 vbt_checksum;
38
	u8 vbt_checksum;
39
	u8 reserved0;
39
	u8 reserved0;
40
	u32 bdb_offset;			/**< from beginning of VBT */
40
	u32 bdb_offset;			/**< from beginning of VBT */
41
	u32 aim_offset[4];		/**< from beginning of VBT */
41
	u32 aim_offset[4];		/**< from beginning of VBT */
42
} __attribute__((packed));
42
} __packed;
Line 43... Line 43...
43
 
43
 
44
struct bdb_header {
44
struct bdb_header {
45
	u8 signature[16];		/**< Always 'BIOS_DATA_BLOCK' */
45
	u8 signature[16];		/**< Always 'BIOS_DATA_BLOCK' */
46
	u16 version;			/**< decimal */
46
	u16 version;			/**< decimal */
Line 63... Line 63...
63
	u8 dos_boot_mode;
63
	u8 dos_boot_mode;
64
	u8 bandwidth_percent;
64
	u8 bandwidth_percent;
65
	u8 rsvd4; /* popup memory size */
65
	u8 rsvd4; /* popup memory size */
66
	u8 resize_pci_bios;
66
	u8 resize_pci_bios;
67
	u8 rsvd5; /* is crt already on ddc2 */
67
	u8 rsvd5; /* is crt already on ddc2 */
68
} __attribute__((packed));
68
} __packed;
Line 69... Line 69...
69
 
69
 
70
/*
70
/*
71
 * There are several types of BIOS data blocks (BDBs), each block has
71
 * There are several types of BIOS data blocks (BDBs), each block has
72
 * an ID and size in the first 3 bytes (ID in first, size in next 2).
72
 * an ID and size in the first 3 bytes (ID in first, size in next 2).
Line 102... Line 102...
102
#define BDB_LVDS_OPTIONS	 40
102
#define BDB_LVDS_OPTIONS	 40
103
#define BDB_LVDS_LFP_DATA_PTRS	 41
103
#define BDB_LVDS_LFP_DATA_PTRS	 41
104
#define BDB_LVDS_LFP_DATA	 42
104
#define BDB_LVDS_LFP_DATA	 42
105
#define BDB_LVDS_BACKLIGHT	 43
105
#define BDB_LVDS_BACKLIGHT	 43
106
#define BDB_LVDS_POWER		 44
106
#define BDB_LVDS_POWER		 44
-
 
107
#define BDB_MIPI		 50
107
#define BDB_SKIP		254 /* VBIOS private block, ignore */
108
#define BDB_SKIP		254 /* VBIOS private block, ignore */
Line 108... Line 109...
108
 
109
 
109
struct bdb_general_features {
110
struct bdb_general_features {
110
        /* bits 1 */
111
        /* bits 1 */
Line 139... Line 140...
139
	u8 int_tv_support:1;
140
	u8 int_tv_support:1;
140
	u8 int_efp_support:1;
141
	u8 int_efp_support:1;
141
	u8 dp_ssc_enb:1;	/* PCH attached eDP supports SSC */
142
	u8 dp_ssc_enb:1;	/* PCH attached eDP supports SSC */
142
	u8 dp_ssc_freq:1;	/* SSC freq for PCH attached eDP */
143
	u8 dp_ssc_freq:1;	/* SSC freq for PCH attached eDP */
143
	u8 rsvd11:3; /* finish byte */
144
	u8 rsvd11:3; /* finish byte */
144
} __attribute__((packed));
145
} __packed;
Line 145... Line 146...
145
 
146
 
146
/* pre-915 */
147
/* pre-915 */
147
#define GPIO_PIN_DVI_LVDS	0x03 /* "DVI/LVDS DDC GPIO pins" */
148
#define GPIO_PIN_DVI_LVDS	0x03 /* "DVI/LVDS DDC GPIO pins" */
148
#define GPIO_PIN_ADD_I2C	0x05 /* "ADDCARD I2C GPIO pins" */
149
#define GPIO_PIN_ADD_I2C	0x05 /* "ADDCARD I2C GPIO pins" */
Line 199... Line 200...
199
 
200
 
200
#define DEVICE_PORT_DVOA	0x00 /* none on 845+ */
201
#define DEVICE_PORT_DVOA	0x00 /* none on 845+ */
201
#define DEVICE_PORT_DVOB	0x01
202
#define DEVICE_PORT_DVOB	0x01
Line -... Line 203...
-
 
203
#define DEVICE_PORT_DVOC	0x02
-
 
204
 
-
 
205
/* We used to keep this struct but without any version control. We should avoid
202
#define DEVICE_PORT_DVOC	0x02
206
 * using it in the future, but it should be safe to keep using it in the old
203
 
207
 * code. */
204
struct child_device_config {
208
struct old_child_dev_config {
205
	u16 handle;
209
	u16 handle;
206
	u16 device_type;
210
	u16 device_type;
207
	u8  device_id[10]; /* ascii string */
211
	u8  device_id[10]; /* ascii string */
Line 219... Line 223...
219
	u8  capabilities;
223
	u8  capabilities;
220
	u8  dvo_wiring;/* See DEVICE_WIRE_* above */
224
	u8  dvo_wiring;/* See DEVICE_WIRE_* above */
221
	u8  dvo2_wiring;
225
	u8  dvo2_wiring;
222
	u16 extended_type;
226
	u16 extended_type;
223
	u8  dvo_function;
227
	u8  dvo_function;
224
} __attribute__((packed));
228
} __packed;
-
 
229
 
-
 
230
/* This one contains field offsets that are known to be common for all BDB
-
 
231
 * versions. Notice that the meaning of the contents contents may still change,
-
 
232
 * but at least the offsets are consistent. */
-
 
233
struct common_child_dev_config {
-
 
234
	u16 handle;
-
 
235
	u16 device_type;
-
 
236
	u8 not_common1[12];
-
 
237
	u8 dvo_port;
-
 
238
	u8 not_common2[2];
-
 
239
	u8 ddc_pin;
-
 
240
	u16 edid_ptr;
-
 
241
} __packed;
-
 
242
 
-
 
243
/* This field changes depending on the BDB version, so the most reliable way to
-
 
244
 * read it is by checking the BDB version and reading the raw pointer. */
-
 
245
union child_device_config {
-
 
246
	/* This one is safe to be used anywhere, but the code should still check
-
 
247
	 * the BDB version. */
-
 
248
	u8 raw[33];
-
 
249
	/* This one should only be kept for legacy code. */
-
 
250
	struct old_child_dev_config old;
-
 
251
	/* This one should also be safe to use anywhere, even without version
-
 
252
	 * checks. */
-
 
253
	struct common_child_dev_config common;
-
 
254
};
Line 225... Line 255...
225
 
255
 
226
struct bdb_general_definitions {
256
struct bdb_general_definitions {
227
	/* DDC GPIO */
257
	/* DDC GPIO */
Line 246... Line 276...
246
	 * And the device num is related with the size of general definition
276
	 * And the device num is related with the size of general definition
247
	 * block. It is obtained by using the following formula:
277
	 * block. It is obtained by using the following formula:
248
	 * number = (block_size - sizeof(bdb_general_definitions))/
278
	 * number = (block_size - sizeof(bdb_general_definitions))/
249
	 *	     sizeof(child_device_config);
279
	 *	     sizeof(child_device_config);
250
	 */
280
	 */
251
	struct child_device_config devices[0];
281
	union child_device_config devices[0];
252
} __attribute__((packed));
282
} __packed;
Line 253... Line 283...
253
 
283
 
254
struct bdb_lvds_options {
284
struct bdb_lvds_options {
255
	u8 panel_type;
285
	u8 panel_type;
256
	u8 rsvd1;
286
	u8 rsvd1;
Line 261... Line 291...
261
	u8 pfit_ratio_auto:1;
291
	u8 pfit_ratio_auto:1;
262
	u8 pixel_dither:1;
292
	u8 pixel_dither:1;
263
	u8 lvds_edid:1;
293
	u8 lvds_edid:1;
264
	u8 rsvd2:1;
294
	u8 rsvd2:1;
265
	u8 rsvd4;
295
	u8 rsvd4;
266
} __attribute__((packed));
296
} __packed;
Line 267... Line 297...
267
 
297
 
268
/* LFP pointer table contains entries to the struct below */
298
/* LFP pointer table contains entries to the struct below */
269
struct bdb_lvds_lfp_data_ptr {
299
struct bdb_lvds_lfp_data_ptr {
270
	u16 fp_timing_offset; /* offsets are from start of bdb */
300
	u16 fp_timing_offset; /* offsets are from start of bdb */
271
	u8 fp_table_size;
301
	u8 fp_table_size;
272
	u16 dvo_timing_offset;
302
	u16 dvo_timing_offset;
273
	u8 dvo_table_size;
303
	u8 dvo_table_size;
274
	u16 panel_pnp_id_offset;
304
	u16 panel_pnp_id_offset;
275
	u8 pnp_table_size;
305
	u8 pnp_table_size;
Line 276... Line 306...
276
} __attribute__((packed));
306
} __packed;
277
 
307
 
278
struct bdb_lvds_lfp_data_ptrs {
308
struct bdb_lvds_lfp_data_ptrs {
279
	u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
309
	u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
Line 280... Line 310...
280
	struct bdb_lvds_lfp_data_ptr ptr[16];
310
	struct bdb_lvds_lfp_data_ptr ptr[16];
281
} __attribute__((packed));
311
} __packed;
282
 
312
 
283
/* LFP data has 3 blocks per entry */
313
/* LFP data has 3 blocks per entry */
Line 293... Line 323...
293
	u32 pp_cycle_reg;
323
	u32 pp_cycle_reg;
294
	u32 pp_cycle_reg_val;
324
	u32 pp_cycle_reg_val;
295
	u32 pfit_reg;
325
	u32 pfit_reg;
296
	u32 pfit_reg_val;
326
	u32 pfit_reg_val;
297
	u16 terminator;
327
	u16 terminator;
298
} __attribute__((packed));
328
} __packed;
Line 299... Line 329...
299
 
329
 
300
struct lvds_dvo_timing {
330
struct lvds_dvo_timing {
301
	u16 clock;		/**< In 10khz */
331
	u16 clock;		/**< In 10khz */
302
	u8 hactive_lo;
332
	u8 hactive_lo;
Line 321... Line 351...
321
	u8 rsvd1:3;
351
	u8 rsvd1:3;
322
	u8 digital:2;
352
	u8 digital:2;
323
	u8 vsync_positive:1;
353
	u8 vsync_positive:1;
324
	u8 hsync_positive:1;
354
	u8 hsync_positive:1;
325
	u8 rsvd2:1;
355
	u8 rsvd2:1;
326
} __attribute__((packed));
356
} __packed;
Line 327... Line 357...
327
 
357
 
328
struct lvds_pnp_id {
358
struct lvds_pnp_id {
329
	u16 mfg_name;
359
	u16 mfg_name;
330
	u16 product_code;
360
	u16 product_code;
331
	u32 serial;
361
	u32 serial;
332
	u8 mfg_week;
362
	u8 mfg_week;
333
	u8 mfg_year;
363
	u8 mfg_year;
Line 334... Line 364...
334
} __attribute__((packed));
364
} __packed;
335
 
365
 
336
struct bdb_lvds_lfp_data_entry {
366
struct bdb_lvds_lfp_data_entry {
337
	struct lvds_fp_timing fp_timing;
367
	struct lvds_fp_timing fp_timing;
338
	struct lvds_dvo_timing dvo_timing;
368
	struct lvds_dvo_timing dvo_timing;
Line 339... Line 369...
339
	struct lvds_pnp_id pnp_id;
369
	struct lvds_pnp_id pnp_id;
340
} __attribute__((packed));
370
} __packed;
341
 
371
 
-
 
372
struct bdb_lvds_lfp_data {
-
 
373
	struct bdb_lvds_lfp_data_entry data[16];
-
 
374
} __packed;
-
 
375
 
-
 
376
struct bdb_lfp_backlight_data_entry {
-
 
377
	u8 type:2;
-
 
378
	u8 active_low_pwm:1;
-
 
379
	u8 obsolete1:5;
-
 
380
	u16 pwm_freq_hz;
-
 
381
	u8 min_brightness;
-
 
382
	u8 obsolete2;
-
 
383
	u8 obsolete3;
-
 
384
} __packed;
-
 
385
 
-
 
386
struct bdb_lfp_backlight_data {
-
 
387
	u8 entry_size;
Line 342... Line 388...
342
struct bdb_lvds_lfp_data {
388
	struct bdb_lfp_backlight_data_entry data[16];
343
	struct bdb_lvds_lfp_data_entry data[16];
389
	u8 level[16];
344
} __attribute__((packed));
390
} __packed;
345
 
391
 
346
struct aimdb_header {
392
struct aimdb_header {
347
	char signature[16];
393
	char signature[16];
348
	char oem_device[20];
394
	char oem_device[20];
Line 349... Line 395...
349
	u16 aimdb_version;
395
	u16 aimdb_version;
350
	u16 aimdb_header_size;
396
	u16 aimdb_header_size;
351
	u16 aimdb_size;
397
	u16 aimdb_size;
352
} __attribute__((packed));
398
} __packed;
Line 353... Line 399...
353
 
399
 
354
struct aimdb_block {
400
struct aimdb_block {
355
	u8 aimdb_id;
401
	u8 aimdb_id;
356
	u16 aimdb_size;
402
	u16 aimdb_size;
357
} __attribute__((packed));
403
} __packed;
358
 
404
 
359
struct vch_panel_data {
405
struct vch_panel_data {
360
	u16 fp_timing_offset;
406
	u16 fp_timing_offset;
361
	u8 fp_timing_size;
407
	u8 fp_timing_size;
362
	u16 dvo_timing_offset;
408
	u16 dvo_timing_offset;
Line 363... Line 409...
363
	u8 dvo_timing_size;
409
	u8 dvo_timing_size;
364
	u16 text_fitting_offset;
410
	u16 text_fitting_offset;
365
	u8 text_fitting_size;
411
	u8 text_fitting_size;
366
	u16 graphics_fitting_offset;
412
	u16 graphics_fitting_offset;
Line 367... Line 413...
367
	u8 graphics_fitting_size;
413
	u8 graphics_fitting_size;
368
} __attribute__((packed));
414
} __packed;
369
 
415
 
370
struct vch_bdb_22 {
416
struct vch_bdb_22 {
Line 384... Line 430...
384
	u8 coefficient[8];
430
	u8 coefficient[8];
385
	u8 panel_misc_bits_1;
431
	u8 panel_misc_bits_1;
386
	u8 panel_misc_bits_2;
432
	u8 panel_misc_bits_2;
387
	u8 panel_misc_bits_3;
433
	u8 panel_misc_bits_3;
388
	u8 panel_misc_bits_4;
434
	u8 panel_misc_bits_4;
389
} __attribute__((packed));
435
} __packed;
Line 390... Line 436...
390
 
436
 
391
 
437
 
392
#define BDB_DRIVER_FEATURE_NO_LVDS		0
438
#define BDB_DRIVER_FEATURE_NO_LVDS		0
Line 430... Line 476...
430
	u16 legacy_crt_max_y;
476
	u16 legacy_crt_max_y;
431
	u8 legacy_crt_max_refresh;
477
	u8 legacy_crt_max_refresh;
Line 432... Line 478...
432
 
478
 
433
	u8 hdmi_termination;
479
	u8 hdmi_termination;
434
	u8 custom_vbt_version;
480
	u8 custom_vbt_version;
Line 435... Line 481...
435
} __attribute__((packed));
481
} __packed;
436
 
482
 
437
#define EDP_18BPP	0
483
#define EDP_18BPP	0
438
#define EDP_24BPP	1
484
#define EDP_24BPP	1
Line 455... Line 501...
455
	u16 t1_t3;
501
	u16 t1_t3;
456
	u16 t8;
502
	u16 t8;
457
	u16 t9;
503
	u16 t9;
458
	u16 t10;
504
	u16 t10;
459
	u16 t11_t12;
505
	u16 t11_t12;
460
} __attribute__ ((packed));
506
} __packed;
Line 461... Line 507...
461
 
507
 
462
struct edp_link_params {
508
struct edp_link_params {
463
	u8 rate:4;
509
	u8 rate:4;
464
	u8 lanes:4;
510
	u8 lanes:4;
465
	u8 preemphasis:4;
511
	u8 preemphasis:4;
466
	u8 vswing:4;
512
	u8 vswing:4;
Line 467... Line 513...
467
} __attribute__ ((packed));
513
} __packed;
468
 
514
 
469
struct bdb_edp {
515
struct bdb_edp {
470
	struct edp_power_seq power_seqs[16];
516
	struct edp_power_seq power_seqs[16];
471
	u32 color_depth;
517
	u32 color_depth;
Line 472... Line 518...
472
	struct edp_link_params link_params[16];
518
	struct edp_link_params link_params[16];
473
	u32 sdrrs_msa_timing_delay;
519
	u32 sdrrs_msa_timing_delay;
474
 
520
 
475
	/* ith bit indicates enabled/disabled for (i+1)th panel */
521
	/* ith bit indicates enabled/disabled for (i+1)th panel */
Line 476... Line 522...
476
	u16 edp_s3d_feature;
522
	u16 edp_s3d_feature;
477
	u16 edp_t3_optimization;
523
	u16 edp_t3_optimization;
Line 478... Line 524...
478
} __attribute__ ((packed));
524
} __packed;
Line 606... Line 652...
606
#define	 DEVICE_TYPE_INT_TV	0x1009
652
#define	 DEVICE_TYPE_INT_TV	0x1009
607
#define	 DEVICE_TYPE_HDMI	0x60D2
653
#define	 DEVICE_TYPE_HDMI	0x60D2
608
#define	 DEVICE_TYPE_DP		0x68C6
654
#define	 DEVICE_TYPE_DP		0x68C6
609
#define	 DEVICE_TYPE_eDP	0x78C6
655
#define	 DEVICE_TYPE_eDP	0x78C6
Line -... Line 656...
-
 
656
 
-
 
657
#define  DEVICE_TYPE_CLASS_EXTENSION	(1 << 15)
-
 
658
#define  DEVICE_TYPE_POWER_MANAGEMENT	(1 << 14)
-
 
659
#define  DEVICE_TYPE_HOTPLUG_SIGNALING	(1 << 13)
-
 
660
#define  DEVICE_TYPE_INTERNAL_CONNECTOR	(1 << 12)
-
 
661
#define  DEVICE_TYPE_NOT_HDMI_OUTPUT	(1 << 11)
-
 
662
#define  DEVICE_TYPE_MIPI_OUTPUT	(1 << 10)
-
 
663
#define  DEVICE_TYPE_COMPOSITE_OUTPUT	(1 << 9)
-
 
664
#define  DEVICE_TYPE_DUAL_CHANNEL	(1 << 8)
-
 
665
#define  DEVICE_TYPE_HIGH_SPEED_LINK	(1 << 6)
-
 
666
#define  DEVICE_TYPE_LVDS_SINGALING	(1 << 5)
-
 
667
#define  DEVICE_TYPE_TMDS_DVI_SIGNALING	(1 << 4)
-
 
668
#define  DEVICE_TYPE_VIDEO_SIGNALING	(1 << 3)
-
 
669
#define  DEVICE_TYPE_DISPLAYPORT_OUTPUT	(1 << 2)
-
 
670
#define  DEVICE_TYPE_DIGITAL_OUTPUT	(1 << 1)
-
 
671
#define  DEVICE_TYPE_ANALOG_OUTPUT	(1 << 0)
-
 
672
 
-
 
673
/*
-
 
674
 * Bits we care about when checking for DEVICE_TYPE_eDP
-
 
675
 * Depending on the system, the other bits may or may not
-
 
676
 * be set for eDP outputs.
-
 
677
 */
-
 
678
#define DEVICE_TYPE_eDP_BITS \
-
 
679
	(DEVICE_TYPE_INTERNAL_CONNECTOR | \
-
 
680
	 DEVICE_TYPE_NOT_HDMI_OUTPUT | \
-
 
681
	 DEVICE_TYPE_MIPI_OUTPUT | \
-
 
682
	 DEVICE_TYPE_COMPOSITE_OUTPUT | \
-
 
683
	 DEVICE_TYPE_DUAL_CHANNEL | \
-
 
684
	 DEVICE_TYPE_LVDS_SINGALING | \
-
 
685
	 DEVICE_TYPE_TMDS_DVI_SIGNALING | \
-
 
686
	 DEVICE_TYPE_VIDEO_SIGNALING | \
-
 
687
	 DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
-
 
688
	 DEVICE_TYPE_DIGITAL_OUTPUT | \
-
 
689
	 DEVICE_TYPE_ANALOG_OUTPUT)
610
 
690
 
611
/* define the DVO port for HDMI output type */
691
/* define the DVO port for HDMI output type */
612
#define		DVO_B		1
692
#define		DVO_B		1
613
#define		DVO_C		2
693
#define		DVO_C		2
Line 614... Line 694...
614
#define		DVO_D		3
694
#define		DVO_D		3
615
 
695
 
616
/* define the PORT for DP output type */
696
/* define the PORT for DP output type */
617
#define		PORT_IDPB	7
697
#define		PORT_IDPB	7
Line -... Line 698...
-
 
698
#define		PORT_IDPC	8
-
 
699
#define		PORT_IDPD	9
-
 
700
 
-
 
701
/* Possible values for the "DVO Port" field for versions >= 155: */
-
 
702
#define DVO_PORT_HDMIA	0
-
 
703
#define DVO_PORT_HDMIB	1
-
 
704
#define DVO_PORT_HDMIC	2
-
 
705
#define DVO_PORT_HDMID	3
-
 
706
#define DVO_PORT_LVDS	4
-
 
707
#define DVO_PORT_TV	5
-
 
708
#define DVO_PORT_CRT	6
-
 
709
#define DVO_PORT_DPB	7
-
 
710
#define DVO_PORT_DPC	8
-
 
711
#define DVO_PORT_DPD	9
-
 
712
#define DVO_PORT_DPA	10
-
 
713
 
-
 
714
/* MIPI DSI panel info */
-
 
715
struct bdb_mipi {
-
 
716
	u16 panel_id;
-
 
717
	u16 bridge_revision;
-
 
718
 
-
 
719
	/* General params */
-
 
720
	u32 dithering:1;
-
 
721
	u32 bpp_pixel_format:1;
-
 
722
	u32 rsvd1:1;
-
 
723
	u32 dphy_valid:1;
-
 
724
	u32 resvd2:28;
-
 
725
 
-
 
726
	u16 port_info;
-
 
727
	u16 rsvd3:2;
-
 
728
	u16 num_lanes:2;
-
 
729
	u16 rsvd4:12;
-
 
730
 
-
 
731
	/* DSI config */
-
 
732
	u16 virt_ch_num:2;
-
 
733
	u16 vtm:2;
-
 
734
	u16 rsvd5:12;
-
 
735
 
-
 
736
	u32 dsi_clock;
-
 
737
	u32 bridge_ref_clk;
-
 
738
	u16 rsvd_pwr;
-
 
739
 
-
 
740
	/* Dphy Params */
-
 
741
	u32 prepare_cnt:5;
-
 
742
	u32 rsvd6:3;
-
 
743
	u32 clk_zero_cnt:8;
-
 
744
	u32 trail_cnt:5;
-
 
745
	u32 rsvd7:3;
-
 
746
	u32 exit_zero_cnt:6;
-
 
747
	u32 rsvd8:2;
-
 
748
 
-
 
749
	u32 hl_switch_cnt;
-
 
750
	u32 lp_byte_clk;
618
#define		PORT_IDPC	8
751
	u32 clk_lane_switch_cnt;