[Intel-gfx] [MIPI SEQ PARSING v3 05/13] drm/i915: Add debug entry to get the opregion VBT blob

Mika Kahola mika.kahola at intel.com
Fri Dec 11 00:46:25 PST 2015


On Tue, 2015-12-01 at 04:17 +0530, Deepak M wrote:
> Currently there is a entry to get the complete opregion
> dump, this patch adds entry to get the VBT alone from
> the opregion.
> 
> Adding this entry helps developer to get the VBT easily,
> instead of following the old way where we get the complete
> opregion dump and pick the VBT from the dump wrt to
> the VBT offset.
> 
> Cc: Jani Nikula <jani.nikula at intel.com>
Tested-by: Mika Kahola <mika.kahola at intel.com>
> Signed-off-by: Deepak M <m.deepak at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c   | 29 +++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/i915_drv.h       |  1 +
>  drivers/gpu/drm/i915/intel_bios.c     |  1 +
>  drivers/gpu/drm/i915/intel_opregion.c |  3 +++
>  4 files changed, 34 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index d6d69f4..9b7fb00 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1865,6 +1865,34 @@ out:
>  	return 0;
>  }
>  
> +static int i915_opregion_vbt(struct seq_file *m, void *unused)
> +{
> +	struct drm_info_node *node = m->private;
> +	struct drm_device *dev = node->minor->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_opregion *opregion = &dev_priv->opregion;
> +	void *data = kmalloc(opregion->vbt_size, GFP_KERNEL);
> +	int ret;
> +
> +	if (data == NULL)
> +		return -ENOMEM;
> +
> +	ret = mutex_lock_interruptible(&dev->struct_mutex);
> +	if (ret)
> +		goto out;
> +
> +	if (opregion->vbt) {
> +		memcpy(data, opregion->vbt, opregion->vbt_size);
> +		seq_write(m, data, opregion->vbt_size);
> +	}
> +
> +	mutex_unlock(&dev->struct_mutex);
> +
> +out:
> +	kfree(data);
> +	return 0;
> +}
> +
>  static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
>  {
>  	struct drm_info_node *node = m->private;
> @@ -5383,6 +5411,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
>  	{"i915_ips_status", i915_ips_status, 0},
>  	{"i915_sr_status", i915_sr_status, 0},
>  	{"i915_opregion", i915_opregion, 0},
> +	{"i915_opregion_vbt", i915_opregion_vbt, 0},
>  	{"i915_gem_framebuffer", i915_gem_framebuffer_info, 0},
>  	{"i915_context_status", i915_context_status, 0},
>  	{"i915_dump_lrc", i915_dump_lrc, 0},
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 8cf8375..59a39d1 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -457,6 +457,7 @@ struct intel_opregion {
>  	u32 swsci_sbcb_sub_functions;
>  	struct opregion_asle *asle;
>  	void *vbt;
> +	u32 vbt_size;
>  	struct opregion_asle_ext *asle_ext;
>  	u32 *lid_state;
>  	struct work_struct asle_work;
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 57a77aa..98b0e2a 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1338,6 +1338,7 @@ intel_parse_bios(struct drm_device *dev)
>  			return -1;
>  		}
>  
> +		dev_priv->opregion.vbt_size = vbt->vbt_size;
>  		bdb = (const void *)vbt + vbt->bdb_offset;
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 4a78282..7908a1d 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -971,6 +971,9 @@ int intel_opregion_setup(struct drm_device *dev)
>  		goto err_out;
>  	}
>  
> +	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;
>  




More information about the Intel-gfx mailing list