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. v3: -Splitted the patch into small ones -Handeled memory unmap in intel_opregion_fini -removed the new file created for opregion macro`s Cc: Jani Nikula <jani.nikula@xxxxxxxxx> Signed-off-by: Deepak M <m.deepak@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_opregion.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index 7908a1d..b3a5709 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c @@ -856,6 +856,8 @@ void intel_opregion_fini(struct drm_device *dev) } /* just clear all opregion memory pointers now */ + if (opregion->header->opregion_ver >= 2 && opregion->asle->rvda) + memunmap(opregion->vbt); memunmap(opregion->header); opregion->header = NULL; opregion->acpi = NULL; @@ -933,7 +935,8 @@ int intel_opregion_setup(struct drm_device *dev) char buf[sizeof(OPREGION_SIGNATURE)]; const struct vbt_header *vbt = NULL; int err = 0; - void *base; + void *base, *vbt_base; + size_t size; BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100); BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100); @@ -963,19 +966,37 @@ int intel_opregion_setup(struct drm_device *dev) goto err_out; } - vbt = validate_vbt(base + OPREGION_VBT_OFFSET, - MAILBOX_4_SIZE, "OpRegion"); + /* + * Non-zero value in rvda field is an indication to driver that a + * valid Raw VBT is stored in that address and driver should not refer + * to mailbox4 for getting VBT. + */ + if (opregion->header->opregion_ver >= 2 && opregion->asle->rvda) { + size = opregion->asle->rvds; + vbt_base = memremap(opregion->asle->rvda, + size, MEMREMAP_WB); + } else { + size = MAILBOX_4_SIZE; + vbt_base = base + OPREGION_VBT_OFFSET; + } + + vbt = validate_vbt(vbt_base, size, "OpRegion"); if (vbt == NULL) { err = -EINVAL; goto err_out; } - vbt = (const struct vbt_header *)(base + OPREGION_VBT_OFFSET); - dev_priv->opregion.vbt_size = vbt->vbt_size; + /* Assigning the vbt_size based on the VBT location */ + if (opregion->header->opregion_ver >= 2 && opregion->asle->rvda) + dev_priv->opregion.vbt_size = opregion->asle->rvds; + else { + vbt = (const struct vbt_header *)(base + OPREGION_VBT_OFFSET); + dev_priv->opregion.vbt_size = vbt->vbt_size; + } opregion->header = base; - opregion->vbt = base + OPREGION_VBT_OFFSET; + opregion->vbt = vbt_base; opregion->lid_state = base + ACPI_CLID; opregion->asle_ext = base + OPREGION_ASLE_EXT_OFFSET; -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx