[Intel-gfx] [PATCH] tools/intel_reg_write:Adding lib calls for CHT/VLV

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Feb 19 01:35:37 PST 2015


On Thu, Feb 19, 2015 at 12:28:57PM +0530, meghanelogal wrote:
> From: meghanelogal <megha.i.nelogal at intel.com>
> 
> Calling the library functions for reg read and write
> 
> Signed-off-by: meghanelogal <megha.i.nelogal at intel.com>

Nak. The 0x180000 offset is only needed for display registers, so this
change would break everything else. If you really want to avoid having
to add the offset in your brain, you could add a new command line
option for it.

> ---
>  tools/intel_reg_write.c |   28 +++++++++++++++++++++-------
>  1 file changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/intel_reg_write.c b/tools/intel_reg_write.c
> index ff4e561..8ac29e4 100644
> --- a/tools/intel_reg_write.c
> +++ b/tools/intel_reg_write.c
> @@ -34,9 +34,7 @@
>  
>  int main(int argc, char** argv)
>  {
> -	uint32_t reg, value;
> -	volatile uint32_t *ptr;
> -
> +	uint32_t reg = 0, value, initial_value, final_value;
>  	if (argc < 3) {
>  		printf("Usage: %s addr value\n", argv[0]);
>  		printf("  WARNING: This is dangerous to you and your system's health.\n");
> @@ -45,13 +43,29 @@ int main(int argc, char** argv)
>  	}
>  
>  	intel_register_access_init(intel_get_pci_device(), 0);
> +
>  	sscanf(argv[1], "0x%x", &reg);
>  	sscanf(argv[2], "0x%x", &value);
> -	ptr = (volatile uint32_t *)((volatile char *)mmio + reg);
>  
> -	printf("Value before: 0x%X\n", *ptr);
> -	*ptr = value;
> -	printf("Value after: 0x%X\n", *ptr);
> +	struct pci_device *dev = intel_get_pci_device();
> +	if (IS_VALLEYVIEW(dev->device_id) || IS_CHERRYVIEW(dev->device_id))
> +		initial_value = intel_register_read(reg+0x180000);
> +	else
> +		initial_value = intel_register_read(reg);
> +
> +	printf("Value before: 0x%X\n", initial_value);
> +
> +	if (IS_VALLEYVIEW(dev->device_id) || IS_CHERRYVIEW(dev->device_id))
> +		intel_register_write(reg+0x180000, value);
> +	else
> +		intel_register_write(reg, value);
> +
> +	if (IS_VALLEYVIEW(dev->device_id) || IS_CHERRYVIEW(dev->device_id))
> +		final_value = intel_register_read(reg+0x180000);
> +	else
> +		final_value = intel_register_read(reg);
> +
> +	printf("Value after: 0x%X\n", final_value);
>  
>  	intel_register_access_fini();
>  	return 0;
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC


More information about the Intel-gfx mailing list