public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Deepak M <m.deepak@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Deepak M <m.deepak@intel.com>
Subject: [MIPI SEQ PARSING v1 PATCH 2/9] drm/i915: Parsing VBT if size of VBT exceeds 6KB
Date: Tue, 28 Jul 2015 15:31:03 +0530	[thread overview]
Message-ID: <1438077670-12953-3-git-send-email-m.deepak@intel.com> (raw)
In-Reply-To: <1438077670-12953-1-git-send-email-m.deepak@intel.com>

Currently the iomap for VBT works only if the size of the
VBT is less than 6KB, but if the size of the VBT exceeds
6KB than the physical address and the size of the VBT to
be iomapped is specified in the mailbox3 and is iomapped
accordingly.

Signed-off-by: Deepak M <m.deepak@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c     |   13 +++++++----
 drivers/gpu/drm/i915/intel_opregion.c |   39 ++++++++++++++++++++++++++++++---
 2 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 2583587..1b9164e 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1219,6 +1219,7 @@ intel_parse_bios(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct pci_dev *pdev = dev->pdev;
 	const struct bdb_header *bdb = NULL;
+	const struct vbt_header *vbt = NULL;
 	u8 __iomem *bios = NULL;
 
 	if (HAS_PCH_NOP(dev))
@@ -1226,10 +1227,14 @@ intel_parse_bios(struct drm_device *dev)
 
 	init_vbt_defaults(dev_priv);
 
-	/* XXX Should this validation be moved to intel_opregion.c? */
-	if (!dmi_check_system(intel_no_opregion_vbt) && dev_priv->opregion.vbt)
-		bdb = validate_vbt(dev_priv->opregion.header, OPREGION_SIZE,
-				   dev_priv->opregion.vbt, "OpRegion");
+	if (!dmi_check_system(intel_no_opregion_vbt) &&
+			dev_priv->opregion.vbt) {
+		vbt = (struct vbt_header *)dev_priv->opregion.vbt;
+		bdb = (struct bdb_header *)(dev_priv->opregion.vbt +
+				vbt->bdb_offset);
+		DRM_DEBUG_KMS("Using VBT from Opregion: %20s\n",
+				vbt->signature);
+	}
 
 	if (bdb == NULL) {
 		size_t size;
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index 71e87ab..1372e39 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -50,6 +50,7 @@
 #define OPREGION_VBT_OFFSET    0x400
 
 #define OPREGION_SIGNATURE "IntelGraphicsMem"
+#define VBT_SIGNATURE	"$VBT"
 #define MBOX_ACPI      (1<<0)
 #define MBOX_SWSCI     (1<<1)
 #define MBOX_ASLE      (1<<2)
@@ -113,7 +114,12 @@ struct opregion_asle {
 	u32 pcft;       /* power conservation features */
 	u32 srot;       /* supported rotation angles */
 	u32 iuer;       /* IUER events */
-	u8 rsvd[86];
+	u64 fdss;	/* DSS Buffer address allocated for IFFS feature */
+	u32 fdsp;	/* Size of DSS Buffer */
+	u32 stat;	/* State Indicator */
+	u64 rvda;	/* Physical address of raw vbt data */
+	u32 rvds;	/* Size of raw vbt data */
+	u8 rsvd[58];
 } __packed;
 
 /* Driver readiness indicator */
@@ -858,8 +864,10 @@ int intel_opregion_setup(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_opregion *opregion = &dev_priv->opregion;
 	void __iomem *base;
+	void __iomem *vbt_base;
 	u32 asls, mboxes;
 	char buf[sizeof(OPREGION_SIGNATURE)];
+	char vbt_sig_buf[sizeof(VBT_SIGNATURE)];
 	int err = 0;
 
 	pci_read_config_dword(dev->pdev, PCI_ASLS, &asls);
@@ -873,7 +881,7 @@ int intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, asle_work);
 #endif
 
-	base = acpi_os_ioremap(asls, OPREGION_SIZE);
+	base = acpi_os_ioremap(asls, OPREGION_VBT_OFFSET);
 	if (!base)
 		return -ENOMEM;
 
@@ -884,8 +892,31 @@ int intel_opregion_setup(struct drm_device *dev)
 		err = -EINVAL;
 		goto err_out;
 	}
+
 	opregion->header = base;
-	opregion->vbt = base + OPREGION_VBT_OFFSET;
+	opregion->asle = base + OPREGION_ASLE_OFFSET;
+
+	if (opregion->header->opregion_ver >= 2) {
+		if (opregion->asle->rvda)
+			vbt_base = acpi_os_ioremap(opregion->asle->rvda,
+						opregion->asle->rvds);
+		else
+			vbt_base = acpi_os_ioremap(asls + OPREGION_VBT_OFFSET,
+					OPREGION_SIZE - OPREGION_VBT_OFFSET);
+	} else
+		vbt_base = acpi_os_ioremap(asls + OPREGION_VBT_OFFSET,
+					OPREGION_SIZE - OPREGION_VBT_OFFSET);
+
+
+	memcpy_fromio(vbt_sig_buf, vbt_base, sizeof(vbt_sig_buf));
+
+	if (memcmp(vbt_sig_buf, VBT_SIGNATURE, 4)) {
+		DRM_ERROR("VBT signature mismatch\n");
+		err = -EINVAL;
+		goto err_vbt;
+	}
+
+	opregion->vbt = vbt_base;
 
 	opregion->lid_state = base + ACPI_CLID;
 
@@ -909,6 +940,8 @@ int intel_opregion_setup(struct drm_device *dev)
 
 	return 0;
 
+err_vbt:
+	iounmap(vbt_base);
 err_out:
 	iounmap(base);
 	return err;
-- 
1.7.9.5

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

  parent reply	other threads:[~2015-07-28  9:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 10:01 [MIPI SEQ V3 PARSING PATCH 0/9] Patches to support the version 3 of MIPI sequence in VBT Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 1/9] drm/i915: Adding the parsing logic for the i2c element Deepak M
2015-07-28 15:22   ` Jani Nikula
2015-07-28 10:01 ` Deepak M [this message]
2015-07-28 15:12   ` [MIPI SEQ PARSING v1 PATCH 2/9] drm/i915: Parsing VBT if size of VBT exceeds 6KB Jani Nikula
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 3/9] drm/i915: Using the approprite vbt size if vbt is not in mailbox4 of opregion Deepak M
2015-07-28 15:18   ` Jani Nikula
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 4/9] drm/i915: Added support the v3 mipi sequence block Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 5/9] drm/i915: Added the generic gpio sequence support and gpio table Deepak M
2015-07-28 15:48   ` Jani Nikula
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 6/9] drm/i915: GPIO for CHT generic MIPI Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 7/9] drm: Add few more wrapper functions for drm panel Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 8/9] drm/i915: Add functions to execute the new sequences from VBT Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 9/9] BXT GPIO support for backlight and panel control Deepak M

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438077670-12953-3-git-send-email-m.deepak@intel.com \
    --to=m.deepak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox