Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccbf6b64 authored by Jani Nikula's avatar Jani Nikula
Browse files

drm/i915/opregion: try to validate RVDA VBT only if it's there



Seems more sensible this way, and reduces indent for the more common
case.

Reviewed-by: default avatarBob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1490783578-6065-2-git-send-email-jani.nikula@intel.com
parent 0e53f472
Loading
Loading
Loading
Loading
+20 −21
Original line number Original line Diff line number Diff line
@@ -920,8 +920,8 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
	char buf[sizeof(OPREGION_SIGNATURE)];
	char buf[sizeof(OPREGION_SIGNATURE)];
	int err = 0;
	int err = 0;
	void *base;
	void *base;
	const void *vbt = NULL;
	const void *vbt;
	u32 vbt_size = 0;
	u32 vbt_size;


	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
@@ -984,21 +984,21 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
					  MEMREMAP_WB);
					  MEMREMAP_WB);
		vbt = opregion->rvda;
		vbt = opregion->rvda;
		vbt_size = opregion->asle->rvds;
		vbt_size = opregion->asle->rvds;
	}

		if (intel_bios_is_valid_vbt(vbt, vbt_size)) {
		if (intel_bios_is_valid_vbt(vbt, vbt_size)) {
			DRM_DEBUG_KMS("Found valid VBT in ACPI OpRegion (RVDA)\n");
			DRM_DEBUG_KMS("Found valid VBT in ACPI OpRegion (RVDA)\n");
			opregion->vbt = vbt;
			opregion->vbt = vbt;
			opregion->vbt_size = vbt_size;
			opregion->vbt_size = vbt_size;
	} else {
			goto out;
		}
	}

	vbt = base + OPREGION_VBT_OFFSET;
	vbt = base + OPREGION_VBT_OFFSET;
	/*
	/*
		 * The VBT specification says that if the ASLE ext mailbox is
	 * The VBT specification says that if the ASLE ext mailbox is not used
		 * not used its area is reserved, but on some CHT boards the VBT
	 * its area is reserved, but on some CHT boards the VBT extends into the
		 * extends into the ASLE ext area. Allow this even though it is
	 * ASLE ext area. Allow this even though it is against the spec, so we
		 * against the spec, so we do not end up rejecting the VBT on
	 * do not end up rejecting the VBT on those boards (and end up not
		 * those boards (and end up not finding the LCD panel because of
	 * finding the LCD panel because of this).
		 * this).
	 */
	 */
	vbt_size = (mboxes & MBOX_ASLE_EXT) ?
	vbt_size = (mboxes & MBOX_ASLE_EXT) ?
		OPREGION_ASLE_EXT_OFFSET : OPREGION_SIZE;
		OPREGION_ASLE_EXT_OFFSET : OPREGION_SIZE;
@@ -1008,7 +1008,6 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
		opregion->vbt = vbt;
		opregion->vbt = vbt;
		opregion->vbt_size = vbt_size;
		opregion->vbt_size = vbt_size;
	}
	}
	}


out:
out:
	return 0;
	return 0;