public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/i915/opregion: fix version check
Date: Fri, 08 Feb 2019 19:54:46 +0200	[thread overview]
Message-ID: <87k1ia5fo9.fsf@intel.com> (raw)
In-Reply-To: <20190208162316.GW20097@intel.com>

On Fri, 08 Feb 2019, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> 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@linux.intel.com>
>> Cc: Imre Deak <imre.deak@intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  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.

Uh, another version of the spec even gives an example:

[31:16] [15:0] version
   A       F   10.15

Doesn't look like BCD to me. It would have to be 0x10 and 0x15 in the
example then. :(

You can't make this stuff up.

BR,
Jani.


>
>> +
>>  	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

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2019-02-08 17:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 12:43 [PATCH 1/3] drm/i915/opregion: fix version check Jani Nikula
2019-02-08 12:43 ` [PATCH 2/3] drm/i915/opregion: rvda is relative from opregion base in opregion 2.1+ Jani Nikula
2019-02-08 12:43 ` [PATCH 3/3] HACK: drm/i915/opregion: ICL should have opregion 2.1+ and relative rvda Jani Nikula
2019-02-08 14:08 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915/opregion: fix version check Patchwork
2019-02-08 14:29 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-02-08 15:09 ` [PATCH 1/3] " Jani Nikula
2019-02-08 15:11   ` Imre Deak
2019-02-08 15:57   ` Ville Syrjälä
2019-02-08 16:12     ` Ville Syrjälä
2019-02-08 18:02       ` Jani Nikula
2019-02-08 18:18         ` Jani Nikula
2019-02-08 16:23 ` Ville Syrjälä
2019-02-08 17:54   ` Jani Nikula [this message]

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=87k1ia5fo9.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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