igt: remove deprecated reg access tools in favor of intel_reg

intel_iosf_sb_read, intel_iosf_sb_write, intel_reg_dumper,
intel_reg_read, intel_reg_snapshot, intel_reg_write, intel_vga_read, and
intel_vga_write have been deprecated in favor of intel_reg. Remove the
deprecated tools. intel_reg does everything they do, and more.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Jani Nikula 2015-06-18 15:17:47 +03:00
parent 9b73ce43fe
commit 0e25e5d92d
15 changed files with 0 additions and 3866 deletions

View File

@ -11,9 +11,6 @@ appman_PRE = \
intel_infoframes.man \ intel_infoframes.man \
intel_lid.man \ intel_lid.man \
intel_panel_fitter.man \ intel_panel_fitter.man \
intel_reg_dumper.man \
intel_reg_read.man \
intel_reg_write.man \
intel_stepping.man \ intel_stepping.man \
intel_upload_blit_large.man \ intel_upload_blit_large.man \
intel_upload_blit_large_gtt.man \ intel_upload_blit_large_gtt.man \

View File

@ -1,33 +0,0 @@
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH intel_reg_dumper __appmansuffix__ __xorgversion__
.SH NAME
intel_reg_dumper \- Decode a bunch of Intel GPU registers for debugging
.SH SYNOPSIS
.B intel_reg_dumper [ options ] [ file ]
.SH DESCRIPTION
.B intel_reg_dumper
is a tool to read and decode the values of many Intel GPU registers. It is
commonly used in debugging video mode setting issues. If the
.B file
argument is present, the registers will be decoded from the given file
instead of the current registers. Use the
.B intel_reg_snapshot
tool to generate such files.
When the
.B file
argument is present and the
.B -d
argument is not present,
.B intel_reg_dumper
will assume the file was generated on an Ironlake machine.
.SH OPTIONS
.TP
.B -d id
when a dump file is used, use 'id' as device id (in hex)
.TP
.B -h
prints a help message
.SH SEE ALSO
.BR intel_reg_snapshot(1)

View File

@ -1,15 +0,0 @@
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH intel_reg_read __appmansuffix__ __xorgversion__
.SH NAME
intel_reg_read \- Reads an Intel GPU register value
.SH SYNOPSIS
.B intel_reg_read \fIregister\fR
.SH DESCRIPTION
.B intel_reg_read
is a tool to read Intel GPU registers, for use in debugging. The
\fIregister\fR argument is given as hexadecimal.
.SH EXAMPLES
.TP
intel_reg_read 0x61230
Shows the register value for the first internal panel fitter.

View File

@ -1,15 +0,0 @@
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH intel_reg_snapshot __appmansuffix__ __xorgversion__
.SH NAME
intel_reg_snapshot \- Take a GPU register snapshot
.SH SYNOPSIS
.B intel_reg_snapshot
.SH DESCRIPTION
.B intel_reg_snapshot
takes a snapshot of the registers of an Intel GPU, and writes it to standard
output. These files can be inspected later with the
.B intel_reg_dumper
tool.
.SH SEE ALSO
.BR intel_reg_dumper(1)

View File

@ -1,16 +0,0 @@
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH intel_reg_write __appmansuffix__ __xorgversion__
.SH NAME
intel_reg_write \- Set an Intel GPU register to a value
.SH SYNOPSIS
.B intel_reg_write \fIregister\fR \fIvalue\fR
.SH DESCRIPTION
.B intel_reg_write
is a tool to set Intel GPU registers to values, for use in speeding up
debugging. The \fIregister\fR and \fIvalue\fR arguments are given as
hexadecimal.
.SH EXAMPLES
.TP
intel_reg_write 0x61230 0x0
Disables the first internal panel fitter.

8
tools/.gitignore vendored
View File

@ -18,8 +18,6 @@ intel_gpu_time
intel_gpu_top intel_gpu_top
intel_gtt intel_gtt
intel_infoframes intel_infoframes
intel_iosf_sb_read
intel_iosf_sb_write
intel_l3_parity intel_l3_parity
intel_lid intel_lid
intel_opregion_decode intel_opregion_decode
@ -27,13 +25,7 @@ intel_panel_fitter
intel_perf_counters intel_perf_counters
intel_reg intel_reg
intel_reg_checker intel_reg_checker
intel_reg_dumper
intel_reg_read
intel_reg_snapshot
intel_reg_write
intel_stepping intel_stepping
intel_vga_read
intel_vga_write
intel_watermark intel_watermark
skl_compute_wrpll skl_compute_wrpll
skl_ddb_allocation skl_ddb_allocation

View File

@ -23,21 +23,13 @@ bin_PROGRAMS = \
intel_gpu_top \ intel_gpu_top \
intel_gtt \ intel_gtt \
intel_infoframes \ intel_infoframes \
intel_iosf_sb_read \
intel_iosf_sb_write \
intel_l3_parity \ intel_l3_parity \
intel_lid \ intel_lid \
intel_opregion_decode \ intel_opregion_decode \
intel_panel_fitter \ intel_panel_fitter \
intel_perf_counters \ intel_perf_counters \
intel_reg_checker \ intel_reg_checker \
intel_reg_dumper \
intel_reg_read \
intel_reg_snapshot \
intel_reg_write \
intel_stepping \ intel_stepping \
intel_vga_read \
intel_vga_write \
intel_watermark intel_watermark
dist_bin_SCRIPTS = intel_gpu_abrt dist_bin_SCRIPTS = intel_gpu_abrt

View File

@ -1,153 +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 <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include <string.h>
#include "intel_io.h"
#include "intel_chipset.h"
#include "drmtest.h"
/* keep sorted by name for bsearch() */
static const struct iosf_sb_port {
const char *name;
uint8_t port;
uint8_t reg_stride;
} iosf_sb_ports[] = {
{ "bunit", 0x03, 1, },
{ "cck", 0x14, 1, },
{ "ccu", 0xa9, 4, },
{ "dpio", 0x12, 4, },
{ "dpio2", 0x1a, 4, },
{ "flisdsi", 0x1b, 1, },
{ "gpio_nc", 0x13, 4, },
{ "nc", 0x11, 4, },
{ "punit", 0x04, 1, },
};
static int iosf_sb_port_compare(const void *a, const void *b)
{
const char *name = a;
const struct iosf_sb_port *p = b;
return strcasecmp(name, p->name);
}
static int iosf_sb_port_parse(const char *name, int *reg_stride)
{
const struct iosf_sb_port *p;
p = bsearch(name, iosf_sb_ports, ARRAY_SIZE(iosf_sb_ports),
sizeof(iosf_sb_ports[0]),
iosf_sb_port_compare);
if (p) {
*reg_stride = p->reg_stride;
return p->port;
}
*reg_stride = 4;
return strtoul(name, NULL, 16);
}
static void usage(const char *name)
{
int i;
printf("Warning : This program will work only on Valleyview/Cherryview\n"
"Usage: %s [-h] [-c <count>] [--] <port> <reg> [<reg> ...]\n"
"\t -h : Show this help text\n"
"\t -c <count> : how many consecutive registers to read\n"
"\t <port> : ", name);
for (i = 0; i < ARRAY_SIZE(iosf_sb_ports); i++)
printf("%s,", iosf_sb_ports[i].name);
printf(" or in hex\n"
"\t <reg> : in hex\n");
}
int main(int argc, char *argv[])
{
uint32_t port, reg, val;
struct pci_device *dev = intel_get_pci_device();
int i, nregs, count = 1, reg_stride;
const char *name;
fprintf(stderr, "WARNING: Use of %s has been deprecated and replaced by"
" intel_reg.\n", argv[0]);
if (!IS_VALLEYVIEW(dev->device_id) &&
!IS_CHERRYVIEW(dev->device_id)) {
usage(argv[0]);
return 1;
}
for (;;) {
int c = getopt(argc, argv, "hc:");
if (c == -1)
break;
switch (c) {
case 'h':
usage(argv[0]);
return 0;
case 'c':
count = strtol(optarg, NULL, 0);
if (count < 1) {
usage(argv[0]);
return 3;
}
break;
}
}
nregs = argc - optind;
if (nregs < 1) {
usage(argv[0]);
return 2;
}
i = optind;
name = argv[i++];
port = iosf_sb_port_parse(name, &reg_stride);
intel_register_access_init(dev, 0);
for (; i < argc; i++) {
int j;
reg = strtoul(argv[i], NULL, 16);
for (j = 0; j < count; j++) {
val = intel_iosf_sb_read(port, reg);
printf("0x%02x(%s)/0x%04x : 0x%08x\n", port, name, reg, val);
reg += reg_stride;
}
}
intel_register_access_fini();
return 0;
}

View File

@ -1,140 +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 <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include <string.h>
#include "intel_io.h"
#include "intel_chipset.h"
#include "drmtest.h"
/* keep sorted by name for bsearch() */
static const struct iosf_sb_port {
const char *name;
uint8_t port;
} iosf_sb_ports[] = {
{ "bunit", 0x03, },
{ "cck", 0x14, },
{ "ccu", 0xa9, },
{ "dpio", 0x12, },
{ "dpio2", 0x1a, },
{ "flisdsi", 0x1b, },
{ "gpio_nc", 0x13, },
{ "nc", 0x11, },
{ "punit", 0x04, },
};
static int iosf_sb_port_compare(const void *a, const void *b)
{
const char *name = a;
const struct iosf_sb_port *p = b;
return strcasecmp(name, p->name);
}
static int iosf_sb_port_parse(const char *name)
{
const struct iosf_sb_port *p;
p = bsearch(name, iosf_sb_ports, ARRAY_SIZE(iosf_sb_ports),
sizeof(iosf_sb_ports[0]),
iosf_sb_port_compare);
if (p)
return p->port;
return strtoul(name, NULL, 16);
}
static void usage(const char *name)
{
int i;
printf("Warning : This program will work only on Valleyview/Cherryview\n"
"Usage: %s [-h] [--] <port> <reg> <val> [<reg> <val> ...]\n"
"\t -h : Show this help text\n"
"\t <port> : ", name);
for (i = 0; i < ARRAY_SIZE(iosf_sb_ports); i++)
printf("%s,", iosf_sb_ports[i].name);
printf(" or in hex\n"
"\t <reg> : in hex\n"
"\t <val> : in hex\n");
}
int main(int argc, char** argv)
{
uint32_t port, reg, val, tmp;
struct pci_device *dev = intel_get_pci_device();
int i, nregs;
const char *name;
fprintf(stderr, "WARNING: Use of %s has been deprecated and replaced by"
" intel_reg.\n", argv[0]);
if (!IS_VALLEYVIEW(dev->device_id) &&
!IS_CHERRYVIEW(dev->device_id)) {
usage(argv[0]);
return 1;
}
for (;;) {
int c = getopt(argc, argv, "h");
if (c == -1)
break;
switch (c) {
case 'h':
usage(argv[0]);
return 0;
}
}
nregs = argc - optind;
if (nregs < 2) {
usage(argv[0]);
return 2;
}
i = optind;
name = argv[i++];
port = iosf_sb_port_parse(name);
intel_register_access_init(dev, 0);
for (; i < argc; i += 2) {
reg = strtoul(argv[i], NULL, 16);
val = strtoul(argv[i+1], NULL, 16);
tmp = intel_iosf_sb_read(port, reg);
printf("0x%02x(%s)/0x%04x before : 0x%08x\n", port, name, reg, tmp);
intel_iosf_sb_write(port, reg, val);
tmp = intel_iosf_sb_read(port, reg);
printf("0x%02x(%s)/0x%04x after : 0x%08x\n", port, name, reg, tmp);
}
intel_register_access_fini();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,145 +0,0 @@
/*
* Copyright © 2010 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.
*
* Authors:
* Zhenyu Wang <zhenyuw@linux.intel.com>
*
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include <string.h>
#include "intel_io.h"
#include "intel_chipset.h"
static void bit_decode(uint32_t reg)
{
int i;
for (i=31; i >= 0; i--)
printf(" %2d", i);
printf("\n");
for (i=31; i >= 0; i--)
printf(" %2d", (reg & (1 << i)) && 1);
printf("\n");
}
static void dump_range(uint32_t start, uint32_t end)
{
int i;
for (i = start; i < end; i += 4)
printf("0x%X : 0x%X\n", i, INREG(i));
}
static void usage(char *cmdname)
{
printf("Usage: %s [-f|-d] [addr1] [addr2] .. [addrN]\n", cmdname);
printf("\t -f : read back full range of registers.\n");
printf("\t WARNING! This option may result in a machine hang!\n");
printf("\t -d : decode register bits.\n");
printf("\t -c : number of dwords to dump (can't be used with -f/-d).\n");
printf("\t addr : in 0xXXXX format\n");
}
int main(int argc, char** argv)
{
int ret = 0;
uint32_t reg;
int i, ch;
char *cmdname = strdup(argv[0]);
int full_dump = 0;
int decode_bits = 0;
int dwords = 1;
fprintf(stderr, "WARNING: Use of %s has been deprecated and replaced by"
" intel_reg.\n", argv[0]);
while ((ch = getopt(argc, argv, "dfhc:")) != -1) {
switch(ch) {
case 'd':
decode_bits = 1;
break;
case 'f':
full_dump = 1;
break;
case 'h':
usage(cmdname);
ret = 1;
goto out;
case 'c':
dwords = strtol(optarg, NULL, 0);
break;
}
}
argc -= optind;
argv += optind;
if (argc < 1) {
usage(cmdname);
ret = 1;
goto out;
}
if ((dwords > 1) && (argc != 1 || full_dump || decode_bits)) {
usage(cmdname);
ret = 1;
goto out;
}
intel_register_access_init(intel_get_pci_device(), 0);
if (full_dump) {
dump_range(0x00000, 0x00fff); /* VGA registers */
dump_range(0x02000, 0x02fff); /* instruction, memory, interrupt control registers */
dump_range(0x03000, 0x031ff); /* FENCE and PPGTT control registers */
dump_range(0x03200, 0x03fff); /* frame buffer compression registers */
dump_range(0x05000, 0x05fff); /* I/O control registers */
dump_range(0x06000, 0x06fff); /* clock control registers */
dump_range(0x07000, 0x07fff); /* 3D internal debug registers */
dump_range(0x07400, 0x088ff); /* GPE debug registers */
dump_range(0x0a000, 0x0afff); /* display palette registers */
dump_range(0x10000, 0x13fff); /* MMIO MCHBAR */
dump_range(0x30000, 0x3ffff); /* overlay registers */
dump_range(0x60000, 0x6ffff); /* display engine pipeline registers */
dump_range(0x70000, 0x72fff); /* display and cursor registers */
dump_range(0x73000, 0x73fff); /* performance counters */
} else {
for (i=0; i < argc; i++) {
sscanf(argv[i], "0x%x", &reg);
dump_range(reg, reg + (dwords * 4));
if (decode_bits)
bit_decode(INREG(reg));
}
}
intel_register_access_fini();
out:
free(cmdname);
return ret;
}

View File

@ -1,56 +0,0 @@
/*
* Copyright © 2010 Red Hat, Inc.
*
* 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.
*
* Authors:
* Adam Jackson <ajax@redhat.com>
*/
#include <unistd.h>
#include <assert.h>
#include <stdio.h>
#include "intel_io.h"
#include "intel_chipset.h"
int main(int argc, char** argv)
{
struct pci_device *pci_dev;
uint32_t devid;
int mmio_bar;
int ret;
fprintf(stderr, "WARNING: Use of %s has been deprecated and replaced by"
" intel_reg.\n", argv[0]);
pci_dev = intel_get_pci_device();
devid = pci_dev->device_id;
intel_mmio_use_pci_bar(pci_dev);
if (IS_GEN2(devid))
mmio_bar = 1;
else
mmio_bar = 0;
ret = write(1, igt_global_mmio, pci_dev->regions[mmio_bar].size);
assert(ret > 0);
return 0;
}

View File

@ -1,60 +0,0 @@
/*
* Copyright © 2007 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.
*
* Authors:
* Ben Gamari <bgamari.foss@gmail.com>
*
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include "intel_io.h"
#include "intel_chipset.h"
int main(int argc, char** argv)
{
uint32_t reg, value;
fprintf(stderr, "WARNING: Use of %s has been deprecated and replaced by"
" intel_reg.\n", argv[0]);
if (argc < 3) {
printf("Usage: %s addr value\n", argv[0]);
printf(" WARNING: This is dangerous to you and your system's health.\n");
printf(" Only for use in debugging.\n");
exit(1);
}
intel_register_access_init(intel_get_pci_device(), 0);
sscanf(argv[1], "0x%x", &reg);
sscanf(argv[2], "0x%x", &value);
printf("Value before: 0x%X\n", INREG(reg));
OUTREG(reg, value);
printf("Value after: 0x%X\n", INREG(reg));
intel_register_access_fini();
return 0;
}

View File

@ -1,97 +0,0 @@
/*
* Copyright © 2013 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.
*
* Authors:
* Ville Syrjälä <ville.syrjala@linux.intel.com>
*
*/
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/io.h>
#include "intel_io.h"
#include "intel_chipset.h"
static uint8_t read_reg(uint32_t reg, bool use_mmio)
{
if (use_mmio)
return INREG8(reg);
else
return inb(reg);
}
static void usage(const char *cmdname)
{
printf("Usage: %s [-m] [addr1] [addr2] .. [addrN]\n", cmdname);
printf("\t -m : use MMIO instead of port IO\n");
printf("\t addr : in 0xXXXX format\n");
}
int main(int argc, char *argv[])
{
bool use_mmio = false;
int ret = 0;
uint32_t reg;
int i, ch;
const char *cmdname = argv[0];
fprintf(stderr, "WARNING: Use of %s has been deprecated and replaced by"
" intel_reg.\n", argv[0]);
while ((ch = getopt(argc, argv, "m")) != -1) {
switch(ch) {
case 'm':
use_mmio = true;
break;
default:
break;
}
}
argc -= optind;
argv += optind;
if (argc < 1) {
usage(cmdname);
return 1;
}
if (use_mmio)
intel_register_access_init(intel_get_pci_device(), 0);
else
assert(iopl(3) == 0);
for (i = 0; i < argc; i++) {
sscanf(argv[i], "0x%x", &reg);
printf("0x%X : 0x%X\n", reg, read_reg(reg, use_mmio));
}
if (use_mmio)
intel_register_access_fini();
else
iopl(0);
return ret;
}

View File

@ -1,97 +0,0 @@
/*
* Copyright © 2013 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.
*
* Authors:
* Ville Syrjälä <ville.syrjala@linux.intel.com>
*
*/
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/io.h>
#include "intel_io.h"
#include "intel_chipset.h"
static void write_reg(uint32_t reg, uint8_t val, bool use_mmio)
{
if (use_mmio)
OUTREG8(reg, val);
else
outb(val, reg);
}
static void usage(const char *cmdname)
{
printf("Usage: %s [-m] addr value\n", cmdname);
printf("\t -m : use MMIO instead of port IO\n");
printf("\t addr,value : in 0xXXXX format\n");
}
int main(int argc, char *argv[])
{
bool use_mmio = false;
int ret = 0;
uint32_t reg, val;
int ch;
const char *cmdname = argv[0];
fprintf(stderr, "WARNING: Use of %s has been deprecated and replaced by"
" intel_reg.\n", argv[0]);
while ((ch = getopt(argc, argv, "m")) != -1) {
switch(ch) {
case 'm':
use_mmio = true;
break;
default:
break;
}
}
argc -= optind;
argv += optind;
if (argc < 2) {
usage(cmdname);
return 1;
}
sscanf(argv[0], "0x%x", &reg);
sscanf(argv[1], "0x%x", &val);
if (use_mmio)
intel_register_access_init(intel_get_pci_device(), 0);
else
assert(iopl(3) == 0);
write_reg(reg, val, use_mmio);
if (use_mmio)
intel_register_access_fini();
else
iopl(0);
return ret;
}