mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-10-31 18:17:13 +00:00 
			
		
		
		
	tools: remove quick_dump
Remove quick_dump as it has been replaced by the intel_reg tool and move the register definition files to tools/registers. Signed-off-by: Thomas Wood <thomas.wood@intel.com> Acked-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
		
							parent
							
								
									2142a15d49
								
							
						
					
					
						commit
						af97918494
					
				
							
								
								
									
										13
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README
									
									
									
									
									
								
							| @ -102,17 +102,6 @@ tools/ | ||||
| 	These tools generally must be run as root, safe for the ones that just | ||||
| 	decode dumps. | ||||
| 
 | ||||
| tools/quick_dump | ||||
| 	Quick dumper is a python tool built with SWIG bindings to | ||||
| 	important libraries exported by the rest of the tool suite. The tool | ||||
| 	itself is quite straight forward, and should also be a useful example | ||||
| 	for others wishing to write python based i915 tools. | ||||
| 
 | ||||
| 	Note to package maintainers: It is not recommended to package | ||||
| 	this directory, as the tool is not yet designed for wide usage. If the | ||||
| 	package is installed via "make install" the users will have to set | ||||
| 	their python library path appropriately. Use --disable-dumper | ||||
| 
 | ||||
| debugger/ | ||||
| 	This tool is to be used to do shader debugging. It acts like a | ||||
| 	debug server accepting connections from debug clients such as | ||||
| @ -148,9 +137,7 @@ everything (package names may vary): | ||||
| 	libcairo2-dev | ||||
| 	libdrm-dev | ||||
| 	libpciaccess-dev | ||||
| 	libpython3.3-dev | ||||
| 	libunwind-dev | ||||
| 	python-docutils | ||||
| 	swig2.0 | ||||
| 	x11proto-dri2-dev | ||||
| 	xutils-dev | ||||
|  | ||||
							
								
								
									
										27
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								configure.ac
									
									
									
									
									
								
							| @ -131,26 +131,6 @@ if test "x$NOUVEAU" = xyes; then | ||||
| fi | ||||
| AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes]) | ||||
| 
 | ||||
| #Configure options for the python quick-dumper | ||||
| AC_ARG_ENABLE(dumper, | ||||
| 	      AS_HELP_STRING([--disable-dumper], | ||||
| 			     [Disable the python based register dumper (default: enabled)]), | ||||
| 			     [DUMPER=$enableval], [DUMPER=auto]) | ||||
| if test "x$DUMPER" = xauto; then | ||||
| 	# AX_PYTHON_DEVEL/AX_SWIG_PYTHON are not super friendly and don't | ||||
| 	# easily allow us to introspect the result of their checks. So if we | ||||
| 	# find SWING on the system, that's enough to try compiling the dumper. | ||||
| 	AX_PKG_SWIG(2.0.0, [DUMPER=yes], [DUMPER=no]) | ||||
| fi | ||||
| if test "x$DUMPER" = xyes; then | ||||
| 	AC_DEFINE(HAVE_DUMPER, 1, [Have dumper support]) | ||||
| 	# SWIG configuration | ||||
| 	AX_PKG_SWIG(2.0.0, [], [ AC_MSG_ERROR([SWIG 2.0.0 or higher is required to build..]) ]) | ||||
| 	AX_PYTHON_DEVEL([>= '3.0']) | ||||
| 	AX_SWIG_PYTHON | ||||
| fi | ||||
| AM_CONDITIONAL(HAVE_DUMPER, [test "x$DUMPER" = xyes]) | ||||
| 
 | ||||
| # Define a configure option for the shader debugger | ||||
| AC_ARG_ENABLE(shader-debugger, AS_HELP_STRING([--enable-shader-debugger], | ||||
| 	      [Enable shader debugging support [autodetected]]), | ||||
| @ -237,9 +217,9 @@ AC_DEFINE_UNQUOTED(TARGET_CPU_PLATFORM, ["$host_cpu"], [Target platform]) | ||||
| 
 | ||||
| files="broadwell cherryview haswell ivybridge sandybridge valleyview skylake" | ||||
| for file in $files; do | ||||
| 	QUICK_DUMP_EXTRA_DIST="$QUICK_DUMP_EXTRA_DIST $file `tr '\n' ' ' < $srcdir/tools/quick_dump/$file`" | ||||
| 	REGISTERS_EXTRA_DIST="$REGISTERS_EXTRA_DIST $file `tr '\n' ' ' < $srcdir/tools/registers/$file`" | ||||
| done | ||||
| AC_SUBST(QUICK_DUMP_EXTRA_DIST) | ||||
| AC_SUBST(REGISTERS_EXTRA_DIST) | ||||
| 
 | ||||
| AC_CONFIG_FILES([ | ||||
| 		 Makefile | ||||
| @ -255,8 +235,8 @@ AC_CONFIG_FILES([ | ||||
| 		 scripts/Makefile | ||||
| 		 tests/Makefile | ||||
| 		 tools/Makefile | ||||
| 		 tools/quick_dump/Makefile | ||||
| 		 tools/null_state_gen/Makefile | ||||
| 		 tools/registers/Makefile | ||||
| 		 debugger/Makefile | ||||
| 		 debugger/system_routine/Makefile | ||||
| 		 assembler/Makefile | ||||
| @ -284,7 +264,6 @@ echo "" | ||||
| echo " • Tools:" | ||||
| echo "       Assembler          : ${enable_assembler}" | ||||
| echo "       Debugger           : ${enable_debugger}" | ||||
| echo "       Python dumper      : ${DUMPER}" | ||||
| echo "       Overlay            : X: ${enable_overlay_xlib}, Xv: ${enable_overlay_xvlib}" | ||||
| echo "" | ||||
| echo " • API-Documentation      : ${enable_gtk_doc}" | ||||
|  | ||||
| @ -197,8 +197,7 @@ variable, the directory is scanned for a spec file in this order: | ||||
| Register Spec File Format | ||||
| ------------------------- | ||||
| 
 | ||||
| The register spec format is compatible with the quick_dump.py format, briefly | ||||
| described below: | ||||
| The register spec format is briefly described below: | ||||
| 
 | ||||
| * Empty lines and lines beginning with "#", ";", or "//" are ignored. | ||||
| 
 | ||||
|  | ||||
| @ -1,10 +1,6 @@ | ||||
| include Makefile.sources | ||||
| 
 | ||||
| SUBDIRS = null_state_gen | ||||
| 
 | ||||
| if HAVE_DUMPER | ||||
| SUBDIRS += quick_dump | ||||
| endif | ||||
| SUBDIRS = null_state_gen registers | ||||
| 
 | ||||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib | ||||
| AM_CFLAGS = $(DEBUG_CFLAGS) $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS) $(CAIRO_CFLAGS) $(LIBUNWIND_CFLAGS) | ||||
|  | ||||
							
								
								
									
										2
									
								
								tools/quick_dump/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								tools/quick_dump/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,2 +0,0 @@ | ||||
| chipset_wrap_python.c | ||||
| chipset.py | ||||
| @ -1,34 +0,0 @@ | ||||
| AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib $(PYTHON_CPPFLAGS) $(DRM_CFLAGS) $(CAIRO_CFLAGS) -I$(top_srcdir) | ||||
| 
 | ||||
| dist_bin_SCRIPTS = quick_dump.py reg_access.py | ||||
| bin_SCRIPTS = chipset.py | ||||
| 
 | ||||
| lib_LTLIBRARIES = I915ChipsetPython.la | ||||
| I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) \
 | ||||
| 	-Wl,--no-undefined | ||||
| I915ChipsetPython_la_SOURCES = chipset_macro_wrap.c | ||||
| nodist_I915ChipsetPython_la_SOURCES = chipset_wrap_python.c | ||||
| I915ChipsetPython_la_LIBADD =			\
 | ||||
| 	$(top_builddir)/lib/libintel_tools.la	\
 | ||||
| 	$(PCIACCESS_LIBS)			\
 | ||||
| 	$(DRM_LIBS)				\
 | ||||
| 	$(CAIRO_LIBS)				\
 | ||||
| 	$(LIBUNWIND_LIBS)			\
 | ||||
| 	-lrt					\
 | ||||
| 	-lm					\
 | ||||
| 	$(NULL) | ||||
| 
 | ||||
| chipset.py: chipset_wrap_python.c | ||||
| 
 | ||||
| chipset_wrap_python.c: chipset.i | ||||
| 	$(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -I/usr/include -I$(top_srcdir)/lib -o $@ $< | ||||
| 
 | ||||
| all-local: I915ChipsetPython.la | ||||
| 	$(LN_S) -f .libs/I915ChipsetPython.so _chipset.so | ||||
| 
 | ||||
| CLEANFILES = chipset_wrap_python.c chipset.py _chipset.so | ||||
| EXTRA_DIST = $(QUICK_DUMP_EXTRA_DIST) \
 | ||||
| 	      base_interrupt.txt base_other.txt base_power.txt base_rings.txt \
 | ||||
| 	      quick_dump.py \
 | ||||
| 	      reg_access.py \
 | ||||
| 	      chipset.i | ||||
| @ -1,41 +0,0 @@ | ||||
| %module chipset | ||||
| %include "stdint.i" | ||||
| %{ | ||||
| #include <pciaccess.h> | ||||
| #include <stdint.h> | ||||
| #include "intel_chipset.h" | ||||
| #include "intel_io.h" | ||||
| extern int is_sandybridge(unsigned short pciid); | ||||
| extern int is_ivybridge(unsigned short pciid); | ||||
| extern int is_valleyview(unsigned short pciid); | ||||
| extern int is_cherryview(unsigned short pciid); | ||||
| extern int is_haswell(unsigned short pciid); | ||||
| extern int is_broadwell(unsigned short pciid); | ||||
| extern int is_skylake(unsigned short pciid); | ||||
| extern struct pci_device *intel_get_pci_device(); | ||||
| extern int intel_register_access_init(struct pci_device *pci_dev, int safe); | ||||
| extern uint32_t intel_register_read(uint32_t reg); | ||||
| extern void intel_register_write(uint32_t reg, uint32_t val); | ||||
| extern void intel_register_access_fini(); | ||||
| extern int intel_register_access_needs_fakewake(); | ||||
| extern unsigned short pcidev_to_devid(struct pci_device *pci_dev); | ||||
| extern uint32_t intel_dpio_reg_read(uint32_t reg, int phy); | ||||
| extern uint32_t intel_flisdsi_reg_read(uint32_t reg); | ||||
| %} | ||||
| 
 | ||||
| extern int is_sandybridge(unsigned short pciid); | ||||
| extern int is_ivybridge(unsigned short pciid); | ||||
| extern int is_valleyview(unsigned short pciid); | ||||
| extern int is_cherryview(unsigned short pciid); | ||||
| extern int is_haswell(unsigned short pciid); | ||||
| extern int is_broadwell(unsigned short pciid); | ||||
| extern int is_skylake(unsigned short pciid); | ||||
| extern struct pci_device *intel_get_pci_device(); | ||||
| extern int intel_register_access_init(struct pci_device *pci_dev, int safe); | ||||
| extern uint32_t intel_register_read(uint32_t reg); | ||||
| extern void intel_register_write(uint32_t reg, uint32_t val); | ||||
| extern void intel_register_access_fini(); | ||||
| extern int intel_register_access_needs_fakewake(); | ||||
| extern unsigned short pcidev_to_devid(struct pci_device *pci_dev); | ||||
| extern uint32_t intel_dpio_reg_read(uint32_t reg, int phy); | ||||
| extern uint32_t intel_flisdsi_reg_read(uint32_t reg); | ||||
| @ -1,68 +0,0 @@ | ||||
| /*
 | ||||
|  * Copyright © 2014 Intel Corporation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice (including the next | ||||
|  * paragraph) shall be included in all copies or substantial portions of the | ||||
|  * Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||
|  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
| 
 | ||||
| #include <stdbool.h> | ||||
| #include <stdlib.h> | ||||
| #include <pciaccess.h> | ||||
| #include "intel_chipset.h" | ||||
| 
 | ||||
| int is_sandybridge(unsigned short pciid) | ||||
| { | ||||
| 	return IS_GEN6(pciid); | ||||
| } | ||||
| 
 | ||||
| int is_ivybridge(unsigned short pciid) | ||||
| { | ||||
| 	return IS_IVYBRIDGE(pciid); | ||||
| } | ||||
| 
 | ||||
| int is_valleyview(unsigned short pciid) | ||||
| { | ||||
| 	return IS_VALLEYVIEW(pciid); | ||||
| } | ||||
| 
 | ||||
| int is_cherryview(unsigned short pciid) | ||||
| { | ||||
| 	return IS_CHERRYVIEW(pciid); | ||||
| } | ||||
| 
 | ||||
| int is_haswell(unsigned short pciid) | ||||
| { | ||||
| 	return IS_HASWELL(pciid); | ||||
| } | ||||
| 
 | ||||
| int is_broadwell(unsigned short pciid) | ||||
| { | ||||
| 	return IS_BROADWELL(pciid); | ||||
| } | ||||
| 
 | ||||
| int is_skylake(unsigned short pciid) | ||||
| { | ||||
| 	return IS_SKYLAKE(pciid); | ||||
| } | ||||
| 
 | ||||
| /* Simple helper because I couldn't make this work in the script */ | ||||
| unsigned short pcidev_to_devid(struct pci_device *pdev) | ||||
| { | ||||
| 	return pdev->device_id; | ||||
| } | ||||
| @ -1,117 +0,0 @@ | ||||
| #!/usr/bin/env python3 | ||||
| 
 | ||||
| # register definition format: | ||||
| # ('register name', 'register offset', 'register type') | ||||
| # | ||||
| # register types: | ||||
| #  '' - normal register | ||||
| #  'DPIO' - DPIO register | ||||
| # | ||||
| # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | ||||
| 
 | ||||
| import argparse | ||||
| import os | ||||
| import sys | ||||
| import ast | ||||
| import subprocess | ||||
| import chipset | ||||
| import reg_access as reg | ||||
| 
 | ||||
| # Ignore lines which are considered comments | ||||
| def ignore_line(line): | ||||
|     if not line.strip(): | ||||
|         return True | ||||
|     if len(line) > 1: | ||||
|         if line[1] == '/' and line[0] == '/': | ||||
|             return True | ||||
|     if len(line) > 0: | ||||
|         if line[0] == '#' or line[0] == ';': | ||||
|             return True | ||||
|     return False | ||||
| 
 | ||||
| def parse_file(file): | ||||
|     print('{0:^10s} | {1:^33s} | {2:^10s}'. format('offset', file.name, 'value')) | ||||
|     print('-' * 59) | ||||
|     for line in file: | ||||
|         if ignore_line(line): | ||||
|             continue | ||||
|         register = ast.literal_eval(line) | ||||
|         intreg = int(register[1], 16) | ||||
|         if register[2] == 'FLISDSI': | ||||
|             val = reg.flisdsi_read(intreg) | ||||
|         elif register[2] == 'DPIO': | ||||
|             val = reg.dpio_read(intreg, 0) | ||||
|         elif register[2] == 'DPIO2': | ||||
|             val = reg.dpio_read(intreg, 1) | ||||
|         else: | ||||
|             if register[2] != '': | ||||
|                 intreg = intreg + int(register[2], 16) | ||||
|             val = reg.read(intreg) | ||||
|         print('{0:#010x} | {1:<33} | {2:#010x}'.format(intreg, register[0], val)) | ||||
|     print('') | ||||
| 
 | ||||
| def walk_base_files(): | ||||
|     for root, dirs, files in os.walk('.'): | ||||
|         for name in files: | ||||
|             if name.startswith(("base_")): | ||||
|                 file = open(name.rstrip(), 'r') | ||||
|                 parse_file(file) | ||||
| 
 | ||||
| def autodetect_chipset(): | ||||
|     pci_dev = chipset.intel_get_pci_device() | ||||
|     devid = chipset.pcidev_to_devid(pci_dev) | ||||
|     if chipset.is_sandybridge(devid): | ||||
|         return open('sandybridge', 'r') | ||||
|     elif chipset.is_ivybridge(devid): | ||||
|         return open('ivybridge', 'r') | ||||
|     elif chipset.is_cherryview(devid): | ||||
|         return open('cherryview', 'r') | ||||
|     elif chipset.is_valleyview(devid): | ||||
|         return open('valleyview', 'r') | ||||
|     elif chipset.is_haswell(devid): | ||||
|         return open('haswell', 'r') | ||||
|     elif chipset.is_broadwell(devid): | ||||
|         return open('broadwell', 'r') | ||||
|     elif chipset.is_skylake(devid): | ||||
|         return open('skylake', 'r') | ||||
|     else: | ||||
|         print("Autodetect of devid " + hex(devid) + " failed") | ||||
|         return None | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     parser = argparse.ArgumentParser(description='Dumb register dumper.') | ||||
|     parser.add_argument('-b', '--baseless', | ||||
|             action='store_true', default=False, | ||||
|             help='baseless mode, ignore files starting with base_') | ||||
|     parser.add_argument('-f', '--file', | ||||
|             type=argparse.FileType('r'), default=None) | ||||
|     parser.add_argument('profile', nargs='?', | ||||
|             type=argparse.FileType('r'), default=None) | ||||
| 
 | ||||
|     args = parser.parse_args() | ||||
| 
 | ||||
|     if reg.init() == False: | ||||
|         print("Register initialization failed") | ||||
|         sys.exit() | ||||
| 
 | ||||
|     # Put us where the script is | ||||
|     os.chdir(os.path.dirname(sys.argv[0])) | ||||
| 
 | ||||
|     # specifying a file trumps all other things | ||||
|     if args.file != None: | ||||
|         parse_file(args.file) | ||||
|         sys.exit() | ||||
| 
 | ||||
|     #parse anything named base_ these are assumed to apply for all gens. | ||||
|     if args.baseless == False: | ||||
|         walk_base_files() | ||||
| 
 | ||||
|     if args.profile == None: | ||||
|         args.profile = autodetect_chipset() | ||||
| 
 | ||||
|     if args.profile == None: | ||||
|         sys.exit() | ||||
| 
 | ||||
|     for extra in args.profile: | ||||
|         extra_file = open(extra.rstrip(), 'r') | ||||
|         parse_file(extra_file) | ||||
| @ -1,62 +0,0 @@ | ||||
| #!/usr/bin/env python3 | ||||
| # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | ||||
| import chipset | ||||
| 
 | ||||
| def read(reg): | ||||
|     val = chipset.intel_register_read(reg) | ||||
|     return val | ||||
| 
 | ||||
| def write(reg, val): | ||||
|     chipset.intel_register_write(reg, val) | ||||
| 
 | ||||
| def gen6_forcewake_get(): | ||||
|     write(0xa18c, 0x1) | ||||
|     read(0xa180) | ||||
| 
 | ||||
| def mt_forcewake_get(): | ||||
|     write(0xa188, 0x10001) | ||||
|     read(0xa180) | ||||
| 
 | ||||
| def vlv_forcewake_get(): | ||||
|     write(0x1300b0, 0x10001) | ||||
|     read(0x1300b4) | ||||
| 
 | ||||
| # don't be clever, just try all possibilities | ||||
| def get_wake(): | ||||
|     gen6_forcewake_get() | ||||
|     mt_forcewake_get() | ||||
|     vlv_forcewake_get() | ||||
| 
 | ||||
| def dpio_read(reg, phy): | ||||
|     phy = int(phy) | ||||
| 
 | ||||
|     val = chipset.intel_dpio_reg_read(reg, phy) | ||||
|     return val | ||||
| 
 | ||||
| def flisdsi_read(reg): | ||||
|     val = chipset.intel_flisdsi_reg_read(reg) | ||||
|     return val | ||||
| 
 | ||||
| 
 | ||||
| def init(): | ||||
|     pci_dev = chipset.intel_get_pci_device() | ||||
|     ret = chipset.intel_register_access_init(pci_dev, 0) | ||||
|     if ret != 0: | ||||
|         print("Register access init failed"); | ||||
|         return False | ||||
| 
 | ||||
|     if chipset.intel_register_access_needs_fakewake(): | ||||
|         print("Forcing forcewake. Don't expect your system to work after this.") | ||||
|         get_wake() | ||||
| 
 | ||||
|     return True | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     import sys | ||||
| 
 | ||||
|     if init() == False: | ||||
|         sys.exit() | ||||
| 
 | ||||
|     reg = sys.argv[1] | ||||
|     print(hex(read(int(reg,16)))) | ||||
|     chipset.intel_register_access_fini() | ||||
							
								
								
									
										1
									
								
								tools/registers/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tools/registers/Makefile.am
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| EXTRA_DIST = ${REGISTERS_EXTRA_DIST} | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user