Re: [PATCH] drm/i915: Clean up PCI config register handling

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

 



On Fri, Apr 15, 2016 at 12:17:18PM +0300, Joonas Lahtinen wrote:
> Do not use magic numbers, do not prefix stuff with "PCI_", do not
> declare registers in implementation files. Also move the PCI
> registers under correct comment in i915_reg.h.
> 
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_dma.c        | 15 ++++----------
>  drivers/gpu/drm/i915/i915_gem_stolen.c |  9 ++++----
>  drivers/gpu/drm/i915/i915_reg.h        | 38 +++++++++++++++++++++++++---------
>  drivers/gpu/drm/i915/intel_opregion.c  | 24 ++++++++-------------
>  drivers/gpu/drm/i915/intel_panel.c     |  4 ++--
>  5 files changed, 48 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index b377753..de95c9c 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -257,13 +257,6 @@ static int i915_get_bridge_dev(struct drm_device *dev)
>  	return 0;
>  }
>  
> -#define MCHBAR_I915 0x44
> -#define MCHBAR_I965 0x48
> -#define MCHBAR_SIZE (4*4096)
> -
> -#define DEVEN_REG 0x54
> -#define   DEVEN_MCHBAR_EN (1 << 28)
> -
>  /* Allocate space for the MCH regs if needed, return nonzero on error */
>  static int
>  intel_alloc_mchbar_resource(struct drm_device *dev)
> @@ -325,7 +318,7 @@ intel_setup_mchbar(struct drm_device *dev)
>  	dev_priv->mchbar_need_disable = false;
>  
>  	if (IS_I915G(dev) || IS_I915GM(dev)) {
> -		pci_read_config_dword(dev_priv->bridge_dev, DEVEN_REG, &temp);
> +		pci_read_config_dword(dev_priv->bridge_dev, DEVEN, &temp);
>  		enabled = !!(temp & DEVEN_MCHBAR_EN);
>  	} else {
>  		pci_read_config_dword(dev_priv->bridge_dev, mchbar_reg, &temp);
> @@ -343,7 +336,7 @@ intel_setup_mchbar(struct drm_device *dev)
>  
>  	/* Space is allocated or reserved, so enable it. */
>  	if (IS_I915G(dev) || IS_I915GM(dev)) {
> -		pci_write_config_dword(dev_priv->bridge_dev, DEVEN_REG,
> +		pci_write_config_dword(dev_priv->bridge_dev, DEVEN,
>  				       temp | DEVEN_MCHBAR_EN);
>  	} else {
>  		pci_read_config_dword(dev_priv->bridge_dev, mchbar_reg, &temp);
> @@ -360,9 +353,9 @@ intel_teardown_mchbar(struct drm_device *dev)
>  
>  	if (dev_priv->mchbar_need_disable) {
>  		if (IS_I915G(dev) || IS_I915GM(dev)) {
> -			pci_read_config_dword(dev_priv->bridge_dev, DEVEN_REG, &temp);
> +			pci_read_config_dword(dev_priv->bridge_dev, DEVEN, &temp);
>  			temp &= ~DEVEN_MCHBAR_EN;
> -			pci_write_config_dword(dev_priv->bridge_dev, DEVEN_REG, temp);
> +			pci_write_config_dword(dev_priv->bridge_dev, DEVEN, temp);
>  		} else {
>  			pci_read_config_dword(dev_priv->bridge_dev, mchbar_reg, &temp);
>  			temp &= ~1;
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index ea06da0..872ee45 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -95,7 +95,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
>  	u32 base;
>  
>  	/* Almost universally we can find the Graphics Base of Stolen Memory
> -	 * at offset 0x5c in the igfx configuration space. On a few (desktop)
> +	 * at register BDSM in the igfx configuration space. On a few (desktop)

Offset is easier to find in cspec, so please include both.

BDSM? That doesn't match your usage and cpsec refers to GBSM, iirc. I
know the code is bad, but it is not naughty!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
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