All of lore.kernel.org
 help / color / mirror / Atom feed
* [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h
@ 2017-08-28 12:19 Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 01/10] tools/intel_lid: use local register definition Jani Nikula
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

There's little point in duplicating the efforts of describing the same
data in two places. This series lets us use the verbatim copy of the
intel_vbt_defs.h from kernel. Going forward, we should add the changes
in kernel first, then copy the header over to igt.

If we need local tweaks, we can still have them in intel_bios.h, and
indeed we'll still have some after this series.

BR,
Jani.

Jani Nikula (10):
  tools/intel_lid: use local register definition
  tools/intel_vbt_decode: remove unused definitions from intel_bios.h
  tools/intel_vbt_decode: clean up struct lvds_dvo_timing
  tools/intel_vbt_decode: start migrating to kernel intel_vbt_defs.h
  tools/intel_vbt_decode: migrate timing dumping to kernel struct
  tools/intel_vbt_decode: migrate child device dumping to kernel struct
  tools/intel_vbt_decode: migrate psr dumping to kernel struct
  tools/intel_vbt_decode: migrate edp dumping to kernel struct
  tools/intel_vbt_decode: migrate child device type bits decoding to
    kernel defs
  tools/intel_vbt_defs: migrate backlight dumping to kernel struct

 tools/intel_bios.h       | 760 +--------------------------------------
 tools/intel_lid.c        |   5 +-
 tools/intel_vbt_decode.c | 180 +++++-----
 tools/intel_vbt_defs.h   | 897 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 996 insertions(+), 846 deletions(-)
 create mode 100644 tools/intel_vbt_defs.h

-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 01/10] tools/intel_lid: use local register definition
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
@ 2017-08-28 12:19 ` Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 02/10] tools/intel_vbt_decode: remove unused definitions from intel_bios.h Jani Nikula
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

This makes the future intel_vbt_decode refactoring easier.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_lid.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/intel_lid.c b/tools/intel_lid.c
index 0703e2e1e14e..37c6ba5e443f 100644
--- a/tools/intel_lid.c
+++ b/tools/intel_lid.c
@@ -39,9 +39,10 @@
 
 #include "intel_io.h"
 #include "intel_reg.h"
-#include "intel_bios.h"
 #include "intel_chipset.h"
 
+#define SWF14_LID_STATUS_CLOSED	(1<<29) /* 0 here means open */
+
 enum lid_status {
 	LID_UNKNOWN = -1,
 	LID_OPEN,
@@ -125,7 +126,7 @@ int main(int argc, char **argv)
 
 		printf("Intel LVDS Lid status:\n");
 		printf("\tSWF14(0x%x) : %s\n", swf14,
-		       swf14 & SWF14_LID_SWITCH_EN ? "close" : "open");
+		       swf14 & SWF14_LID_STATUS_CLOSED ? "close" : "open");
 
 		acpi_lid = i830_lvds_acpi_lid_state();
 		switch (acpi_lid) {
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 02/10] tools/intel_vbt_decode: remove unused definitions from intel_bios.h
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 01/10] tools/intel_lid: use local register definition Jani Nikula
@ 2017-08-28 12:19 ` Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 03/10] tools/intel_vbt_decode: clean up struct lvds_dvo_timing Jani Nikula
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

This is prep work for refactoring VBT definitions.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h | 268 -----------------------------------------------------
 1 file changed, 268 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index f2ccb55ab6c3..c998031041fd 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -132,20 +132,6 @@ struct bdb_general_features {
 	unsigned char rsvd11:2;	/* finish byte */
 } __attribute__ ((packed));
 
-#define GPIO_PIN_NONE		0x00	/* "N/A" */
-#define	GPIO_PIN_I2C		0x01	/* "I2C GPIO pins" */
-#define	GPIO_PIN_CRT_DDC	0x02	/* "Analog CRT DDC GPIO pins" */
-/* 915+ */
-#define	GPIO_PIN_LVDS		0x03	/* "Integrated LVDS DDC GPIO pins" */
-#define	GPIO_PIN_SDVO_I2C	0x05	/* "sDVO I2C GPIO pins" */
-#define	GPIO_PIN_SDVO_DDC1	0x1D	/* "SDVO DDC1 GPIO pins" */
-#define	GPIO_PIN_SDVO_DDC2	0x2D	/* "SDVO DDC2 GPIO pins" */
-/* pre-915 */
-#define	GPIO_PIN_DVI_LVDS	0x03	/* "DVI/LVDS DDC GPIO pins" */
-#define	GPIO_PIN_ADD_I2C	0x05	/* "ADDCARD I2C GPIO pins" */
-#define	GPIO_PIN_ADD_DDC	0x04	/* "ADDCARD DDC GPIO pins" */
-#define	GPIO_PIN_ADD_DDC_I2C	0x06	/* "ADDCARD DDC/I2C GPIO pins" */
-
 #define DEVICE_HANDLE_CRT	0x01
 #define DEVICE_HANDLE_EFP1	0x04
 #define DEVICE_HANDLE_EFP2	0x40
@@ -211,26 +197,6 @@ struct bdb_general_features {
 #define DEVICE_TYPE_eDP			0x78C6
 #define DEVICE_TYPE_MIPI		0x7cc2
 
-#define DEVICE_CFG_NONE		0x00
-#define DEVICE_CFG_12BIT_DVOB	0x01
-#define DEVICE_CFG_12BIT_DVOC	0x02
-#define DEVICE_CFG_24BIT_DVOBC	0x09
-#define DEVICE_CFG_24BIT_DVOCB	0x0a
-#define DEVICE_CFG_DUAL_DVOB	0x11
-#define DEVICE_CFG_DUAL_DVOC	0x12
-#define DEVICE_CFG_DUAL_DVOBC	0x13
-#define DEVICE_CFG_DUAL_LINK_DVOBC 0x19
-#define DEVICE_CFG_DUAL_LINK_DVOCB 0x1a
-
-#define DEVICE_WIRE_NONE 	0x00
-#define DEVICE_WIRE_DVOB	0x01
-#define DEVICE_WIRE_DVOC	0x02
-#define DEVICE_WIRE_DVOBC	0x03
-#define DEVICE_WIRE_DVOBB	0x05
-#define DEVICE_WIRE_DVOCC	0x06
-#define DEVICE_WIRE_DVOB_MASTER	0x0d
-#define DEVICE_WIRE_DVOC_MASTER	0x0e
-
 #define DEVICE_PORT_DVOA	0x00	/* none on 845+ */
 #define DEVICE_PORT_DVOB	0x01
 #define DEVICE_PORT_DVOC	0x02
@@ -243,11 +209,6 @@ struct bdb_general_features {
 #define DEVICE_PORT_DPC		8
 #define DEVICE_PORT_DPD		9
 
-#define DEVICE_INFO_NONE	0
-#define DEVICE_INFO_HDMI_CERT	1
-#define DEVICE_INFO_DP		2
-#define DEVICE_INFO_DVI		3
-
 struct child_device_config {
 	uint16_t handle;
 	uint16_t device_type;	/* See DEVICE_TYPE_* above */
@@ -370,16 +331,6 @@ struct bdb_lvds_options {
 	uint8_t rsvd4;
 } __attribute__ ((packed));
 
-/* 915+ only */
-struct bdb_tv_features {
-	/* need to verify bit ordering */
-	uint16_t under_over_scan_via_yprpb:2;
-	uint16_t rsvd1:10;
-	uint16_t under_over_scan_via_dvi:2;
-	uint16_t add_overscan_mode:1;
-	uint16_t rsvd2:1;
-} __attribute__ ((packed));
-
 struct lvds_fp_timing {
 	uint16_t x_res;
 	uint16_t y_res;
@@ -476,79 +427,6 @@ struct bdb_lvds_lfp_data {
 	struct bdb_lvds_lfp_data_entry data[16];
 } __attribute__ ((packed));
 
-#define BACKLIGHT_TYPE_NONE 0
-#define BACKLIGHT_TYPE_I2C 1
-#define BACKLIGHT_TYPE_PWM 2
-
-#define BACKLIGHT_GMBUS_100KHZ	0
-#define BACKLIGHT_GMBUS_50KHZ	1
-#define BACKLIGHT_GMBUS_400KHZ	2
-#define BACKLIGHT_GMBUS_1MHZ	3
-
-struct backlight_info {
-	uint8_t inverter_type:2;	/* see BACKLIGHT_TYPE_* above */
-	uint8_t inverter_polarity:1;	/* 1 means 0 is max, 255 is min */
-	uint8_t gpio_pins:3;	/* see GPIO_PIN_* above */
-	uint8_t gmbus_speed:2;
-	uint16_t pwm_frequency;	/* in Hz */
-	uint8_t min_brightness;
-	/* Next two are only for 915+ systems */
-	uint8_t i2c_addr;
-	uint8_t i2c_cmd;
-} __attribute((packed));
-
-struct bdb_backlight_control {
-	uint8_t row_size;
-	struct backlight_info lfps[16];
-} __attribute__ ((packed));
-
-struct bdb_bia {
-	uint8_t bia_enable:1;
-	uint8_t bia_level:3;
-	uint8_t rsvd1:3;
-	uint8_t als_enable:1;
-	uint8_t als_response_data[20];
-} __attribute((packed));
-
-struct aimdb_header {
-	char signature[16];
-	char oem_device[20];
-	uint16_t aimdb_version;
-	uint16_t aimdb_header_size;
-	uint16_t aimdb_size;
-} __attribute__ ((packed));
-
-struct aimdb_block {
-	uint8_t aimdb_id;
-	uint16_t aimdb_size;
-} __attribute__ ((packed));
-
-struct vch_panel_data {
-	uint16_t fp_timing_offset;
-	uint8_t fp_timing_size;
-	uint16_t dvo_timing_offset;
-	uint8_t dvo_timing_size;
-	uint16_t text_fitting_offset;
-	uint8_t text_fitting_size;
-	uint16_t graphics_fitting_offset;
-	uint8_t graphics_fitting_size;
-} __attribute__ ((packed));
-
-struct vch_bdb_22 {
-	struct aimdb_block aimdb_block;
-	struct vch_panel_data panels[16];
-} __attribute__ ((packed));
-
-#define BLC_INVERTER_TYPE_NONE 0
-#define BLC_INVERTER_TYPE_I2C 1
-#define BLC_INVERTER_TYPE_PWM 2
-
-#define BLC_GPIO_NONE 0
-#define BLC_GPIO_I2C 1
-#define BLC_GPIO_CRT_DDC 2
-#define BLC_GPIO_DVI_DDC 3
-#define BLC_GPIO_SDVO_I2C 5
-
 struct blc_struct {
 	uint8_t inverter_type:2;
 	uint8_t inverter_polarity:1;	/* 1 means inverted (0 = max brightness) */
@@ -565,18 +443,6 @@ struct bdb_lvds_backlight {
 	struct blc_struct panels[16];
 } __attribute__ ((packed));
 
-struct bdb_lvds_power {
-	uint8_t dpst_enabled:1;
-	uint8_t pwr_prefs:3;
-	uint8_t rsvd1:3;
-	uint8_t als_enabled:1;
-	uint16_t als_backlight1;
-	uint16_t als_backlight2;
-	uint16_t als_backlight3;
-	uint16_t als_backlight4;
-	uint16_t als_backlight5;
-} __attribute__ ((packed));
-
 #define BDB_DRIVER_NO_LVDS	0
 #define BDB_DRIVER_INT_LVDS	1
 #define BDB_DRIVER_SDVO_LVDS	2
@@ -871,138 +737,4 @@ enum mipi_seq_element {
 	MIPI_SEQ_ELEM_MAX
 };
 
-/*
- * Driver<->VBIOS interaction occurs through scratch bits in
- * GR18 & SWF*.
- *
- * The VBIOS/firmware will signal to the gfx driver through the ASLE interrupt
- * (visible in the interupt regs at bit 0) when it wants something done.
- *
- * Pre-965:
- * The gfx driver can make calls to the VBIOS/firmware through an SMI request,
- * generated by writing to offset 0xe0 of the device's config space (see the
- * publically available 915 PRM for details).
- *
- * 965 and above:
- * IGD OpRegion requests to the VBIOS/firmware are made using SWSCI, which can
- * be triggered by writing to offset 0xe4 (see the publically available
- * 965 graphics PRM for details).
- */
-
-/* GR18 bits are set on display switch and hotkey events */
-#define GR18_DRIVER_SWITCH_EN	(1<<7)	/* 0: VBIOS control, 1: driver control */
-#define GR18_HOTKEY_MASK	0x78	/* See also SWF4 15:0 */
-#define   GR18_HK_NONE		(0x0<<3)
-#define   GR18_HK_LFP_STRETCH	(0x1<<3)
-#define   GR18_HK_TOGGLE_DISP	(0x2<<3)
-#define   GR18_HK_DISP_SWITCH	(0x4<<3)	/* see SWF14 15:0 for what to enable */
-#define   GR18_HK_POPUP_DISABLED (0x6<<3)
-#define   GR18_HK_POPUP_ENABLED	(0x7<<3)
-#define   GR18_HK_PFIT		(0x8<<3)
-#define   GR18_HK_APM_CHANGE	(0xa<<3)
-#define   GR18_HK_MULTIPLE	(0xc<<3)
-#define GR18_USER_INT_EN	(1<<2)
-#define GR18_A0000_FLUSH_EN	(1<<1)
-#define GR18_SMM_EN		(1<<0)
-
-/* Set by driver, cleared by VBIOS */
-#define SWF00_YRES_SHIFT	16
-#define SWF00_XRES_SHIFT	0
-#define SWF00_RES_MASK		0xffff
-
-/* Set by VBIOS at boot time and driver at runtime */
-#define SWF01_TV2_FORMAT_SHIFT	8
-#define SWF01_TV1_FORMAT_SHIFT	0
-#define SWF01_TV_FORMAT_MASK	0xffff
-
-#define SWF10_VBIOS_BLC_I2C_EN	(1<<29)
-#define SWF10_GTT_OVERRIDE_EN	(1<<28)
-#define SWF10_LFP_DPMS_OVR	(1<<27)	/* override DPMS on display switch */
-#define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
-#define   SWF10_OLD_TOGGLE	0x0
-#define   SWF10_TOGGLE_LIST_1	0x1
-#define   SWF10_TOGGLE_LIST_2	0x2
-#define   SWF10_TOGGLE_LIST_3	0x3
-#define   SWF10_TOGGLE_LIST_4	0x4
-#define SWF10_PANNING_EN	(1<<23)
-#define SWF10_DRIVER_LOADED	(1<<22)
-#define SWF10_EXTENDED_DESKTOP	(1<<21)
-#define SWF10_EXCLUSIVE_MODE	(1<<20)
-#define SWF10_OVERLAY_EN	(1<<19)
-#define SWF10_PLANEB_HOLDOFF	(1<<18)
-#define SWF10_PLANEA_HOLDOFF	(1<<17)
-#define SWF10_VGA_HOLDOFF	(1<<16)
-#define SWF10_ACTIVE_DISP_MASK	0xffff
-#define   SWF10_PIPEB_LFP2	(1<<15)
-#define   SWF10_PIPEB_EFP2	(1<<14)
-#define   SWF10_PIPEB_TV2	(1<<13)
-#define   SWF10_PIPEB_CRT2	(1<<12)
-#define   SWF10_PIPEB_LFP	(1<<11)
-#define   SWF10_PIPEB_EFP	(1<<10)
-#define   SWF10_PIPEB_TV	(1<<9)
-#define   SWF10_PIPEB_CRT	(1<<8)
-#define   SWF10_PIPEA_LFP2	(1<<7)
-#define   SWF10_PIPEA_EFP2	(1<<6)
-#define   SWF10_PIPEA_TV2	(1<<5)
-#define   SWF10_PIPEA_CRT2	(1<<4)
-#define   SWF10_PIPEA_LFP	(1<<3)
-#define   SWF10_PIPEA_EFP	(1<<2)
-#define   SWF10_PIPEA_TV	(1<<1)
-#define   SWF10_PIPEA_CRT	(1<<0)
-
-#define SWF11_MEMORY_SIZE_SHIFT	16
-#define SWF11_SV_TEST_EN	(1<<15)
-#define SWF11_IS_AGP		(1<<14)
-#define SWF11_DISPLAY_HOLDOFF	(1<<13)
-#define SWF11_DPMS_REDUCED	(1<<12)
-#define SWF11_IS_VBE_MODE	(1<<11)
-#define SWF11_PIPEB_ACCESS	(1<<10)	/* 0 here means pipe a */
-#define SWF11_DPMS_MASK		0x07
-#define   SWF11_DPMS_OFF	(1<<2)
-#define   SWF11_DPMS_SUSPEND	(1<<1)
-#define   SWF11_DPMS_STANDBY	(1<<0)
-#define   SWF11_DPMS_ON		0
-
-#define SWF14_GFX_PFIT_EN	(1<<31)
-#define SWF14_TEXT_PFIT_EN	(1<<30)
-#define SWF14_LID_SWITCH_EN	(1<<29)
-#define SWF14_POPUP_EN		(1<<28)
-#define SWF14_DISPLAY_HOLDOFF	(1<<27)
-#define SWF14_DISP_DETECT_EN	(1<<26)
-#define SWF14_DOCKING_STATUS_DOCKED (1<<25)	/* 0 here means undocked */
-#define SWF14_DRIVER_STATUS	(1<<24)
-#define SWF14_OS_TYPE_WIN9X	(1<<23)
-#define SWF14_OS_TYPE_WINNT	(1<<22)
-/* 21:19 rsvd */
-#define SWF14_PM_TYPE_MASK	0x00070000
-#define   SWF14_PM_ACPI_VIDEO	(0x4 << 16)
-#define   SWF14_PM_ACPI		(0x3 << 16)
-#define   SWF14_PM_APM_12	(0x2 << 16)
-#define   SWF14_PM_APM_11	(0x1 << 16)
-#define SWF14_HK_REQUEST_MASK	0x0000ffff	/* see GR18 6:3 for event type */
-	  /* if GR18 indicates a display switch */
-#define   SWF14_DS_PIPEB_LFP2_EN (1<<15)
-#define   SWF14_DS_PIPEB_EFP2_EN (1<<14)
-#define   SWF14_DS_PIPEB_TV2_EN  (1<<13)
-#define   SWF14_DS_PIPEB_CRT2_EN (1<<12)
-#define   SWF14_DS_PIPEB_LFP_EN  (1<<11)
-#define   SWF14_DS_PIPEB_EFP_EN  (1<<10)
-#define   SWF14_DS_PIPEB_TV_EN   (1<<9)
-#define   SWF14_DS_PIPEB_CRT_EN  (1<<8)
-#define   SWF14_DS_PIPEA_LFP2_EN (1<<7)
-#define   SWF14_DS_PIPEA_EFP2_EN (1<<6)
-#define   SWF14_DS_PIPEA_TV2_EN  (1<<5)
-#define   SWF14_DS_PIPEA_CRT2_EN (1<<4)
-#define   SWF14_DS_PIPEA_LFP_EN  (1<<3)
-#define   SWF14_DS_PIPEA_EFP_EN  (1<<2)
-#define   SWF14_DS_PIPEA_TV_EN   (1<<1)
-#define   SWF14_DS_PIPEA_CRT_EN  (1<<0)
-	  /* if GR18 indicates a panel fitting request */
-#define   SWF14_PFIT_EN		(1<<0)	/* 0 means disable */
-	  /* if GR18 indicates an APM change request */
-#define   SWF14_APM_HIBERNATE	0x4
-#define   SWF14_APM_SUSPEND	0x3
-#define   SWF14_APM_STANDBY	0x1
-#define   SWF14_APM_RESTORE	0x0
-
 #endif /* _INTEL_BIOS_H_ */
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 03/10] tools/intel_vbt_decode: clean up struct lvds_dvo_timing
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 01/10] tools/intel_lid: use local register definition Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 02/10] tools/intel_vbt_decode: remove unused definitions from intel_bios.h Jani Nikula
@ 2017-08-28 12:19 ` Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 04/10] tools/intel_vbt_decode: start migrating to kernel intel_vbt_defs.h Jani Nikula
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

For reasons unknown, we have two copies of the struct. Deduplicate.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 19 -------------------
 tools/intel_vbt_decode.c |  6 +++---
 2 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index c998031041fd..69d8aa6d7fe9 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -348,25 +348,6 @@ struct lvds_fp_timing {
 } __attribute__ ((packed));
 
 struct lvds_dvo_timing {
-	uint16_t dclk;		/**< In 10khz */
-	uint8_t hactive;
-	uint8_t hblank;
-	uint8_t high_h;		/**< 7:4 = hactive 11:8, 3:0 = hblank 11:8 */
-	uint8_t vactive;
-	uint8_t vblank;
-	uint8_t high_v;		/**< 7:4 = vactive 11:8, 3:0 = vblank 11:8 */
-	uint8_t hsync_off;
-	uint8_t hsync_pulse_width;
-	uint8_t vsync_off;
-	uint8_t high_hsync_off;	/**< 7:6 = hsync off 9:8 */
-	uint8_t h_image;
-	uint8_t v_image;
-	uint8_t max_hv;
-	uint8_t h_border;
-	uint8_t v_border;
-	uint8_t flags;
-} __attribute__ ((packed));
-struct lvds_dvo_timing2 {
 	uint16_t clock;		/**< In 10khz */
 	uint8_t hactive_lo;
 	uint8_t hblank_lo;
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 2984a11e9012..0cf9183e4fcb 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -935,7 +935,7 @@ static void dump_psr(struct context *context,
 }
 
 static void
-print_detail_timing_data(const struct lvds_dvo_timing2 *dvo_timing)
+print_detail_timing_data(const struct lvds_dvo_timing *dvo_timing)
 {
 	int display, sync_start, sync_end, total;
 
@@ -966,10 +966,10 @@ print_detail_timing_data(const struct lvds_dvo_timing2 *dvo_timing)
 static void dump_sdvo_panel_dtds(struct context *context,
 				 const struct bdb_block *block)
 {
-	const struct lvds_dvo_timing2 *dvo_timing = block->data;
+	const struct lvds_dvo_timing *dvo_timing = block->data;
 	int n, count;
 
-	count = block->size / sizeof(struct lvds_dvo_timing2);
+	count = block->size / sizeof(struct lvds_dvo_timing);
 	for (n = 0; n < count; n++) {
 		printf("%d:\n", n);
 		print_detail_timing_data(dvo_timing++);
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 04/10] tools/intel_vbt_decode: start migrating to kernel intel_vbt_defs.h
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (2 preceding siblings ...)
  2017-08-28 12:19 ` [i-g-t PATCH 03/10] tools/intel_vbt_decode: clean up struct lvds_dvo_timing Jani Nikula
@ 2017-08-28 12:19 ` Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 05/10] tools/intel_vbt_decode: migrate timing dumping to kernel struct Jani Nikula
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Copy over most of intel_vbt_defs.h, and use everything that matches with
minor changes from there.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 305 ---------------------
 tools/intel_vbt_decode.c |  20 +-
 tools/intel_vbt_defs.h   | 701 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 715 insertions(+), 311 deletions(-)
 create mode 100644 tools/intel_vbt_defs.h

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index 69d8aa6d7fe9..65e64ccb41ef 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -30,108 +30,6 @@
 
 #include <stdint.h>
 
-
-struct vbt_header {
-	char signature[20];		/**< Always starts with 'VBT$' */
-	uint16_t version;		/**< decimal */
-	uint16_t header_size;		/**< in bytes */
-	uint16_t vbt_size;		/**< in bytes */
-	uint8_t vbt_checksum;
-	uint8_t reserved0;
-	uint32_t bdb_offset;		/**< from beginning of VBT */
-	uint32_t aim_offset[4];		/**< from beginning of VBT */
-} __attribute__ ((packed));
-
-struct bdb_header {
-	char signature[16];		/**< Always 'BIOS_DATA_BLOCK' */
-	uint16_t version;		/**< decimal */
-	uint16_t header_size;		/**< in bytes */
-	uint16_t bdb_size;		/**< in bytes */
-} __attribute__ ((packed));
-
-/*
- * There are several types of BIOS data blocks (BDBs), each block has
- * an ID and size in the first 3 bytes (ID in first, size in next 2).
- * Known types are listed below.
- */
-#define BDB_GENERAL_FEATURES	  1
-#define BDB_GENERAL_DEFINITIONS	  2
-#define BDB_OLD_TOGGLE_LIST	  3
-#define BDB_MODE_SUPPORT_LIST	  4
-#define BDB_GENERIC_MODE_TABLE	  5
-#define BDB_EXT_MMIO_REGS	  6
-#define BDB_SWF_IO		  7
-#define BDB_SWF_MMIO		  8
-#define BDB_DOT_CLOCK_TABLE	  9
-#define BDB_PSR			  9
-#define BDB_MODE_REMOVAL_TABLE	 10
-#define BDB_CHILD_DEVICE_TABLE	 11
-#define BDB_DRIVER_FEATURES	 12
-#define BDB_DRIVER_PERSISTENCE	 13
-#define BDB_EXT_TABLE_PTRS	 14
-#define BDB_DOT_CLOCK_OVERRIDE	 15
-#define BDB_DISPLAY_SELECT	 16
-/* 17 rsvd */
-#define BDB_DRIVER_ROTATION	 18
-#define BDB_DISPLAY_REMOVE	 19
-#define BDB_OEM_CUSTOM		 20
-#define BDB_EFP_LIST		 21	/* workarounds for VGA hsync/vsync */
-#define BDB_SDVO_LVDS_OPTIONS	 22
-#define BDB_SDVO_PANEL_DTDS	 23
-#define BDB_SDVO_LVDS_PNP_IDS	 24
-#define BDB_SDVO_LVDS_POWER_SEQ	 25
-#define BDB_TV_OPTIONS		 26
-#define BDB_EDP			 27
-#define BDB_LVDS_OPTIONS	 40
-#define BDB_LVDS_LFP_DATA_PTRS	 41
-#define BDB_LVDS_LFP_DATA	 42
-#define BDB_LVDS_BACKLIGHT	 43
-#define BDB_LVDS_POWER		 44
-#define BDB_MIPI_CONFIG		 52
-#define BDB_MIPI_SEQUENCE	 53
-#define BDB_SKIP		254	/* VBIOS private block, ignore */
-
-struct bdb_general_features {
-	/* bits 1 */
-	unsigned char panel_fitting:2;
-	unsigned char flexaim:1;
-	unsigned char msg_enable:1;
-	unsigned char clear_screen:3;
-	unsigned char color_flip:1;
-
-	/* bits 2 */
-	unsigned char download_ext_vbt:1;
-	unsigned char enable_ssc:1;
-	unsigned char ssc_freq:1;
-	unsigned char enable_lfp_on_override:1;
-	unsigned char disable_ssc_ddt:1;
-	unsigned char underscan_vga_timings:1;
-	unsigned char dynamic_cdclk:1; /* 183 */
-	unsigned char vbios_hotplug_support:1;
-
-	/* bits 3 */
-	unsigned char disable_smooth_vision:1;
-	unsigned char single_dvi:1;
-	unsigned char rotate_180:1; /* 181 */
-	unsigned char fdi_rx_polarity:1;
-	unsigned char vbios_extended_mode:1; /* 160 */
-	unsigned char copy_ilfp_dtd_to_sdvo_lvds_dtd:1; /* 160 */
-	unsigned char panel_best_fit_timing:1; /* 160 */
-	unsigned char ignore_strap_state:1; /* 160 */
-
-	/* bits 4 */
-	unsigned char legacy_monitor_detect;
-
-	/* bits 5 */
-	unsigned char int_crt_support:1;
-	unsigned char int_tv_support:1;
-	unsigned char int_efp_support:1;
-	unsigned char dp_ssc_enable:1;
-	unsigned char dp_ssc_freq:1;
-	unsigned char dp_ssc_dongle_supported:1;
-	unsigned char rsvd11:2;	/* finish byte */
-} __attribute__ ((packed));
-
 #define DEVICE_HANDLE_CRT	0x01
 #define DEVICE_HANDLE_EFP1	0x04
 #define DEVICE_HANDLE_EFP2	0x40
@@ -158,43 +56,8 @@ struct bdb_general_features {
 #define DEVICE_TYPE_DIGITAL_OUTPUT	1
 #define DEVICE_TYPE_ANALOG_OUTPUT	0
 
-/* Pre 915 */
-#define DEVICE_TYPE_NONE	0x00
-#define DEVICE_TYPE_CRT		0x01
-#define DEVICE_TYPE_TV		0x09
-#define DEVICE_TYPE_EFP		0x12
-#define DEVICE_TYPE_LFP		0x22
-/* On 915+ */
-#define DEVICE_TYPE_CRT_DPMS		0x6001
-#define DEVICE_TYPE_CRT_DPMS_HOTPLUG	0x4001
-#define DEVICE_TYPE_TV_COMPOSITE	0x0209
-#define DEVICE_TYPE_TV_MACROVISION	0x0289
-#define DEVICE_TYPE_TV_RF_COMPOSITE	0x020c
-#define DEVICE_TYPE_TV_SVIDEO_COMPOSITE	0x0609
-#define DEVICE_TYPE_TV_SCART		0x0209
-#define DEVICE_TYPE_TV_CODEC_HOTPLUG_PWR 0x6009
-#define DEVICE_TYPE_EFP_HOTPLUG_PWR	0x6012
-#define DEVICE_TYPE_EFP_DVI_HOTPLUG_PWR	0x6052
-#define DEVICE_TYPE_EFP_DVI_I		0x6053
-#define DEVICE_TYPE_EFP_DVI_D_DUAL	0x6152
-#define DEVICE_TYPE_EFP_DVI_D_HDCP	0x60d2
-#define DEVICE_TYPE_OPENLDI_HOTPLUG_PWR	0x6062
-#define DEVICE_TYPE_OPENLDI_DUALPIX	0x6162
-#define DEVICE_TYPE_LFP_PANELLINK	0x5012
-#define DEVICE_TYPE_LFP_CMOS_PWR	0x5042
-#define DEVICE_TYPE_LFP_LVDS_PWR	0x5062
-#define DEVICE_TYPE_LFP_LVDS_DUAL	0x5162
-#define DEVICE_TYPE_LFP_LVDS_DUAL_HDCP	0x51e2
-#define DEVICE_TYPE_INT_HDMI		0xf0D2
-
-#define DEVICE_TYPE_INT_LFP		0x1022
-#define DEVICE_TYPE_INT_TV		0x1009
-#define DEVICE_TYPE_DP			0x68C6
-#define DEVICE_TYPE_DP_HDMI_DVI		0x60d6
 #define DEVICE_TYPE_DP_DVI		0x68d6
-#define DEVICE_TYPE_HDMI_DVI		0x60d2
 #define DEVICE_TYPE_DVI			0x68d2
-#define DEVICE_TYPE_eDP			0x78C6
 #define DEVICE_TYPE_MIPI		0x7cc2
 
 #define DEVICE_PORT_DVOA	0x00	/* none on 845+ */
@@ -285,31 +148,6 @@ struct efp_child_device_config {
 	uint8_t iboost_hdmi:4; /* 196 */
 } __attribute__ ((packed));
 
-struct bdb_general_definitions {
-	unsigned char crt_ddc_gmbus_pin;	/* see GPIO_PIN_* above */
-
-	/* DPMS bits */
-	unsigned char dpms_acpi:1;
-	unsigned char skip_boot_crt_detect:1;
-	unsigned char dpms_aim:1;
-	unsigned char rsvd1:5;	/* finish byte */
-
-	/* boot device bits */
-	unsigned char boot_display[2];
-	unsigned char child_dev_size;
-
-	/*
-	 * Device info:
-	 * If TV is present, it'll be at devices[0]
-	 * LVDS will be next, either devices[0] or [1], if present
-	 * Max total will be 6, but could be as few as 4 if both
-	 * TV and LVDS are missing, so be careful when interpreting
-	 * [4] and [5].
-	 */
-	uint8_t devices[0];
-	/* may be another device block here on some platforms */
-} __attribute__ ((packed));
-
 #define DEVICE_CHILD_SIZE 7
 
 struct bdb_child_devices {
@@ -317,36 +155,6 @@ struct bdb_child_devices {
 	struct child_device_config children[DEVICE_CHILD_SIZE];
 } __attribute__ ((packed));
 
-struct bdb_lvds_options {
-	uint8_t panel_type;
-	uint8_t rsvd1;
-	/* LVDS capabilities, stored in a dword */
-	uint8_t pfit_mode:2;
-	uint8_t pfit_text_mode_enhanced:1;
-	uint8_t pfit_gfx_mode_enhanced:1;
-	uint8_t pfit_ratio_auto:1;
-	uint8_t pixel_dither:1;
-	uint8_t lvds_edid:1;
-	uint8_t rsvd2:1;
-	uint8_t rsvd4;
-} __attribute__ ((packed));
-
-struct lvds_fp_timing {
-	uint16_t x_res;
-	uint16_t y_res;
-	uint32_t lvds_reg;
-	uint32_t lvds_reg_val;
-	uint32_t pp_on_reg;
-	uint32_t pp_on_reg_val;
-	uint32_t pp_off_reg;
-	uint32_t pp_off_reg_val;
-	uint32_t pp_cycle_reg;
-	uint32_t pp_cycle_reg_val;
-	uint32_t pfit_reg;
-	uint32_t pfit_reg_val;
-	uint16_t terminator;
-} __attribute__ ((packed));
-
 struct lvds_dvo_timing {
 	uint16_t clock;		/**< In 10khz */
 	uint8_t hactive_lo;
@@ -375,39 +183,6 @@ struct lvds_dvo_timing {
 	uint8_t rsvd2:1;
 } __attribute__((packed));
 
-struct lvds_pnp_id {
-	uint16_t mfg_name;
-	uint16_t product_code;
-	uint32_t serial;
-	uint8_t mfg_week;
-	uint8_t mfg_year;
-} __attribute__ ((packed));;
-
-/* LFP pointer table contains entries to the struct below */
-struct bdb_lvds_lfp_data_ptr {
-	uint16_t fp_timing_offset;	/* offsets are from start of bdb */
-	uint8_t fp_table_size;
-	uint16_t dvo_timing_offset;
-	uint8_t dvo_table_size;
-	uint16_t panel_pnp_id_offset;
-	uint8_t pnp_table_size;
-} __attribute__ ((packed));
-
-struct bdb_lvds_lfp_data_ptrs {
-	uint8_t lvds_entries;
-	struct bdb_lvds_lfp_data_ptr ptr[16];
-} __attribute__ ((packed));
-
-struct bdb_lvds_lfp_data_entry {
-	struct lvds_fp_timing fp_timing;
-	struct lvds_dvo_timing dvo_timing;
-	struct lvds_pnp_id pnp_id;
-} __attribute__ ((packed));
-
-struct bdb_lvds_lfp_data {
-	struct bdb_lvds_lfp_data_entry data[16];
-} __attribute__ ((packed));
-
 struct blc_struct {
 	uint8_t inverter_type:2;
 	uint8_t inverter_polarity:1;	/* 1 means inverted (0 = max brightness) */
@@ -429,75 +204,6 @@ struct bdb_lvds_backlight {
 #define BDB_DRIVER_SDVO_LVDS	2
 #define BDB_DRIVER_EDP		3
 
-struct bdb_driver_feature {
-	uint8_t boot_dev_algorithm:1;
-	uint8_t block_display_switch:1;
-	uint8_t allow_display_switch:1;
-	uint8_t hotplug_dvo:1;
-	uint8_t dual_view_zoom:1;
-	uint8_t int15h_hook:1;
-	uint8_t sprite_in_clone:1;
-	uint8_t primary_lfp_id:1;
-
-	uint16_t boot_mode_x;
-	uint16_t boot_mode_y;
-	uint8_t boot_mode_bpp;
-	uint8_t boot_mode_refresh;
-
-	uint16_t enable_lfp_primary:1;
-	uint16_t selective_mode_pruning:1;
-	uint16_t dual_frequency:1;
-	uint16_t render_clock_freq:1;	/* 0: high freq; 1: low freq */
-	uint16_t nt_clone_support:1;
-	uint16_t power_scheme_ui:1;	/* 0: CUI; 1: 3rd party */
-	uint16_t sprite_display_assign:1;	/* 0: secondary; 1: primary */
-	uint16_t cui_aspect_scaling:1;
-	uint16_t preserve_aspect_ratio:1;
-	uint16_t sdvo_device_power_down:1;
-	uint16_t crt_hotplug:1;
-	uint16_t lvds_config:2;
-	uint16_t reserved:3;
-
-	uint8_t static_display:1;
-	uint8_t reserved2:7;
-	uint16_t legacy_crt_max_x;
-	uint16_t legacy_crt_max_y;
-	uint8_t legacy_crt_max_refresh;
-} __attribute__ ((packed));
-
-struct bdb_sdvo_lvds_options {
-	uint8_t panel_backlight;
-	uint8_t h40_set_panel_type;
-	uint8_t panel_type;
-	uint8_t ssc_clk_freq;
-	uint16_t als_low_trip;
-	uint16_t als_high_trip;
-	uint8_t sclalarcoeff_tab_row_num;
-	uint8_t sclalarcoeff_tab_row_size;
-	uint8_t coefficient[8];
-	uint8_t panel_misc_bits_1;
-	uint8_t panel_misc_bits_2;
-	uint8_t panel_misc_bits_3;
-	uint8_t panel_misc_bits_4;
-} __attribute__ ((packed));
-
-#define EDP_18BPP	0
-#define EDP_24BPP	1
-#define EDP_30BPP	2
-#define EDP_RATE_1_62  0
-#define EDP_RATE_2_7   1
-#define EDP_LANE_1     0
-#define EDP_LANE_2     1
-#define EDP_LANE_4     3
-#define EDP_PREEMPHASIS_NONE   0
-#define EDP_PREEMPHASIS_3_5dB  1
-#define EDP_PREEMPHASIS_6dB    2
-#define EDP_PREEMPHASIS_9_5dB  3
-#define EDP_VSWING_0_4V                0
-#define EDP_VSWING_0_6V                1
-#define EDP_VSWING_0_8V                2
-#define EDP_VSWING_1_2V                3
-
 struct edp_power_seq {
 	uint16_t t3;
 	uint16_t t7;
@@ -679,17 +385,6 @@ struct mipi_pps_data {
 	uint16_t panel_power_cycle_delay;
 } __attribute__ ((packed));
 
-struct bdb_mipi_config {
-	struct mipi_config config[MAX_MIPI_CONFIGURATIONS];
-	struct mipi_pps_data pps[MAX_MIPI_CONFIGURATIONS];
-} __attribute__ ((packed));
-
-/* variable number of these - max 6 */
-struct bdb_mipi_sequence {
-	uint8_t version;
-	uint8_t data[0];
-} __attribute__ ((packed));
-
 /* MIPI Sequence Block definitions */
 enum mipi_seq {
 	MIPI_SEQ_END = 0,
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 0cf9183e4fcb..836a9783d54e 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -36,11 +36,19 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#include "intel_bios.h"
 #include "intel_io.h"
 #include "intel_chipset.h"
 #include "drmtest.h"
 
+/* kernel types for intel_vbt_defs.h */
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+#define __packed __attribute__ ((packed))
+
+#define _INTEL_BIOS_PRIVATE
+#include "intel_vbt_defs.h"
+
 /* no bother to include "edid.h" */
 #define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
 #define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2))
@@ -175,7 +183,7 @@ static void dump_general_features(struct context *context,
 	printf("\tUnderscan support for VGA timings: %s\n",
 	       YESNO(features->underscan_vga_timings));
 	if (context->bdb->version >= 183)
-		printf("\tDynamic CD clock: %s\n", YESNO(features->dynamic_cdclk));
+		printf("\tDynamic CD clock: %s\n", YESNO(features->display_clock_mode));
 	printf("\tHotplug support in VBIOS: %s\n",
 	       YESNO(features->vbios_hotplug_support));
 
@@ -184,7 +192,7 @@ static void dump_general_features(struct context *context,
 	printf("\tSingle DVI for CRT/DVI: %s\n", YESNO(features->single_dvi));
 	if (context->bdb->version >= 181)
 		printf("\tEnable 180 degree rotation: %s\n", YESNO(features->rotate_180));
-	printf("\tInverted FDI Rx polarity: %s\n", YESNO(features->fdi_rx_polarity));
+	printf("\tInverted FDI Rx polarity: %s\n", YESNO(features->fdi_rx_polarity_inverted));
 	if (context->bdb->version >= 160) {
 		printf("\tExtended VBIOS mode: %s\n", YESNO(features->vbios_extended_mode));
 		printf("\tCopy iLFP DTD to SDVO LVDS DTD: %s\n", YESNO(features->copy_ilfp_dtd_to_sdvo_lvds_dtd));
@@ -269,9 +277,9 @@ static const struct {
 	{ DEVICE_TYPE_INT_LFP, "LFP" },
 	{ DEVICE_TYPE_INT_TV, "TV" },
 	{ DEVICE_TYPE_DP, "DisplayPort" },
-	{ DEVICE_TYPE_DP_HDMI_DVI, "DisplayPort/HDMI/DVI" },
+	{ DEVICE_TYPE_DP_DUAL_MODE, "DisplayPort/HDMI/DVI" },
 	{ DEVICE_TYPE_DP_DVI, "DisplayPort/DVI" },
-	{ DEVICE_TYPE_HDMI_DVI, "HDMI/DVI" },
+	{ DEVICE_TYPE_HDMI, "HDMI/DVI" },
 	{ DEVICE_TYPE_DVI, "DVI" },
 	{ DEVICE_TYPE_eDP, "eDP" },
 	{ DEVICE_TYPE_MIPI, "MIPI" },
@@ -627,7 +635,7 @@ static void dump_lvds_data(struct context *context,
 static void dump_driver_feature(struct context *context,
 				const struct bdb_block *block)
 {
-	const struct bdb_driver_feature *feature = block->data;
+	const struct bdb_driver_features *feature = block->data;
 
 	printf("\tBoot Device Algorithm: %s\n", feature->boot_dev_algorithm ?
 	       "driver default" : "os default");
diff --git a/tools/intel_vbt_defs.h b/tools/intel_vbt_defs.h
new file mode 100644
index 000000000000..5481304d2ac2
--- /dev/null
+++ b/tools/intel_vbt_defs.h
@@ -0,0 +1,701 @@
+/*
+ * Copyright © 2006-2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/*
+ * This information is private to VBT parsing in intel_bios.c.
+ *
+ * Please do NOT include anywhere else.
+ */
+#ifndef _INTEL_BIOS_PRIVATE
+#error "intel_vbt_defs.h is private to intel_bios.c"
+#endif
+
+#ifndef _INTEL_VBT_DEFS_H_
+#define _INTEL_VBT_DEFS_H_
+
+#include "intel_bios.h"
+
+/**
+ * struct vbt_header - VBT Header structure
+ * @signature:		VBT signature, always starts with "$VBT"
+ * @version:		Version of this structure
+ * @header_size:	Size of this structure
+ * @vbt_size:		Size of VBT (VBT Header, BDB Header and data blocks)
+ * @vbt_checksum:	Checksum
+ * @reserved0:		Reserved
+ * @bdb_offset:		Offset of &struct bdb_header from beginning of VBT
+ * @aim_offset:		Offsets of add-in data blocks from beginning of VBT
+ */
+struct vbt_header {
+	u8 signature[20];
+	u16 version;
+	u16 header_size;
+	u16 vbt_size;
+	u8 vbt_checksum;
+	u8 reserved0;
+	u32 bdb_offset;
+	u32 aim_offset[4];
+} __packed;
+
+/**
+ * struct bdb_header - BDB Header structure
+ * @signature:		BDB signature "BIOS_DATA_BLOCK"
+ * @version:		Version of the data block definitions
+ * @header_size:	Size of this structure
+ * @bdb_size:		Size of BDB (BDB Header and data blocks)
+ */
+struct bdb_header {
+	u8 signature[16];
+	u16 version;
+	u16 header_size;
+	u16 bdb_size;
+} __packed;
+
+/* strictly speaking, this is a "skip" block, but it has interesting info */
+struct vbios_data {
+	u8 type; /* 0 == desktop, 1 == mobile */
+	u8 relstage;
+	u8 chipset;
+	u8 lvds_present:1;
+	u8 tv_present:1;
+	u8 rsvd2:6; /* finish byte */
+	u8 rsvd3[4];
+	u8 signon[155];
+	u8 copyright[61];
+	u16 code_segment;
+	u8 dos_boot_mode;
+	u8 bandwidth_percent;
+	u8 rsvd4; /* popup memory size */
+	u8 resize_pci_bios;
+	u8 rsvd5; /* is crt already on ddc2 */
+} __packed;
+
+/*
+ * There are several types of BIOS data blocks (BDBs), each block has
+ * an ID and size in the first 3 bytes (ID in first, size in next 2).
+ * Known types are listed below.
+ */
+#define BDB_GENERAL_FEATURES	  1
+#define BDB_GENERAL_DEFINITIONS	  2
+#define BDB_OLD_TOGGLE_LIST	  3
+#define BDB_MODE_SUPPORT_LIST	  4
+#define BDB_GENERIC_MODE_TABLE	  5
+#define BDB_EXT_MMIO_REGS	  6
+#define BDB_SWF_IO		  7
+#define BDB_SWF_MMIO		  8
+#define BDB_PSR			  9
+#define BDB_MODE_REMOVAL_TABLE	 10
+#define BDB_CHILD_DEVICE_TABLE	 11
+#define BDB_DRIVER_FEATURES	 12
+#define BDB_DRIVER_PERSISTENCE	 13
+#define BDB_EXT_TABLE_PTRS	 14
+#define BDB_DOT_CLOCK_OVERRIDE	 15
+#define BDB_DISPLAY_SELECT	 16
+/* 17 rsvd */
+#define BDB_DRIVER_ROTATION	 18
+#define BDB_DISPLAY_REMOVE	 19
+#define BDB_OEM_CUSTOM		 20
+#define BDB_EFP_LIST		 21 /* workarounds for VGA hsync/vsync */
+#define BDB_SDVO_LVDS_OPTIONS	 22
+#define BDB_SDVO_PANEL_DTDS	 23
+#define BDB_SDVO_LVDS_PNP_IDS	 24
+#define BDB_SDVO_LVDS_POWER_SEQ	 25
+#define BDB_TV_OPTIONS		 26
+#define BDB_EDP			 27
+#define BDB_LVDS_OPTIONS	 40
+#define BDB_LVDS_LFP_DATA_PTRS	 41
+#define BDB_LVDS_LFP_DATA	 42
+#define BDB_LVDS_BACKLIGHT	 43
+#define BDB_LVDS_POWER		 44
+#define BDB_MIPI_CONFIG		 52
+#define BDB_MIPI_SEQUENCE	 53
+#define BDB_SKIP		254 /* VBIOS private block, ignore */
+
+struct bdb_general_features {
+        /* bits 1 */
+	u8 panel_fitting:2;
+	u8 flexaim:1;
+	u8 msg_enable:1;
+	u8 clear_screen:3;
+	u8 color_flip:1;
+
+        /* bits 2 */
+	u8 download_ext_vbt:1;
+	u8 enable_ssc:1;
+	u8 ssc_freq:1;
+	u8 enable_lfp_on_override:1;
+	u8 disable_ssc_ddt:1;
+	u8 underscan_vga_timings:1;
+	u8 display_clock_mode:1;
+	u8 vbios_hotplug_support:1;
+
+        /* bits 3 */
+	u8 disable_smooth_vision:1;
+	u8 single_dvi:1;
+	u8 rotate_180:1;					/* 181 */
+	u8 fdi_rx_polarity_inverted:1;
+	u8 vbios_extended_mode:1;				/* 160 */
+	u8 copy_ilfp_dtd_to_sdvo_lvds_dtd:1;			/* 160 */
+	u8 panel_best_fit_timing:1;				/* 160 */
+	u8 ignore_strap_state:1;				/* 160 */
+
+        /* bits 4 */
+	u8 legacy_monitor_detect;
+
+        /* bits 5 */
+	u8 int_crt_support:1;
+	u8 int_tv_support:1;
+	u8 int_efp_support:1;
+	u8 dp_ssc_enable:1;	/* PCH attached eDP supports SSC */
+	u8 dp_ssc_freq:1;	/* SSC freq for PCH attached eDP */
+	u8 dp_ssc_dongle_supported:1;
+	u8 rsvd11:2; /* finish byte */
+} __packed;
+
+/* pre-915 */
+#define GPIO_PIN_DVI_LVDS	0x03 /* "DVI/LVDS DDC GPIO pins" */
+#define GPIO_PIN_ADD_I2C	0x05 /* "ADDCARD I2C GPIO pins" */
+#define GPIO_PIN_ADD_DDC	0x04 /* "ADDCARD DDC GPIO pins" */
+#define GPIO_PIN_ADD_DDC_I2C	0x06 /* "ADDCARD DDC/I2C GPIO pins" */
+
+/* Pre 915 */
+#define DEVICE_TYPE_NONE	0x00
+#define DEVICE_TYPE_CRT		0x01
+#define DEVICE_TYPE_TV		0x09
+#define DEVICE_TYPE_EFP		0x12
+#define DEVICE_TYPE_LFP		0x22
+/* On 915+ */
+#define DEVICE_TYPE_CRT_DPMS		0x6001
+#define DEVICE_TYPE_CRT_DPMS_HOTPLUG	0x4001
+#define DEVICE_TYPE_TV_COMPOSITE	0x0209
+#define DEVICE_TYPE_TV_MACROVISION	0x0289
+#define DEVICE_TYPE_TV_RF_COMPOSITE	0x020c
+#define DEVICE_TYPE_TV_SVIDEO_COMPOSITE	0x0609
+#define DEVICE_TYPE_TV_SCART		0x0209
+#define DEVICE_TYPE_TV_CODEC_HOTPLUG_PWR 0x6009
+#define DEVICE_TYPE_EFP_HOTPLUG_PWR	0x6012
+#define DEVICE_TYPE_EFP_DVI_HOTPLUG_PWR	0x6052
+#define DEVICE_TYPE_EFP_DVI_I		0x6053
+#define DEVICE_TYPE_EFP_DVI_D_DUAL	0x6152
+#define DEVICE_TYPE_EFP_DVI_D_HDCP	0x60d2
+#define DEVICE_TYPE_OPENLDI_HOTPLUG_PWR	0x6062
+#define DEVICE_TYPE_OPENLDI_DUALPIX	0x6162
+#define DEVICE_TYPE_LFP_PANELLINK	0x5012
+#define DEVICE_TYPE_LFP_CMOS_PWR	0x5042
+#define DEVICE_TYPE_LFP_LVDS_PWR	0x5062
+#define DEVICE_TYPE_LFP_LVDS_DUAL	0x5162
+#define DEVICE_TYPE_LFP_LVDS_DUAL_HDCP	0x51e2
+
+/* Add the device class for LFP, TV, HDMI */
+#define DEVICE_TYPE_INT_LFP		0x1022
+#define DEVICE_TYPE_INT_TV		0x1009
+#define DEVICE_TYPE_HDMI		0x60D2
+#define DEVICE_TYPE_DP			0x68C6
+#define DEVICE_TYPE_DP_DUAL_MODE	0x60D6
+#define DEVICE_TYPE_eDP			0x78C6
+
+/*
+ * Bits we care about when checking for DEVICE_TYPE_eDP. Depending on the
+ * system, the other bits may or may not be set for eDP outputs.
+ */
+#define DEVICE_TYPE_eDP_BITS \
+	(DEVICE_TYPE_INTERNAL_CONNECTOR |	\
+	 DEVICE_TYPE_MIPI_OUTPUT |		\
+	 DEVICE_TYPE_COMPOSITE_OUTPUT |		\
+	 DEVICE_TYPE_DUAL_CHANNEL |		\
+	 DEVICE_TYPE_LVDS_SINGALING |		\
+	 DEVICE_TYPE_TMDS_DVI_SIGNALING |	\
+	 DEVICE_TYPE_VIDEO_SIGNALING |		\
+	 DEVICE_TYPE_DISPLAYPORT_OUTPUT |	\
+	 DEVICE_TYPE_ANALOG_OUTPUT)
+
+#define DEVICE_TYPE_DP_DUAL_MODE_BITS \
+	(DEVICE_TYPE_INTERNAL_CONNECTOR |	\
+	 DEVICE_TYPE_MIPI_OUTPUT |		\
+	 DEVICE_TYPE_COMPOSITE_OUTPUT |		\
+	 DEVICE_TYPE_LVDS_SINGALING |		\
+	 DEVICE_TYPE_TMDS_DVI_SIGNALING |	\
+	 DEVICE_TYPE_VIDEO_SIGNALING |		\
+	 DEVICE_TYPE_DISPLAYPORT_OUTPUT |	\
+	 DEVICE_TYPE_DIGITAL_OUTPUT |		\
+	 DEVICE_TYPE_ANALOG_OUTPUT)
+
+#define DEVICE_CFG_NONE		0x00
+#define DEVICE_CFG_12BIT_DVOB	0x01
+#define DEVICE_CFG_12BIT_DVOC	0x02
+#define DEVICE_CFG_24BIT_DVOBC	0x09
+#define DEVICE_CFG_24BIT_DVOCB	0x0a
+#define DEVICE_CFG_DUAL_DVOB	0x11
+#define DEVICE_CFG_DUAL_DVOC	0x12
+#define DEVICE_CFG_DUAL_DVOBC	0x13
+#define DEVICE_CFG_DUAL_LINK_DVOBC	0x19
+#define DEVICE_CFG_DUAL_LINK_DVOCB	0x1a
+
+#define DEVICE_WIRE_NONE	0x00
+#define DEVICE_WIRE_DVOB	0x01
+#define DEVICE_WIRE_DVOC	0x02
+#define DEVICE_WIRE_DVOBC	0x03
+#define DEVICE_WIRE_DVOBB	0x05
+#define DEVICE_WIRE_DVOCC	0x06
+#define DEVICE_WIRE_DVOB_MASTER 0x0d
+#define DEVICE_WIRE_DVOC_MASTER 0x0e
+
+/* dvo_port pre BDB 155 */
+#define DEVICE_PORT_DVOA	0x00 /* none on 845+ */
+#define DEVICE_PORT_DVOB	0x01
+#define DEVICE_PORT_DVOC	0x02
+
+/* dvo_port BDB 155+ */
+#define DVO_PORT_HDMIA		0
+#define DVO_PORT_HDMIB		1
+#define DVO_PORT_HDMIC		2
+#define DVO_PORT_HDMID		3
+#define DVO_PORT_LVDS		4
+#define DVO_PORT_TV		5
+#define DVO_PORT_CRT		6
+#define DVO_PORT_DPB		7
+#define DVO_PORT_DPC		8
+#define DVO_PORT_DPD		9
+#define DVO_PORT_DPA		10
+#define DVO_PORT_DPE		11				/* 193 */
+#define DVO_PORT_HDMIE		12				/* 193 */
+#define DVO_PORT_MIPIA		21				/* 171 */
+#define DVO_PORT_MIPIB		22				/* 171 */
+#define DVO_PORT_MIPIC		23				/* 171 */
+#define DVO_PORT_MIPID		24				/* 171 */
+
+#define LEGACY_CHILD_DEVICE_CONFIG_SIZE		33
+
+struct bdb_general_definitions {
+	/* DDC GPIO */
+	u8 crt_ddc_gmbus_pin;
+
+	/* DPMS bits */
+	u8 dpms_acpi:1;
+	u8 skip_boot_crt_detect:1;
+	u8 dpms_aim:1;
+	u8 rsvd1:5; /* finish byte */
+
+	/* boot device bits */
+	u8 boot_display[2];
+	u8 child_dev_size;
+
+	/*
+	 * Device info:
+	 * If TV is present, it'll be at devices[0].
+	 * LVDS will be next, either devices[0] or [1], if present.
+	 * On some platforms the number of device is 6. But could be as few as
+	 * 4 if both TV and LVDS are missing.
+	 * And the device num is related with the size of general definition
+	 * block. It is obtained by using the following formula:
+	 * number = (block_size - sizeof(bdb_general_definitions))/
+	 *	     defs->child_dev_size;
+	 */
+	uint8_t devices[0];
+} __packed;
+
+/* Mask for DRRS / Panel Channel / SSC / BLT control bits extraction */
+#define MODE_MASK		0x3
+
+struct bdb_lvds_options {
+	u8 panel_type;
+	u8 rsvd1;
+	/* LVDS capabilities, stored in a dword */
+	u8 pfit_mode:2;
+	u8 pfit_text_mode_enhanced:1;
+	u8 pfit_gfx_mode_enhanced:1;
+	u8 pfit_ratio_auto:1;
+	u8 pixel_dither:1;
+	u8 lvds_edid:1;
+	u8 rsvd2:1;
+	u8 rsvd4;
+	/* LVDS Panel channel bits stored here */
+	u32 lvds_panel_channel_bits;
+	/* LVDS SSC (Spread Spectrum Clock) bits stored here. */
+	u16 ssc_bits;
+	u16 ssc_freq;
+	u16 ssc_ddt;
+	/* Panel color depth defined here */
+	u16 panel_color_depth;
+	/* LVDS panel type bits stored here */
+	u32 dps_panel_type_bits;
+	/* LVDS backlight control type bits stored here */
+	u32 blt_control_type_bits;
+} __packed;
+
+/* LFP pointer table contains entries to the struct below */
+struct bdb_lvds_lfp_data_ptr {
+	u16 fp_timing_offset; /* offsets are from start of bdb */
+	u8 fp_table_size;
+	u16 dvo_timing_offset;
+	u8 dvo_table_size;
+	u16 panel_pnp_id_offset;
+	u8 pnp_table_size;
+} __packed;
+
+struct bdb_lvds_lfp_data_ptrs {
+	u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
+	struct bdb_lvds_lfp_data_ptr ptr[16];
+} __packed;
+
+/* LFP data has 3 blocks per entry */
+struct lvds_fp_timing {
+	u16 x_res;
+	u16 y_res;
+	u32 lvds_reg;
+	u32 lvds_reg_val;
+	u32 pp_on_reg;
+	u32 pp_on_reg_val;
+	u32 pp_off_reg;
+	u32 pp_off_reg_val;
+	u32 pp_cycle_reg;
+	u32 pp_cycle_reg_val;
+	u32 pfit_reg;
+	u32 pfit_reg_val;
+	u16 terminator;
+} __packed;
+
+struct lvds_pnp_id {
+	u16 mfg_name;
+	u16 product_code;
+	u32 serial;
+	u8 mfg_week;
+	u8 mfg_year;
+} __packed;
+
+struct bdb_lvds_lfp_data_entry {
+	struct lvds_fp_timing fp_timing;
+	struct lvds_dvo_timing dvo_timing;
+	struct lvds_pnp_id pnp_id;
+} __packed;
+
+struct bdb_lvds_lfp_data {
+	struct bdb_lvds_lfp_data_entry data[16];
+} __packed;
+
+#define BDB_BACKLIGHT_TYPE_NONE	0
+#define BDB_BACKLIGHT_TYPE_PWM	2
+
+struct bdb_lfp_backlight_data_entry {
+	u8 type:2;
+	u8 active_low_pwm:1;
+	u8 obsolete1:5;
+	u16 pwm_freq_hz;
+	u8 min_brightness;
+	u8 obsolete2;
+	u8 obsolete3;
+} __packed;
+
+struct bdb_lfp_backlight_control_method {
+	u8 type:4;
+	u8 controller:4;
+} __packed;
+
+struct bdb_lfp_backlight_data {
+	u8 entry_size;
+	struct bdb_lfp_backlight_data_entry data[16];
+	u8 level[16];
+	struct bdb_lfp_backlight_control_method backlight_control[16];
+} __packed;
+
+struct aimdb_header {
+	char signature[16];
+	char oem_device[20];
+	u16 aimdb_version;
+	u16 aimdb_header_size;
+	u16 aimdb_size;
+} __packed;
+
+struct aimdb_block {
+	u8 aimdb_id;
+	u16 aimdb_size;
+} __packed;
+
+struct vch_panel_data {
+	u16 fp_timing_offset;
+	u8 fp_timing_size;
+	u16 dvo_timing_offset;
+	u8 dvo_timing_size;
+	u16 text_fitting_offset;
+	u8 text_fitting_size;
+	u16 graphics_fitting_offset;
+	u8 graphics_fitting_size;
+} __packed;
+
+struct vch_bdb_22 {
+	struct aimdb_block aimdb_block;
+	struct vch_panel_data panels[16];
+} __packed;
+
+struct bdb_sdvo_lvds_options {
+	u8 panel_backlight;
+	u8 h40_set_panel_type;
+	u8 panel_type;
+	u8 ssc_clk_freq;
+	u16 als_low_trip;
+	u16 als_high_trip;
+	u8 sclalarcoeff_tab_row_num;
+	u8 sclalarcoeff_tab_row_size;
+	u8 coefficient[8];
+	u8 panel_misc_bits_1;
+	u8 panel_misc_bits_2;
+	u8 panel_misc_bits_3;
+	u8 panel_misc_bits_4;
+} __packed;
+
+
+#define BDB_DRIVER_FEATURE_NO_LVDS		0
+#define BDB_DRIVER_FEATURE_INT_LVDS		1
+#define BDB_DRIVER_FEATURE_SDVO_LVDS		2
+#define BDB_DRIVER_FEATURE_EDP			3
+
+struct bdb_driver_features {
+	u8 boot_dev_algorithm:1;
+	u8 block_display_switch:1;
+	u8 allow_display_switch:1;
+	u8 hotplug_dvo:1;
+	u8 dual_view_zoom:1;
+	u8 int15h_hook:1;
+	u8 sprite_in_clone:1;
+	u8 primary_lfp_id:1;
+
+	u16 boot_mode_x;
+	u16 boot_mode_y;
+	u8 boot_mode_bpp;
+	u8 boot_mode_refresh;
+
+	u16 enable_lfp_primary:1;
+	u16 selective_mode_pruning:1;
+	u16 dual_frequency:1;
+	u16 render_clock_freq:1; /* 0: high freq; 1: low freq */
+	u16 nt_clone_support:1;
+	u16 power_scheme_ui:1; /* 0: CUI; 1: 3rd party */
+	u16 sprite_display_assign:1; /* 0: secondary; 1: primary */
+	u16 cui_aspect_scaling:1;
+	u16 preserve_aspect_ratio:1;
+	u16 sdvo_device_power_down:1;
+	u16 crt_hotplug:1;
+	u16 lvds_config:2;
+	u16 tv_hotplug:1;
+	u16 hdmi_config:2;
+
+	u8 static_display:1;
+	u8 reserved2:7;
+	u16 legacy_crt_max_x;
+	u16 legacy_crt_max_y;
+	u8 legacy_crt_max_refresh;
+
+	u8 hdmi_termination;
+	u8 custom_vbt_version;
+	/* Driver features data block */
+	u16 rmpm_enabled:1;
+	u16 s2ddt_enabled:1;
+	u16 dpst_enabled:1;
+	u16 bltclt_enabled:1;
+	u16 adb_enabled:1;
+	u16 drrs_enabled:1;
+	u16 grs_enabled:1;
+	u16 gpmt_enabled:1;
+	u16 tbt_enabled:1;
+	u16 psr_enabled:1;
+	u16 ips_enabled:1;
+	u16 reserved3:4;
+	u16 pc_feature_valid:1;
+} __packed;
+
+#define EDP_18BPP	0
+#define EDP_24BPP	1
+#define EDP_30BPP	2
+#define EDP_RATE_1_62	0
+#define EDP_RATE_2_7	1
+#define EDP_LANE_1	0
+#define EDP_LANE_2	1
+#define EDP_LANE_4	3
+#define EDP_PREEMPHASIS_NONE	0
+#define EDP_PREEMPHASIS_3_5dB	1
+#define EDP_PREEMPHASIS_6dB	2
+#define EDP_PREEMPHASIS_9_5dB	3
+#define EDP_VSWING_0_4V		0
+#define EDP_VSWING_0_6V		1
+#define EDP_VSWING_0_8V		2
+#define EDP_VSWING_1_2V		3
+
+
+
+/*
+ * Driver<->VBIOS interaction occurs through scratch bits in
+ * GR18 & SWF*.
+ */
+
+/* GR18 bits are set on display switch and hotkey events */
+#define GR18_DRIVER_SWITCH_EN	(1<<7) /* 0: VBIOS control, 1: driver control */
+#define GR18_HOTKEY_MASK	0x78 /* See also SWF4 15:0 */
+#define   GR18_HK_NONE		(0x0<<3)
+#define   GR18_HK_LFP_STRETCH	(0x1<<3)
+#define   GR18_HK_TOGGLE_DISP	(0x2<<3)
+#define   GR18_HK_DISP_SWITCH	(0x4<<3) /* see SWF14 15:0 for what to enable */
+#define   GR18_HK_POPUP_DISABLED (0x6<<3)
+#define   GR18_HK_POPUP_ENABLED	(0x7<<3)
+#define   GR18_HK_PFIT		(0x8<<3)
+#define   GR18_HK_APM_CHANGE	(0xa<<3)
+#define   GR18_HK_MULTIPLE	(0xc<<3)
+#define GR18_USER_INT_EN	(1<<2)
+#define GR18_A0000_FLUSH_EN	(1<<1)
+#define GR18_SMM_EN		(1<<0)
+
+/* Set by driver, cleared by VBIOS */
+#define SWF00_YRES_SHIFT	16
+#define SWF00_XRES_SHIFT	0
+#define SWF00_RES_MASK		0xffff
+
+/* Set by VBIOS at boot time and driver at runtime */
+#define SWF01_TV2_FORMAT_SHIFT	8
+#define SWF01_TV1_FORMAT_SHIFT	0
+#define SWF01_TV_FORMAT_MASK	0xffff
+
+#define SWF10_VBIOS_BLC_I2C_EN	(1<<29)
+#define SWF10_GTT_OVERRIDE_EN	(1<<28)
+#define SWF10_LFP_DPMS_OVR	(1<<27) /* override DPMS on display switch */
+#define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
+#define   SWF10_OLD_TOGGLE	0x0
+#define   SWF10_TOGGLE_LIST_1	0x1
+#define   SWF10_TOGGLE_LIST_2	0x2
+#define   SWF10_TOGGLE_LIST_3	0x3
+#define   SWF10_TOGGLE_LIST_4	0x4
+#define SWF10_PANNING_EN	(1<<23)
+#define SWF10_DRIVER_LOADED	(1<<22)
+#define SWF10_EXTENDED_DESKTOP	(1<<21)
+#define SWF10_EXCLUSIVE_MODE	(1<<20)
+#define SWF10_OVERLAY_EN	(1<<19)
+#define SWF10_PLANEB_HOLDOFF	(1<<18)
+#define SWF10_PLANEA_HOLDOFF	(1<<17)
+#define SWF10_VGA_HOLDOFF	(1<<16)
+#define SWF10_ACTIVE_DISP_MASK	0xffff
+#define   SWF10_PIPEB_LFP2	(1<<15)
+#define   SWF10_PIPEB_EFP2	(1<<14)
+#define   SWF10_PIPEB_TV2	(1<<13)
+#define   SWF10_PIPEB_CRT2	(1<<12)
+#define   SWF10_PIPEB_LFP	(1<<11)
+#define   SWF10_PIPEB_EFP	(1<<10)
+#define   SWF10_PIPEB_TV	(1<<9)
+#define   SWF10_PIPEB_CRT	(1<<8)
+#define   SWF10_PIPEA_LFP2	(1<<7)
+#define   SWF10_PIPEA_EFP2	(1<<6)
+#define   SWF10_PIPEA_TV2	(1<<5)
+#define   SWF10_PIPEA_CRT2	(1<<4)
+#define   SWF10_PIPEA_LFP	(1<<3)
+#define   SWF10_PIPEA_EFP	(1<<2)
+#define   SWF10_PIPEA_TV	(1<<1)
+#define   SWF10_PIPEA_CRT	(1<<0)
+
+#define SWF11_MEMORY_SIZE_SHIFT	16
+#define SWF11_SV_TEST_EN	(1<<15)
+#define SWF11_IS_AGP		(1<<14)
+#define SWF11_DISPLAY_HOLDOFF	(1<<13)
+#define SWF11_DPMS_REDUCED	(1<<12)
+#define SWF11_IS_VBE_MODE	(1<<11)
+#define SWF11_PIPEB_ACCESS	(1<<10) /* 0 here means pipe a */
+#define SWF11_DPMS_MASK		0x07
+#define   SWF11_DPMS_OFF	(1<<2)
+#define   SWF11_DPMS_SUSPEND	(1<<1)
+#define   SWF11_DPMS_STANDBY	(1<<0)
+#define   SWF11_DPMS_ON		0
+
+#define SWF14_GFX_PFIT_EN	(1<<31)
+#define SWF14_TEXT_PFIT_EN	(1<<30)
+#define SWF14_LID_STATUS_CLOSED	(1<<29) /* 0 here means open */
+#define SWF14_POPUP_EN		(1<<28)
+#define SWF14_DISPLAY_HOLDOFF	(1<<27)
+#define SWF14_DISP_DETECT_EN	(1<<26)
+#define SWF14_DOCKING_STATUS_DOCKED (1<<25) /* 0 here means undocked */
+#define SWF14_DRIVER_STATUS	(1<<24)
+#define SWF14_OS_TYPE_WIN9X	(1<<23)
+#define SWF14_OS_TYPE_WINNT	(1<<22)
+/* 21:19 rsvd */
+#define SWF14_PM_TYPE_MASK	0x00070000
+#define   SWF14_PM_ACPI_VIDEO	(0x4 << 16)
+#define   SWF14_PM_ACPI		(0x3 << 16)
+#define   SWF14_PM_APM_12	(0x2 << 16)
+#define   SWF14_PM_APM_11	(0x1 << 16)
+#define SWF14_HK_REQUEST_MASK	0x0000ffff /* see GR18 6:3 for event type */
+          /* if GR18 indicates a display switch */
+#define   SWF14_DS_PIPEB_LFP2_EN (1<<15)
+#define   SWF14_DS_PIPEB_EFP2_EN (1<<14)
+#define   SWF14_DS_PIPEB_TV2_EN  (1<<13)
+#define   SWF14_DS_PIPEB_CRT2_EN (1<<12)
+#define   SWF14_DS_PIPEB_LFP_EN  (1<<11)
+#define   SWF14_DS_PIPEB_EFP_EN  (1<<10)
+#define   SWF14_DS_PIPEB_TV_EN   (1<<9)
+#define   SWF14_DS_PIPEB_CRT_EN  (1<<8)
+#define   SWF14_DS_PIPEA_LFP2_EN (1<<7)
+#define   SWF14_DS_PIPEA_EFP2_EN (1<<6)
+#define   SWF14_DS_PIPEA_TV2_EN  (1<<5)
+#define   SWF14_DS_PIPEA_CRT2_EN (1<<4)
+#define   SWF14_DS_PIPEA_LFP_EN  (1<<3)
+#define   SWF14_DS_PIPEA_EFP_EN  (1<<2)
+#define   SWF14_DS_PIPEA_TV_EN   (1<<1)
+#define   SWF14_DS_PIPEA_CRT_EN  (1<<0)
+          /* if GR18 indicates a panel fitting request */
+#define   SWF14_PFIT_EN		(1<<0) /* 0 means disable */
+          /* if GR18 indicates an APM change request */
+#define   SWF14_APM_HIBERNATE	0x4
+#define   SWF14_APM_SUSPEND	0x3
+#define   SWF14_APM_STANDBY	0x1
+#define   SWF14_APM_RESTORE	0x0
+
+/* Block 52 contains MIPI configuration block
+ * 6 * bdb_mipi_config, followed by 6 pps data block
+ * block below
+ */
+#define MAX_MIPI_CONFIGURATIONS	6
+
+struct bdb_mipi_config {
+	struct mipi_config config[MAX_MIPI_CONFIGURATIONS];
+	struct mipi_pps_data pps[MAX_MIPI_CONFIGURATIONS];
+} __packed;
+
+/* Block 53 contains MIPI sequences as needed by the panel
+ * for enabling it. This block can be variable in size and
+ * can be maximum of 6 blocks
+ */
+struct bdb_mipi_sequence {
+	u8 version;
+	u8 data[0];
+} __packed;
+
+enum mipi_gpio_pin_index {
+	MIPI_GPIO_UNDEFINED = 0,
+	MIPI_GPIO_PANEL_ENABLE,
+	MIPI_GPIO_BL_ENABLE,
+	MIPI_GPIO_PWM_ENABLE,
+	MIPI_GPIO_RESET_N,
+	MIPI_GPIO_PWR_DOWN_R,
+	MIPI_GPIO_STDBY_RST_N,
+	MIPI_GPIO_MAX
+};
+
+#endif /* _INTEL_VBT_DEFS_H_ */
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 05/10] tools/intel_vbt_decode: migrate timing dumping to kernel struct
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (3 preceding siblings ...)
  2017-08-28 12:19 ` [i-g-t PATCH 04/10] tools/intel_vbt_decode: start migrating to kernel intel_vbt_defs.h Jani Nikula
@ 2017-08-28 12:19 ` Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 06/10] tools/intel_vbt_decode: migrate child device " Jani Nikula
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Adapt the dumping according to the changes, and do what the kernel does.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 28 ----------------------------
 tools/intel_vbt_decode.c |  9 ++++++---
 tools/intel_vbt_defs.h   | 31 +++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index 65e64ccb41ef..8d1bf7ae0c81 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -155,34 +155,6 @@ struct bdb_child_devices {
 	struct child_device_config children[DEVICE_CHILD_SIZE];
 } __attribute__ ((packed));
 
-struct lvds_dvo_timing {
-	uint16_t clock;		/**< In 10khz */
-	uint8_t hactive_lo;
-	uint8_t hblank_lo;
-	uint8_t hblank_hi:4;
-	uint8_t hactive_hi:4;
-	uint8_t vactive_lo;
-	uint8_t vblank_lo;
-	uint8_t vblank_hi:4;
-	uint8_t vactive_hi:4;
-	uint8_t hsync_off_lo;
-	uint8_t hsync_pulse_width;
-	uint8_t vsync_pulse_width:4;
-	uint8_t vsync_off:4;
-	uint8_t rsvd0:6;
-	uint8_t hsync_off_hi:2;
-	uint8_t h_image;
-	uint8_t v_image;
-	uint8_t max_hv;
-	uint8_t h_border;
-	uint8_t v_border;
-	uint8_t rsvd1:3;
-	uint8_t digital:2;
-	uint8_t vsync_positive:1;
-	uint8_t hsync_positive:1;
-	uint8_t rsvd2:1;
-} __attribute__((packed));
-
 struct blc_struct {
 	uint8_t inverter_type:2;
 	uint8_t inverter_polarity:1;	/* 1 means inverted (0 = max brightness) */
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 836a9783d54e..beb33672835e 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -950,7 +950,8 @@ print_detail_timing_data(const struct lvds_dvo_timing *dvo_timing)
 	display = (dvo_timing->hactive_hi << 8) | dvo_timing->hactive_lo;
 	sync_start = display +
 		((dvo_timing->hsync_off_hi << 8) | dvo_timing->hsync_off_lo);
-	sync_end = sync_start + dvo_timing->hsync_pulse_width;
+	sync_end = sync_start + ((dvo_timing->hsync_pulse_width_hi) << 8 |
+				 dvo_timing->hsync_pulse_width_lo);
 	total = display +
 		((dvo_timing->hblank_hi << 8) | dvo_timing->hblank_lo);
 	printf("\thdisplay: %d\n", display);
@@ -959,8 +960,10 @@ print_detail_timing_data(const struct lvds_dvo_timing *dvo_timing)
 	printf("\thtotal: %d\n", total);
 
 	display = (dvo_timing->vactive_hi << 8) | dvo_timing->vactive_lo;
-	sync_start = display + dvo_timing->vsync_off;
-	sync_end = sync_start + dvo_timing->vsync_pulse_width;
+	sync_start = display + ((dvo_timing->vsync_off_hi << 8) |
+				dvo_timing->vsync_off_lo);
+	sync_end = sync_start + ((dvo_timing->vsync_pulse_width_hi << 8) |
+				 dvo_timing->vsync_pulse_width_lo);
 	total = display +
 		((dvo_timing->vblank_hi << 8) | dvo_timing->vblank_lo);
 	printf("\tvdisplay: %d\n", display);
diff --git a/tools/intel_vbt_defs.h b/tools/intel_vbt_defs.h
index 5481304d2ac2..8bdb2292747b 100644
--- a/tools/intel_vbt_defs.h
+++ b/tools/intel_vbt_defs.h
@@ -379,6 +379,37 @@ struct lvds_fp_timing {
 	u16 terminator;
 } __packed;
 
+struct lvds_dvo_timing {
+	u16 clock;		/**< In 10khz */
+	u8 hactive_lo;
+	u8 hblank_lo;
+	u8 hblank_hi:4;
+	u8 hactive_hi:4;
+	u8 vactive_lo;
+	u8 vblank_lo;
+	u8 vblank_hi:4;
+	u8 vactive_hi:4;
+	u8 hsync_off_lo;
+	u8 hsync_pulse_width_lo;
+	u8 vsync_pulse_width_lo:4;
+	u8 vsync_off_lo:4;
+	u8 vsync_pulse_width_hi:2;
+	u8 vsync_off_hi:2;
+	u8 hsync_pulse_width_hi:2;
+	u8 hsync_off_hi:2;
+	u8 himage_lo;
+	u8 vimage_lo;
+	u8 vimage_hi:4;
+	u8 himage_hi:4;
+	u8 h_border;
+	u8 v_border;
+	u8 rsvd1:3;
+	u8 digital:2;
+	u8 vsync_positive:1;
+	u8 hsync_positive:1;
+	u8 non_interlaced:1;
+} __packed;
+
 struct lvds_pnp_id {
 	u16 mfg_name;
 	u16 product_code;
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 06/10] tools/intel_vbt_decode: migrate child device dumping to kernel struct
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (4 preceding siblings ...)
  2017-08-28 12:19 ` [i-g-t PATCH 05/10] tools/intel_vbt_decode: migrate timing dumping to kernel struct Jani Nikula
@ 2017-08-28 12:19 ` Jani Nikula
  2017-08-28 12:19 ` [i-g-t PATCH 07/10] tools/intel_vbt_decode: migrate psr " Jani Nikula
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Retain the legacy definition for the obsolete child device block, at
least for now. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 58 +----------------------------
 tools/intel_vbt_decode.c | 45 ++++++++++-------------
 tools/intel_vbt_defs.h   | 96 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 118 insertions(+), 81 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index 8d1bf7ae0c81..3f441a6da17b 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -72,7 +72,7 @@
 #define DEVICE_PORT_DPC		8
 #define DEVICE_PORT_DPD		9
 
-struct child_device_config {
+struct legacy_child_device_config {
 	uint16_t handle;
 	uint16_t device_type;	/* See DEVICE_TYPE_* above */
 	uint8_t device_id[10];
@@ -94,65 +94,11 @@ struct child_device_config {
 	uint8_t dvo_function;
 } __attribute__ ((packed));
 
-struct efp_child_device_config {
-	uint16_t handle;
-	uint16_t device_type;
-	uint8_t i2c_speed;
-	uint8_t dp_onboard_redriver; /* 158 */
-	uint8_t dp_ondock_redriver; /* 158 */
-	uint8_t hdmi_level_shifter_value:4; /* 169 */
-	uint8_t hdmi_max_data_rate:4; /* 204 */
-	uint16_t dtd_buf_ptr; /* 161 */
-	uint8_t edidless_efp:1; /* 161 */
-	uint8_t compression_enable:1; /* 198 */
-	uint8_t compression_method:1; /* 198 */
-	uint8_t ganged_edp:1; /* 202 */
-	uint8_t skip0:4;
-	uint8_t compression_structure_index:4; /* 198 */
-	uint8_t skip1:4;
-	uint8_t slave_port; /*  202 */
-	uint8_t skip2;
-	uint16_t addin_offset;
-	uint8_t port;
-	uint8_t i2c_pin; /* for add-in card */
-	uint8_t slave_addr; /* for add-in card */
-	uint8_t ddc_pin;
-	uint16_t edid_ptr;
-	uint8_t dvo_config;
-	uint8_t efp_docked_port:1; /* 158 */
-	uint8_t lane_reversal:1; /* 184 */
-	uint8_t onboard_lspcon:1; /* 192 */
-	uint8_t iboost_enable:1; /* 196 */
-	uint8_t hpd_invert:1; /* BXT 196 */
-	uint8_t slip3:3;
-	uint8_t hdmi_compat:1;
-	uint8_t dp_compat:1;
-	uint8_t tmds_compat:1;
-	uint8_t skip4:5;
-	uint8_t aux_chan;
-	uint8_t dongle_detect;
-	uint8_t pipe_cap:2;
-	uint8_t sdvo_stall:1; /* 158 */
-	uint8_t hpd_status:2;
-	uint8_t integrated_encoder:1;
-	uint8_t skip5:2;
-	uint8_t dvo_wiring;
-	uint8_t mipi_bridge_type; /* 171 */
-	uint16_t device_class_ext;
-	uint8_t dvo_function;
-	uint8_t dp_usb_type_c:1; /* 195 */
-	uint8_t skip6:7;
-	uint8_t dp_usb_type_c_2x_gpio_index; /* 195 */
-	uint16_t dp_usb_type_c_2x_gpio_pin; /* 195 */
-	uint8_t iboost_dp:4; /* 196 */
-	uint8_t iboost_hdmi:4; /* 196 */
-} __attribute__ ((packed));
-
 #define DEVICE_CHILD_SIZE 7
 
 struct bdb_child_devices {
 	uint8_t child_structure_size;
-	struct child_device_config children[DEVICE_CHILD_SIZE];
+	struct legacy_child_device_config children[DEVICE_CHILD_SIZE];
 } __attribute__ ((packed));
 
 struct blc_struct {
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index beb33672835e..711f29979418 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -383,6 +383,7 @@ static const char *efp_port(uint8_t type)
 static void dump_child_device(struct context *context,
 			      const struct child_device_config *child)
 {
+	const struct child_device_config *efp = child;
 	char child_id[11];
 
 	if (!child->device_type)
@@ -399,8 +400,6 @@ static void dump_child_device(struct context *context,
 		printf("\t\tAIM offset: %d\n", child->addin_offset);
 		printf("\t\tDVO port: 0x%02x\n", child->dvo_port);
 	} else { /* 152+ have EFP blocks here */
-		const struct efp_child_device_config *efp =
-			(const struct efp_child_device_config *)child;
 		printf("\tEFP device info:\n");
 		printf("\t\tDevice handle: 0x%04x (%s)\n", efp->handle,
 		       child_device_handle(efp->handle));
@@ -420,21 +419,21 @@ static void dump_child_device(struct context *context,
 		printf("\t\tCompression structure index: 0x%02x)\n", efp->compression_structure_index);
 		printf("\t\tSlave DDI port: 0x%02x (%s)\n", efp->slave_port, efp_port(efp->slave_port));
 		printf("\t\tAIM offset: %d\n", child->addin_offset);
-		printf("\t\tPort: 0x%02x (%s)\n", efp->port, efp_port(efp->port));
+		printf("\t\tPort: 0x%02x (%s)\n", efp->dvo_port, efp_port(efp->dvo_port));
 		printf("\t\tAIM I2C pin: 0x%02x\n", efp->i2c_pin);
 		printf("\t\tAIM Slave address: 0x%02x\n", efp->slave_addr);
 		printf("\t\tDDC pin: 0x%02x\n", efp->ddc_pin);
 		printf("\t\tEDID buffer ptr: 0x%02x\n", efp->edid_ptr);
-		printf("\t\tDVO config: 0x%02x\n", efp->dvo_config);
+		printf("\t\tDVO config: 0x%02x\n", efp->dvo_cfg);
 		printf("\t\tHPD sense invert: %s\n", YESNO(efp->hpd_invert));
-		printf("\t\tIboost enable: %s\n", YESNO(efp->iboost_enable));
-		printf("\t\tOnboard LSPCON: %s\n", YESNO(efp->onboard_lspcon));
+		printf("\t\tIboost enable: %s\n", YESNO(efp->iboost));
+		printf("\t\tOnboard LSPCON: %s\n", YESNO(efp->lspcon));
 		printf("\t\tLane reversal: %s\n", YESNO(efp->lane_reversal));
-		printf("\t\tEFP routed through dock: %s\n", YESNO(efp->efp_docked_port));
-		printf("\t\tHDMI compatible? %s\n", YESNO(efp->hdmi_compat));
-		printf("\t\tDP compatible? %s\n", YESNO(efp->dp_compat));
-		printf("\t\tTMDS compatible? %s\n", YESNO(efp->tmds_compat));
-		printf("\t\tAux channel: 0x%02x\n", efp->aux_chan);
+		printf("\t\tEFP routed through dock: %s\n", YESNO(efp->efp_routed));
+		printf("\t\tHDMI compatible? %s\n", YESNO(efp->hdmi_support));
+		printf("\t\tDP compatible? %s\n", YESNO(efp->dp_support));
+		printf("\t\tTMDS compatible? %s\n", YESNO(efp->tmds_support));
+		printf("\t\tAux channel: 0x%02x\n", efp->aux_channel);
 		printf("\t\tDongle detect: 0x%02x\n", efp->dongle_detect);
 		printf("\t\tIntegrated encoder instead of SDVO: %s\n", YESNO(efp->integrated_encoder));
 		printf("\t\tHotplu connect status: 0x%02x\n", efp->hpd_status);
@@ -456,23 +455,19 @@ static void dump_child_device(struct context *context,
 			printf("(unknown value %d)\n", efp->mipi_bridge_type);
 			break;
 		}
-		printf("\t\tDevice class extendsion: 0x%02x\n", efp->device_class_ext);
+		printf("\t\tDevice class extendsion: 0x%02x\n", efp->extended_type);
 		printf("\t\tDVO function: 0x%02x\n", efp->dvo_function);
 	}
 
 	if (context->bdb->version >= 195) {
-		const struct efp_child_device_config *efp =
-			(const struct efp_child_device_config *)child;
 		printf("\t\tDP USB type C support: %s\n", YESNO(efp->dp_usb_type_c));
-		printf("\t\t2X DP GPIO index: 0x%02x\n", efp->dp_usb_type_c_2x_gpio_index);
-		printf("\t\t2X DP GPIO pin number: 0x%02x\n", efp->dp_usb_type_c_2x_gpio_pin);
+		printf("\t\t2X DP GPIO index: 0x%02x\n", efp->dp_gpio_index);
+		printf("\t\t2X DP GPIO pin number: 0x%02x\n", efp->dp_gpio_pin_num);
 	}
 
 	if (context->bdb->version >= 196) {
-		const struct efp_child_device_config *efp =
-			(const struct efp_child_device_config *)child;
-		printf("\t\tIBoost level for HDMI: 0x%02x\n", efp->iboost_hdmi);
-		printf("\t\tIBoost level for DP/eDP: 0x%02x\n", efp->iboost_dp);
+		printf("\t\tIBoost level for HDMI: 0x%02x\n", efp->hdmi_iboost_level);
+		printf("\t\tIBoost level for DP/eDP: 0x%02x\n", efp->dp_iboost_level);
 	}
 }
 
@@ -498,11 +493,11 @@ static void dump_general_definitions(struct context *context,
 		dump_child_device(context, (const void*)&defs->devices[i * defs->child_dev_size]);
 }
 
-static void dump_child_devices(struct context *context,
-			       const struct bdb_block *block)
+static void dump_legacy_child_devices(struct context *context,
+				      const struct bdb_block *block)
 {
 	const struct bdb_child_devices *child_devs = block->data;
-	const struct child_device_config *child;
+	const struct legacy_child_device_config *child;
 	int i;
 
 	for (i = 0; i < DEVICE_CHILD_SIZE; i++) {
@@ -1517,8 +1512,8 @@ struct dumper dumpers[] = {
 	},
 	{
 		.id = BDB_CHILD_DEVICE_TABLE,
-		.name = "Child devices block",
-		.dump = dump_child_devices,
+		.name = "Legacy child devices block",
+		.dump = dump_legacy_child_devices,
 	},
 	{
 		.id = BDB_LVDS_OPTIONS,
diff --git a/tools/intel_vbt_defs.h b/tools/intel_vbt_defs.h
index 8bdb2292747b..dcb6f36443ad 100644
--- a/tools/intel_vbt_defs.h
+++ b/tools/intel_vbt_defs.h
@@ -290,6 +290,102 @@ struct bdb_general_features {
 
 #define LEGACY_CHILD_DEVICE_CONFIG_SIZE		33
 
+/*
+ * The child device config, aka the display device data structure, provides a
+ * description of a port and its configuration on the platform.
+ *
+ * The child device config size has been increased, and fields have been added
+ * and their meaning has changed over time. Care must be taken when accessing
+ * basically any of the fields to ensure the correct interpretation for the BDB
+ * version in question.
+ *
+ * When we copy the child device configs to dev_priv->vbt.child_dev, we reserve
+ * space for the full structure below, and initialize the tail not actually
+ * present in VBT to zeros. Accessing those fields is fine, as long as the
+ * default zero is taken into account, again according to the BDB version.
+ *
+ * BDB versions 155 and below are considered legacy, and version 155 seems to be
+ * a baseline for some of the VBT documentation. When adding new fields, please
+ * include the BDB version when the field was added, if it's above that.
+ */
+struct child_device_config {
+	u16 handle;
+	u16 device_type; /* See DEVICE_TYPE_* above */
+
+	union {
+		u8  device_id[10]; /* ascii string */
+		struct {
+			u8 i2c_speed;
+			u8 dp_onboard_redriver;			/* 158 */
+			u8 dp_ondock_redriver;			/* 158 */
+			u8 hdmi_level_shifter_value:4;		/* 169 */
+			u8 hdmi_max_data_rate:4;		/* 204 */
+			u16 dtd_buf_ptr;			/* 161 */
+			u8 edidless_efp:1;			/* 161 */
+			u8 compression_enable:1;		/* 198 */
+			u8 compression_method:1;		/* 198 */
+			u8 ganged_edp:1;			/* 202 */
+			u8 reserved0:4;
+			u8 compression_structure_index:4;	/* 198 */
+			u8 reserved1:4;
+			u8 slave_port;				/* 202 */
+			u8 reserved2;
+		} __packed;
+	} __packed;
+
+	u16 addin_offset;
+	u8 dvo_port; /* See DEVICE_PORT_* and DVO_PORT_* above */
+	u8 i2c_pin;
+	u8 slave_addr;
+	u8 ddc_pin;
+	u16 edid_ptr;
+	u8 dvo_cfg; /* See DEVICE_CFG_* above */
+
+	union {
+		struct {
+			u8 dvo2_port;
+			u8 i2c2_pin;
+			u8 slave2_addr;
+			u8 ddc2_pin;
+		} __packed;
+		struct {
+			u8 efp_routed:1;			/* 158 */
+			u8 lane_reversal:1;			/* 184 */
+			u8 lspcon:1;				/* 192 */
+			u8 iboost:1;				/* 196 */
+			u8 hpd_invert:1;			/* 196 */
+			u8 flag_reserved:3;
+			u8 hdmi_support:1;			/* 158 */
+			u8 dp_support:1;			/* 158 */
+			u8 tmds_support:1;			/* 158 */
+			u8 support_reserved:5;
+			u8 aux_channel;
+			u8 dongle_detect;
+		} __packed;
+	} __packed;
+
+	u8 pipe_cap:2;
+	u8 sdvo_stall:1;					/* 158 */
+	u8 hpd_status:2;
+	u8 integrated_encoder:1;
+	u8 capabilities_reserved:2;
+	u8 dvo_wiring; /* See DEVICE_WIRE_* above */
+
+	union {
+		u8 dvo2_wiring;
+		u8 mipi_bridge_type;				/* 171 */
+	} __packed;
+
+	u16 extended_type;
+	u8 dvo_function;
+	u8 dp_usb_type_c:1;					/* 195 */
+	u8 flags2_reserved:7;					/* 195 */
+	u8 dp_gpio_index;					/* 195 */
+	u16 dp_gpio_pin_num;					/* 195 */
+	u8 dp_iboost_level:4;					/* 196 */
+	u8 hdmi_iboost_level:4;					/* 196 */
+} __packed;
+
 struct bdb_general_definitions {
 	/* DDC GPIO */
 	u8 crt_ddc_gmbus_pin;
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 07/10] tools/intel_vbt_decode: migrate psr dumping to kernel struct
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (5 preceding siblings ...)
  2017-08-28 12:19 ` [i-g-t PATCH 06/10] tools/intel_vbt_decode: migrate child device " Jani Nikula
@ 2017-08-28 12:19 ` Jani Nikula
  2017-08-28 12:20 ` [i-g-t PATCH 08/10] tools/intel_vbt_decode: migrate edp " Jani Nikula
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 15 ---------------
 tools/intel_vbt_decode.c | 26 ++++++++++++++------------
 tools/intel_vbt_defs.h   | 18 ++++++++++++++++++
 3 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index 3f441a6da17b..f4b0b9795221 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -163,21 +163,6 @@ struct bdb_edp { /* 155 */
 	struct edp_full_link_params full_link_params[16]; /* 199 */
 } __attribute__ ((packed));
 
-struct psr_params {
-	uint8_t full_link:1;
-	uint8_t require_aux_to_wakeup:1;
-	uint8_t rsvd1:6;
-	uint8_t idle_frames:4;
-	uint8_t lines_to_wait:3;
-	uint8_t rsvd2:1;
-	uint16_t tp1_wakeup_time;
-	uint16_t tp2_tp3_wakeup_time;
-} __attribute__ ((packed));
-
-struct bdb_psr {
-	struct psr_params psr[16];
-} __attribute__ ((packed));
-
 /* Block 52 contains MiPi Panel info
  * 6 such enteries will there. Index into correct
  * entery is based on the panel_index in #40 LFP
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 711f29979418..d0b91a3de3ef 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -891,7 +891,7 @@ static void dump_edp(struct context *context,
 static void dump_psr(struct context *context,
 		     const struct bdb_block *block)
 {
-	const struct bdb_psr *psr = block->data;
+	const struct bdb_psr *psr_block = block->data;
 	int i;
 
 	/* The same block ID was used for something else before? */
@@ -899,41 +899,43 @@ static void dump_psr(struct context *context,
 		return;
 
 	for (i = 0; i < 16; i++) {
+		const struct psr_table *psr = &psr_block->psr_table[i];
+
 		if (i != context->panel_type && !context->dump_all_panel_types)
 			continue;
 
 		printf("\tPanel %d%s\n", i, context->panel_type == i ? " *" : "");
 
-		printf("\t\tFull link: %s\n", YESNO(psr->psr[i].full_link));
-		printf("\t\tRequire AUX to wakeup: %s\n", YESNO(psr->psr[i].require_aux_to_wakeup));
+		printf("\t\tFull link: %s\n", YESNO(psr->full_link));
+		printf("\t\tRequire AUX to wakeup: %s\n", YESNO(psr->require_aux_to_wakeup));
 
-		switch (psr->psr[i].lines_to_wait) {
+		switch (psr->lines_to_wait) {
 		case 0:
 		case 1:
 			printf("\t\tLines to wait before link standby: %d\n",
-			       psr->psr[i].lines_to_wait);
+			       psr->lines_to_wait);
 			break;
 		case 2:
 		case 3:
 			printf("\t\tLines to wait before link standby: %d\n",
-			       1 << psr->psr[i].lines_to_wait);
+			       1 << psr->lines_to_wait);
 			break;
 		default:
 			printf("\t\tLines to wait before link standby: (unknown) (0x%x)\n",
-			       psr->psr[i].lines_to_wait);
+			       psr->lines_to_wait);
 			break;
 		}
 
 		printf("\t\tIdle frames to for PSR enable: %d\n",
-		       psr->psr[i].idle_frames);
+		       psr->idle_frames);
 
 		printf("\t\tTP1 wakeup time: %d usec (0x%x)\n",
-		       psr->psr[i].tp1_wakeup_time * 100,
-		       psr->psr[i].tp1_wakeup_time);
+		       psr->tp1_wakeup_time * 100,
+		       psr->tp1_wakeup_time);
 
 		printf("\t\tTP2/TP3 wakeup time: %d usec (0x%x)\n",
-		       psr->psr[i].tp2_tp3_wakeup_time * 100,
-		       psr->psr[i].tp2_tp3_wakeup_time);
+		       psr->tp2_tp3_wakeup_time * 100,
+		       psr->tp2_tp3_wakeup_time);
 	}
 }
 
diff --git a/tools/intel_vbt_defs.h b/tools/intel_vbt_defs.h
index dcb6f36443ad..a43ec2d1c02e 100644
--- a/tools/intel_vbt_defs.h
+++ b/tools/intel_vbt_defs.h
@@ -671,7 +671,25 @@ struct bdb_driver_features {
 #define EDP_VSWING_0_8V		2
 #define EDP_VSWING_1_2V		3
 
+struct psr_table {
+	/* Feature bits */
+	u8 full_link:1;
+	u8 require_aux_to_wakeup:1;
+	u8 feature_bits_rsvd:6;
+
+	/* Wait times */
+	u8 idle_frames:4;
+	u8 lines_to_wait:3;
+	u8 wait_times_rsvd:1;
+
+	/* TP wake up time in multiple of 100 */
+	u16 tp1_wakeup_time;
+	u16 tp2_tp3_wakeup_time;
+} __packed;
 
+struct bdb_psr {
+	struct psr_table psr_table[16];
+} __packed;
 
 /*
  * Driver<->VBIOS interaction occurs through scratch bits in
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 08/10] tools/intel_vbt_decode: migrate edp dumping to kernel struct
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (6 preceding siblings ...)
  2017-08-28 12:19 ` [i-g-t PATCH 07/10] tools/intel_vbt_decode: migrate psr " Jani Nikula
@ 2017-08-28 12:20 ` Jani Nikula
  2017-08-28 12:20 ` [i-g-t PATCH 09/10] tools/intel_vbt_decode: migrate child device type bits decoding to kernel defs Jani Nikula
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:20 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 33 ---------------------------------
 tools/intel_vbt_decode.c |  7 ++++---
 tools/intel_vbt_defs.h   | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index f4b0b9795221..9f0bc84f372c 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -130,39 +130,6 @@ struct edp_power_seq {
 	uint16_t t12;
 } __attribute__ ((packed));
 
-struct edp_fast_link_params {
-	uint8_t rate:4;
-	uint8_t lanes:4;
-	uint8_t preemphasis:4;
-	uint8_t vswing:4;
-} __attribute__ ((packed));
-
-struct edp_pwm_delays {
-	uint16_t pwm_on_to_backlight_enable;
-	uint16_t backlight_disable_to_pwm_off;
-} __attribute__ ((packed));
-
-struct edp_full_link_params {
-	uint8_t preemphasis:4;
-	uint8_t vswing:4;
-} __attribute__ ((packed));
-
-struct bdb_edp { /* 155 */
-	struct edp_power_seq power_seqs[16];
-	uint32_t color_depth;
-	struct edp_fast_link_params fast_link_params[16];
-	uint32_t sdrrs_msa_timing_delay;
-
-	uint16_t s3d_feature; /* 163 */
-	uint16_t t3_optimization; /* 165 */
-	uint64_t vswing_preemph_table_selection; /* 173 */
-	uint16_t fast_link_training; /* 182 */
-	uint16_t dpcd_600h_write_required; /* 185 */
-	struct edp_pwm_delays pwm_delays[16]; /* 186 */
-	uint16_t full_link_params_provided; /* 199 */
-	struct edp_full_link_params full_link_params[16]; /* 199 */
-} __attribute__ ((packed));
-
 /* Block 52 contains MiPi Panel info
  * 6 such enteries will there. Index into correct
  * entery is based on the panel_index in #40 LFP
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index d0b91a3de3ef..ed0b90bd63e6 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -44,6 +44,7 @@
 typedef uint8_t u8;
 typedef uint16_t u16;
 typedef uint32_t u32;
+typedef uint64_t u64;
 #define __packed __attribute__ ((packed))
 
 #define _INTEL_BIOS_PRIVATE
@@ -797,17 +798,17 @@ static void dump_edp(struct context *context,
 		}
 
 		if (context->bdb->version >= 162) {
-			bool val = (edp->s3d_feature >> i) & 1;
+			bool val = (edp->edp_s3d_feature >> i) & 1;
 			printf("\t\tStereo 3D feature: %s\n", YESNO(val));
 		}
 
 		if (context->bdb->version >= 165) {
-			bool val = (edp->t3_optimization >> i) & 1;
+			bool val = (edp->edp_t3_optimization >> i) & 1;
 			printf("\t\tT3 optimization: %s\n", YESNO(val));
 		}
 
 		if (context->bdb->version >= 173) {
-			int val = (edp->vswing_preemph_table_selection >> (i * 4)) & 0xf;
+			int val = (edp->edp_vswing_preemph >> (i * 4)) & 0xf;
 
 			printf("\t\tVswing/preemphasis table selection: ");
 			switch (val) {
diff --git a/tools/intel_vbt_defs.h b/tools/intel_vbt_defs.h
index a43ec2d1c02e..9513f9dc21ab 100644
--- a/tools/intel_vbt_defs.h
+++ b/tools/intel_vbt_defs.h
@@ -671,6 +671,41 @@ struct bdb_driver_features {
 #define EDP_VSWING_0_8V		2
 #define EDP_VSWING_1_2V		3
 
+
+struct edp_fast_link_params {
+	u8 rate:4;
+	u8 lanes:4;
+	u8 preemphasis:4;
+	u8 vswing:4;
+} __packed;
+
+struct edp_pwm_delays {
+	u16 pwm_on_to_backlight_enable;
+	u16 backlight_disable_to_pwm_off;
+} __packed;
+
+struct edp_full_link_params {
+	u8 preemphasis:4;
+	u8 vswing:4;
+} __packed;
+
+struct bdb_edp {
+	struct edp_power_seq power_seqs[16];
+	u32 color_depth;
+	struct edp_fast_link_params fast_link_params[16];
+	u32 sdrrs_msa_timing_delay;
+
+	/* ith bit indicates enabled/disabled for (i+1)th panel */
+	u16 edp_s3d_feature;					/* 162 */
+	u16 edp_t3_optimization;				/* 165 */
+	u64 edp_vswing_preemph;					/* 173 */
+	u16 fast_link_training;					/* 182 */
+	u16 dpcd_600h_write_required;				/* 185 */
+	struct edp_pwm_delays pwm_delays[16];			/* 186 */
+	u16 full_link_params_provided;				/* 199 */
+	struct edp_full_link_params full_link_params[16];	/* 199 */
+} __packed;
+
 struct psr_table {
 	/* Feature bits */
 	u8 full_link:1;
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 09/10] tools/intel_vbt_decode: migrate child device type bits decoding to kernel defs
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (7 preceding siblings ...)
  2017-08-28 12:20 ` [i-g-t PATCH 08/10] tools/intel_vbt_decode: migrate edp " Jani Nikula
@ 2017-08-28 12:20 ` Jani Nikula
  2017-08-28 12:20 ` [i-g-t PATCH 10/10] tools/intel_vbt_defs: migrate backlight dumping to kernel struct Jani Nikula
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:20 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

This lets us use the verbatim copy of the kernel intel_vbt_defs.h file.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 18 ------------------
 tools/intel_vbt_decode.c | 47 +++++++++++++++++++++++++----------------------
 tools/intel_vbt_defs.h   | 16 ++++++++++++++++
 3 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index 9f0bc84f372c..85aa38e085be 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -38,24 +38,6 @@
 #define DEVICE_HANDLE_LPF1	0x08
 #define DEVICE_HANDLE_LFP2	0x80
 
-/* device type bits */
-#define DEVICE_TYPE_CLASS_EXTENSION	15
-#define DEVICE_TYPE_POWER_MANAGEMENT	14
-#define DEVICE_TYPE_HOTPLUG_SIGNALING	13
-#define DEVICE_TYPE_INTERNAL_CONNECTOR	12
-#define DEVICE_TYPE_NOT_HDMI_OUTPUT	11
-#define DEVICE_TYPE_MIPI_OUTPUT		10
-#define DEVICE_TYPE_COMPOSITE_OUTPUT	9
-#define DEVICE_TYPE_DIAL_CHANNEL	8
-#define DEVICE_TYPE_CONTENT_PROTECTION	7
-#define DEVICE_TYPE_HIGH_SPEED_LINK	6
-#define DEVICE_TYPE_LVDS_SIGNALING	5
-#define DEVICE_TYPE_TMDS_DVI_SIGNALING	4
-#define DEVICE_TYPE_VIDEO_SIGNALING	3
-#define DEVICE_TYPE_DISPLAYPORT_OUTPUT	2
-#define DEVICE_TYPE_DIGITAL_OUTPUT	1
-#define DEVICE_TYPE_ANALOG_OUTPUT	0
-
 #define DEVICE_TYPE_DP_DVI		0x68d6
 #define DEVICE_TYPE_DVI			0x68d2
 #define DEVICE_TYPE_MIPI		0x7cc2
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index ed0b90bd63e6..d8ca0ee87198 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -299,34 +299,37 @@ static const char *child_device_type(unsigned short type)
 	return "unknown";
 }
 
-static const char * const child_device_type_bits[] = {
-	[DEVICE_TYPE_CLASS_EXTENSION] = "Class extension",
-	[DEVICE_TYPE_POWER_MANAGEMENT] = "Power management",
-	[DEVICE_TYPE_HOTPLUG_SIGNALING] = "Hotplug signaling",
-	[DEVICE_TYPE_INTERNAL_CONNECTOR] = "Internal connector",
-	[DEVICE_TYPE_NOT_HDMI_OUTPUT] = "HDMI output", /* decoded as inverse */
-	[DEVICE_TYPE_MIPI_OUTPUT] = "MIPI output",
-	[DEVICE_TYPE_COMPOSITE_OUTPUT] = "Composite output",
-	[DEVICE_TYPE_DIAL_CHANNEL] = "Dual channel",
-	[DEVICE_TYPE_CONTENT_PROTECTION] = "Content protection",
-	[DEVICE_TYPE_HIGH_SPEED_LINK] = "High speel link",
-	[DEVICE_TYPE_LVDS_SIGNALING] = "LVDS signaling",
-	[DEVICE_TYPE_TMDS_DVI_SIGNALING] = "TMDS/DVI signaling",
-	[DEVICE_TYPE_VIDEO_SIGNALING] = "Video signaling",
-	[DEVICE_TYPE_DISPLAYPORT_OUTPUT] = "DisplayPort output",
-	[DEVICE_TYPE_DIGITAL_OUTPUT] = "Digital output",
-	[DEVICE_TYPE_ANALOG_OUTPUT] = "Analog output",
+static const struct {
+	unsigned short mask;
+	const char *name;
+} child_device_type_bits[] = {
+	{ DEVICE_TYPE_CLASS_EXTENSION, "Class extension" },
+	{ DEVICE_TYPE_POWER_MANAGEMENT, "Power management" },
+	{ DEVICE_TYPE_HOTPLUG_SIGNALING, "Hotplug signaling" },
+	{ DEVICE_TYPE_INTERNAL_CONNECTOR, "Internal connector" },
+	{ DEVICE_TYPE_NOT_HDMI_OUTPUT, "HDMI output" }, /* decoded as inverse */
+	{ DEVICE_TYPE_MIPI_OUTPUT, "MIPI output" },
+	{ DEVICE_TYPE_COMPOSITE_OUTPUT, "Composite output" },
+	{ DEVICE_TYPE_DUAL_CHANNEL, "Dual channel" },
+	{ 1 << 7, "Content protection" },
+	{ DEVICE_TYPE_HIGH_SPEED_LINK, "High speel link" },
+	{ DEVICE_TYPE_LVDS_SINGALING, "LVDS signaling" },
+	{ DEVICE_TYPE_TMDS_DVI_SIGNALING, "TMDS/DVI signaling" },
+	{ DEVICE_TYPE_VIDEO_SIGNALING, "Video signaling" },
+	{ DEVICE_TYPE_DISPLAYPORT_OUTPUT, "DisplayPort output" },
+	{ DEVICE_TYPE_DIGITAL_OUTPUT, "Digital output" },
+	{ DEVICE_TYPE_ANALOG_OUTPUT, "Analog output" },
 };
 
 static void dump_child_device_type_bits(uint16_t type)
 {
-	int bit;
+	int i;
 
-	type ^= 1 << DEVICE_TYPE_NOT_HDMI_OUTPUT;
+	type ^= DEVICE_TYPE_NOT_HDMI_OUTPUT;
 
-	for (bit = 15; bit >= 0; bit--) {
-		if (type & (1 << bit))
-			printf("\t\t\t%s\n", child_device_type_bits[bit]);
+	for (i = 0; i < ARRAY_SIZE(child_device_type_bits); i++) {
+		if (child_device_type_bits[i].mask & type)
+			printf("\t\t\t%s\n", child_device_type_bits[i].name);
 	}
 }
 
diff --git a/tools/intel_vbt_defs.h b/tools/intel_vbt_defs.h
index 9513f9dc21ab..404569c9fdfc 100644
--- a/tools/intel_vbt_defs.h
+++ b/tools/intel_vbt_defs.h
@@ -218,6 +218,22 @@ struct bdb_general_features {
 #define DEVICE_TYPE_DP_DUAL_MODE	0x60D6
 #define DEVICE_TYPE_eDP			0x78C6
 
+#define DEVICE_TYPE_CLASS_EXTENSION	(1 << 15)
+#define DEVICE_TYPE_POWER_MANAGEMENT	(1 << 14)
+#define DEVICE_TYPE_HOTPLUG_SIGNALING	(1 << 13)
+#define DEVICE_TYPE_INTERNAL_CONNECTOR	(1 << 12)
+#define DEVICE_TYPE_NOT_HDMI_OUTPUT	(1 << 11)
+#define DEVICE_TYPE_MIPI_OUTPUT		(1 << 10)
+#define DEVICE_TYPE_COMPOSITE_OUTPUT	(1 << 9)
+#define DEVICE_TYPE_DUAL_CHANNEL	(1 << 8)
+#define DEVICE_TYPE_HIGH_SPEED_LINK	(1 << 6)
+#define DEVICE_TYPE_LVDS_SINGALING	(1 << 5)
+#define DEVICE_TYPE_TMDS_DVI_SIGNALING	(1 << 4)
+#define DEVICE_TYPE_VIDEO_SIGNALING	(1 << 3)
+#define DEVICE_TYPE_DISPLAYPORT_OUTPUT	(1 << 2)
+#define DEVICE_TYPE_DIGITAL_OUTPUT	(1 << 1)
+#define DEVICE_TYPE_ANALOG_OUTPUT	(1 << 0)
+
 /*
  * Bits we care about when checking for DEVICE_TYPE_eDP. Depending on the
  * system, the other bits may or may not be set for eDP outputs.
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [i-g-t PATCH 10/10] tools/intel_vbt_defs: migrate backlight dumping to kernel struct
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (8 preceding siblings ...)
  2017-08-28 12:20 ` [i-g-t PATCH 09/10] tools/intel_vbt_decode: migrate child device type bits decoding to kernel defs Jani Nikula
@ 2017-08-28 12:20 ` Jani Nikula
  2017-08-28 12:46 ` ✓ Fi.CI.BAT: success for tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Patchwork
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-28 12:20 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Drop obsolete field dumping.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 16 ----------------
 tools/intel_vbt_decode.c | 20 ++++++++------------
 2 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index 85aa38e085be..4e06ef74e459 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -83,22 +83,6 @@ struct bdb_child_devices {
 	struct legacy_child_device_config children[DEVICE_CHILD_SIZE];
 } __attribute__ ((packed));
 
-struct blc_struct {
-	uint8_t inverter_type:2;
-	uint8_t inverter_polarity:1;	/* 1 means inverted (0 = max brightness) */
-	uint8_t gpio_pins:3;
-	uint8_t gmbus_speed:2;
-	uint16_t pwm_freq;	/* in Hz */
-	uint8_t min_brightness;	/* (0-255) */
-	uint8_t i2c_slave_addr;
-	uint8_t i2c_cmd;
-} __attribute__ ((packed));
-
-struct bdb_lvds_backlight {
-	uint8_t blcstruct_size;
-	struct blc_struct panels[16];
-} __attribute__ ((packed));
-
 #define BDB_DRIVER_NO_LVDS	0
 #define BDB_DRIVER_INT_LVDS	1
 #define BDB_DRIVER_SDVO_LVDS	2
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index d8ca0ee87198..3535459d3353 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -225,25 +225,21 @@ static void dump_general_features(struct context *context,
 static void dump_backlight_info(struct context *context,
 				const struct bdb_block *block)
 {
-	const struct bdb_lvds_backlight *backlight = block->data;
-	const struct blc_struct *blc;
+	const struct bdb_lfp_backlight_data *backlight = block->data;
+	const struct bdb_lfp_backlight_data_entry *blc;
 
-	if (sizeof(struct blc_struct) != backlight->blcstruct_size) {
+	if (sizeof(*blc) != backlight->entry_size) {
 		printf("\tBacklight struct sizes don't match (expected %zu, got %u), skipping\n",
-		     sizeof(struct blc_struct), backlight->blcstruct_size);
+		     sizeof(*blc), backlight->entry_size);
 		return;
 	}
 
-	blc = &backlight->panels[context->panel_type];
+	blc = &backlight->data[context->panel_type];
 
-	printf("\tInverter type: %d\n", blc->inverter_type);
-	printf("\t     polarity: %d\n", blc->inverter_polarity);
-	printf("\t    GPIO pins: %d\n", blc->gpio_pins);
-	printf("\t  GMBUS speed: %d\n", blc->gmbus_speed);
-	printf("\t     PWM freq: %d\n", blc->pwm_freq);
+	printf("\tInverter type: %d\n", blc->type);
+	printf("\t     polarity: %d\n", blc->active_low_pwm);
+	printf("\t     PWM freq: %d\n", blc->pwm_freq_hz);
 	printf("\tMinimum brightness: %d\n", blc->min_brightness);
-	printf("\tI2C slave addr: 0x%02x\n", blc->i2c_slave_addr);
-	printf("\tI2C command: 0x%02x\n", blc->i2c_cmd);
 }
 
 static const struct {
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* ✓ Fi.CI.BAT: success for tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (9 preceding siblings ...)
  2017-08-28 12:20 ` [i-g-t PATCH 10/10] tools/intel_vbt_defs: migrate backlight dumping to kernel struct Jani Nikula
@ 2017-08-28 12:46 ` Patchwork
  2017-08-28 15:25 ` ✓ Fi.CI.IGT: " Patchwork
  2017-08-28 22:19 ` [i-g-t PATCH 00/10] " Daniel Vetter
  12 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2017-08-28 12:46 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

== Series Details ==

Series: tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h
URL   : https://patchwork.freedesktop.org/series/29427/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
60f6a12195395934f179d5ecc080353190d19a6c tests: chamelium: Eliminate reset when preparing output

with latest DRM-Tip kernel build CI_DRM_3010
00b77f621f83 drm-tip: 2017y-08m-28d-10h-25m-08s UTC integration manifest

Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                pass       -> FAIL       (fi-snb-2600) fdo#100007
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                fail       -> PASS       (fi-snb-2600) fdo#100215
        Subgroup basic-flip-after-cursor-varying-size:
                pass       -> FAIL       (fi-hsw-4770) fdo#102402 +1

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#102402 https://bugs.freedesktop.org/show_bug.cgi?id=102402

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:458s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:451s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:362s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:560s
fi-bwr-2160      total:279  pass:184  dwarn:0   dfail:0   fail:0   skip:95  time:253s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:524s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:524s
fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:518s
fi-elk-e7500     total:279  pass:230  dwarn:0   dfail:0   fail:0   skip:49  time:429s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:609s
fi-hsw-4770      total:279  pass:261  dwarn:0   dfail:0   fail:2   skip:16  time:451s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:425s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:425s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:506s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:473s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:475s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:594s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:600s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:525s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:467s
fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:478s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:486s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:447s
fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:507s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:548s
fi-snb-2600      total:279  pass:249  dwarn:0   dfail:0   fail:1   skip:29  time:405s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_111/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* ✓ Fi.CI.IGT: success for tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (10 preceding siblings ...)
  2017-08-28 12:46 ` ✓ Fi.CI.BAT: success for tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Patchwork
@ 2017-08-28 15:25 ` Patchwork
  2017-08-28 22:19 ` [i-g-t PATCH 00/10] " Daniel Vetter
  12 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2017-08-28 15:25 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

== Series Details ==

Series: tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h
URL   : https://patchwork.freedesktop.org/series/29427/
State : success

== Summary ==

Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test perf:
        Subgroup blocking:
                pass       -> FAIL       (shard-hsw) fdo#102252 +1

fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-hsw        total:2230 pass:1229 dwarn:0   dfail:0   fail:19  skip:982 time:9638s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_111/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h
  2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
                   ` (11 preceding siblings ...)
  2017-08-28 15:25 ` ✓ Fi.CI.IGT: " Patchwork
@ 2017-08-28 22:19 ` Daniel Vetter
  2017-08-29 14:31   ` Jani Nikula
  12 siblings, 1 reply; 15+ messages in thread
From: Daniel Vetter @ 2017-08-28 22:19 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Mon, Aug 28, 2017 at 03:19:52PM +0300, Jani Nikula wrote:
> There's little point in duplicating the efforts of describing the same
> data in two places. This series lets us use the verbatim copy of the
> intel_vbt_defs.h from kernel. Going forward, we should add the changes
> in kernel first, then copy the header over to igt.
> 
> If we need local tweaks, we can still have them in intel_bios.h, and
> indeed we'll still have some after this series.

I assume the end result matches what we now have in the kernel. Might be
good practice to reference the sha1 of the kernel commit (needs to be a
stable sha1, not drm-tip ofc) when resyncing in the future. On the series:

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> BR,
> Jani.
> 
> Jani Nikula (10):
>   tools/intel_lid: use local register definition
>   tools/intel_vbt_decode: remove unused definitions from intel_bios.h
>   tools/intel_vbt_decode: clean up struct lvds_dvo_timing
>   tools/intel_vbt_decode: start migrating to kernel intel_vbt_defs.h
>   tools/intel_vbt_decode: migrate timing dumping to kernel struct
>   tools/intel_vbt_decode: migrate child device dumping to kernel struct
>   tools/intel_vbt_decode: migrate psr dumping to kernel struct
>   tools/intel_vbt_decode: migrate edp dumping to kernel struct
>   tools/intel_vbt_decode: migrate child device type bits decoding to
>     kernel defs
>   tools/intel_vbt_defs: migrate backlight dumping to kernel struct
> 
>  tools/intel_bios.h       | 760 +--------------------------------------
>  tools/intel_lid.c        |   5 +-
>  tools/intel_vbt_decode.c | 180 +++++-----
>  tools/intel_vbt_defs.h   | 897 +++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 996 insertions(+), 846 deletions(-)
>  create mode 100644 tools/intel_vbt_defs.h
> 
> -- 
> 2.11.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h
  2017-08-28 22:19 ` [i-g-t PATCH 00/10] " Daniel Vetter
@ 2017-08-29 14:31   ` Jani Nikula
  0 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-08-29 14:31 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

On Tue, 29 Aug 2017, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Aug 28, 2017 at 03:19:52PM +0300, Jani Nikula wrote:
>> There's little point in duplicating the efforts of describing the same
>> data in two places. This series lets us use the verbatim copy of the
>> intel_vbt_defs.h from kernel. Going forward, we should add the changes
>> in kernel first, then copy the header over to igt.
>> 
>> If we need local tweaks, we can still have them in intel_bios.h, and
>> indeed we'll still have some after this series.
>
> I assume the end result matches what we now have in the kernel. Might be
> good practice to reference the sha1 of the kernel commit (needs to be a
> stable sha1, not drm-tip ofc) when resyncing in the future. On the series:
>
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Pushed, with the kernel commit reference added.

There'd be plenty to tweak and fix here, but the main goal of reducing
duplication was reached, so that'll do for now.

BR,
Jani.


>> 
>> BR,
>> Jani.
>> 
>> Jani Nikula (10):
>>   tools/intel_lid: use local register definition
>>   tools/intel_vbt_decode: remove unused definitions from intel_bios.h
>>   tools/intel_vbt_decode: clean up struct lvds_dvo_timing
>>   tools/intel_vbt_decode: start migrating to kernel intel_vbt_defs.h
>>   tools/intel_vbt_decode: migrate timing dumping to kernel struct
>>   tools/intel_vbt_decode: migrate child device dumping to kernel struct
>>   tools/intel_vbt_decode: migrate psr dumping to kernel struct
>>   tools/intel_vbt_decode: migrate edp dumping to kernel struct
>>   tools/intel_vbt_decode: migrate child device type bits decoding to
>>     kernel defs
>>   tools/intel_vbt_defs: migrate backlight dumping to kernel struct
>> 
>>  tools/intel_bios.h       | 760 +--------------------------------------
>>  tools/intel_lid.c        |   5 +-
>>  tools/intel_vbt_decode.c | 180 +++++-----
>>  tools/intel_vbt_defs.h   | 897 +++++++++++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 996 insertions(+), 846 deletions(-)
>>  create mode 100644 tools/intel_vbt_defs.h
>> 
>> -- 
>> 2.11.0
>> 
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-08-29 14:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28 12:19 [i-g-t PATCH 00/10] tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Jani Nikula
2017-08-28 12:19 ` [i-g-t PATCH 01/10] tools/intel_lid: use local register definition Jani Nikula
2017-08-28 12:19 ` [i-g-t PATCH 02/10] tools/intel_vbt_decode: remove unused definitions from intel_bios.h Jani Nikula
2017-08-28 12:19 ` [i-g-t PATCH 03/10] tools/intel_vbt_decode: clean up struct lvds_dvo_timing Jani Nikula
2017-08-28 12:19 ` [i-g-t PATCH 04/10] tools/intel_vbt_decode: start migrating to kernel intel_vbt_defs.h Jani Nikula
2017-08-28 12:19 ` [i-g-t PATCH 05/10] tools/intel_vbt_decode: migrate timing dumping to kernel struct Jani Nikula
2017-08-28 12:19 ` [i-g-t PATCH 06/10] tools/intel_vbt_decode: migrate child device " Jani Nikula
2017-08-28 12:19 ` [i-g-t PATCH 07/10] tools/intel_vbt_decode: migrate psr " Jani Nikula
2017-08-28 12:20 ` [i-g-t PATCH 08/10] tools/intel_vbt_decode: migrate edp " Jani Nikula
2017-08-28 12:20 ` [i-g-t PATCH 09/10] tools/intel_vbt_decode: migrate child device type bits decoding to kernel defs Jani Nikula
2017-08-28 12:20 ` [i-g-t PATCH 10/10] tools/intel_vbt_defs: migrate backlight dumping to kernel struct Jani Nikula
2017-08-28 12:46 ` ✓ Fi.CI.BAT: success for tools/intel_vbt_decode: switch to using kernel intel_vbt_defs.h Patchwork
2017-08-28 15:25 ` ✓ Fi.CI.IGT: " Patchwork
2017-08-28 22:19 ` [i-g-t PATCH 00/10] " Daniel Vetter
2017-08-29 14:31   ` Jani Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.