* [PATCH] tools/intel_reg_write:Adding lib calls for CHT/VLV
@ 2015-02-19 6:58 meghanelogal
2015-02-19 9:35 ` Ville Syrjälä
0 siblings, 1 reply; 2+ messages in thread
From: meghanelogal @ 2015-02-19 6:58 UTC (permalink / raw)
To: intel-gfx; +Cc: meghanelogal
From: meghanelogal <megha.i.nelogal@intel.com>
Calling the library functions for reg read and write
Signed-off-by: meghanelogal <megha.i.nelogal@intel.com>
---
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", ®);
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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tools/intel_reg_write:Adding lib calls for CHT/VLV
2015-02-19 6:58 [PATCH] tools/intel_reg_write:Adding lib calls for CHT/VLV meghanelogal
@ 2015-02-19 9:35 ` Ville Syrjälä
0 siblings, 0 replies; 2+ messages in thread
From: Ville Syrjälä @ 2015-02-19 9:35 UTC (permalink / raw)
To: meghanelogal; +Cc: intel-gfx
On Thu, Feb 19, 2015 at 12:28:57PM +0530, meghanelogal wrote:
> From: meghanelogal <megha.i.nelogal@intel.com>
>
> Calling the library functions for reg read and write
>
> Signed-off-by: meghanelogal <megha.i.nelogal@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", ®);
> 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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-19 9:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-19 6:58 [PATCH] tools/intel_reg_write:Adding lib calls for CHT/VLV meghanelogal
2015-02-19 9:35 ` Ville Syrjälä
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.