Re: [PATCH RESEND 2/4] drm/i915/opregion: try to validate RVDA VBT only if it's there

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 29 Mar 2017 13:32:56 +0300
Jani Nikula <jani.nikula@xxxxxxxxx> wrote:

> Seems more sensible this way, and reduces indent for the more common
> case.
> 
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>

Reviewed-by: Bob Paauwe <bob.j.paauwe@xxxxxxxxx>

> ---
>  drivers/gpu/drm/i915/intel_opregion.c | 41 +++++++++++++++++------------------
>  1 file changed, 20 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 76a39ee6d005..2b64cb6691eb 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -920,8 +920,8 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
>  	char buf[sizeof(OPREGION_SIGNATURE)];
>  	int err = 0;
>  	void *base;
> -	const void *vbt = NULL;
> -	u32 vbt_size = 0;
> +	const void *vbt;
> +	u32 vbt_size;
>  
>  	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
>  	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
> @@ -984,30 +984,29 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
>  					  MEMREMAP_WB);
>  		vbt = opregion->rvda;
>  		vbt_size = opregion->asle->rvds;
> +		if (intel_bios_is_valid_vbt(vbt, vbt_size)) {
> +			DRM_DEBUG_KMS("Found valid VBT in ACPI OpRegion (RVDA)\n");
> +			opregion->vbt = vbt;
> +			opregion->vbt_size = vbt_size;
> +			goto out;
> +		}
>  	}
>  
> +	vbt = base + OPREGION_VBT_OFFSET;
> +	/*
> +	 * The VBT specification says that if the ASLE ext mailbox is not used
> +	 * its area is reserved, but on some CHT boards the VBT extends into the
> +	 * ASLE ext area. Allow this even though it is against the spec, so we
> +	 * do not end up rejecting the VBT on those boards (and end up not
> +	 * finding the LCD panel because of this).
> +	 */
> +	vbt_size = (mboxes & MBOX_ASLE_EXT) ?
> +		OPREGION_ASLE_EXT_OFFSET : OPREGION_SIZE;
> +	vbt_size -= OPREGION_VBT_OFFSET;
>  	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 (Mailbox #4)\n");
>  		opregion->vbt = vbt;
>  		opregion->vbt_size = vbt_size;
> -	} else {
> -		vbt = base + OPREGION_VBT_OFFSET;
> -		/*
> -		 * The VBT specification says that if the ASLE ext mailbox is
> -		 * not used its area is reserved, but on some CHT boards the VBT
> -		 * extends into the ASLE ext area. Allow this even though it is
> -		 * against the spec, so we do not end up rejecting the VBT on
> -		 * those boards (and end up not finding the LCD panel because of
> -		 * this).
> -		 */
> -		vbt_size = (mboxes & MBOX_ASLE_EXT) ?
> -			OPREGION_ASLE_EXT_OFFSET : OPREGION_SIZE;
> -		vbt_size -= OPREGION_VBT_OFFSET;
> -		if (intel_bios_is_valid_vbt(vbt, vbt_size)) {
> -			DRM_DEBUG_KMS("Found valid VBT in ACPI OpRegion (Mailbox #4)\n");
> -			opregion->vbt = vbt;
> -			opregion->vbt_size = vbt_size;
> -		}
>  	}
>  
>  out:



-- 
--
Bob Paauwe                  
Bob.J.Paauwe@xxxxxxxxx
IOTG / PED Software Organization
Intel Corp.  Folsom, CA
(916) 356-6193    

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux