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:
Thomas Wood
2015-08-25 11:30:11 +01:00
parent 2142a15d49
commit af97918494
43 changed files with 6 additions and 368 deletions
+1 -5
View File
@@ -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
View File
@@ -1,2 +0,0 @@
chipset_wrap_python.c
chipset.py
-34
View File
@@ -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
-41
View File
@@ -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);
-68
View File
@@ -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;
}
-117
View File
@@ -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)
-62
View 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
View File
@@ -0,0 +1 @@
EXTRA_DIST = ${REGISTERS_EXTRA_DIST}