Re: [PATCH 1/3] drm/i915/opregion: fix version check

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

 



On Fri, Feb 08, 2019 at 02:43:30PM +0200, Jani Nikula wrote:
> The u32 version field encodes major version in the high word. We've been
> checking for version >= 0.2.
> 
> Add opregion version logging while at it.
> 
> Fixes: 04ebaadb9f2d ("drm/i915/opregion: handle VBT sizes bigger than 6 KB")
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Cc: Imre Deak <imre.deak@xxxxxxxxx>
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_opregion.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 30ae96c5c97c..7e4152d97c45 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -46,6 +46,9 @@
>  #define OPREGION_ASLE_EXT_OFFSET	0x1C00
>  
>  #define OPREGION_SIGNATURE "IntelGraphicsMem"
> +
> +#define OPREGION_VERSION(major, minor) (((major) << 16) | (minor))
> +
>  #define MBOX_ACPI      (1<<0)
>  #define MBOX_SWSCI     (1<<1)
>  #define MBOX_ASLE      (1<<2)
> @@ -924,6 +927,10 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
>  	opregion->header = base;
>  	opregion->lid_state = base + ACPI_CLID;
>  
> +	DRM_DEBUG_DRIVER("ACPI OpRegion version %u.%u\n",
> +			 opregion->header->opregion_ver >> 16,
> +			 opregion->header->opregion_ver & 0xffff);

BTW the spec says this is 4bit bcd. So this printk isn't quite correct.

> +
>  	mboxes = opregion->header->mboxes;
>  	if (mboxes & MBOX_ACPI) {
>  		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
> @@ -952,8 +959,8 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
>  	if (dmi_check_system(intel_no_opregion_vbt))
>  		goto out;
>  
> -	if (opregion->header->opregion_ver >= 2 && opregion->asle &&
> -	    opregion->asle->rvda && opregion->asle->rvds) {
> +	if (opregion->header->opregion_ver >= OPREGION_VERSION(2, 0) &&
> +	    opregion->asle && opregion->asle->rvda && opregion->asle->rvds) {
>  		opregion->rvda = memremap(opregion->asle->rvda,
>  					  opregion->asle->rvds,
>  					  MEMREMAP_WB);
> -- 
> 2.20.1

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




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux