mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-11 16:32:58 +00:00
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:
@@ -18,8 +18,6 @@ intel_gpu_time
|
||||
intel_gpu_top
|
||||
intel_gtt
|
||||
intel_infoframes
|
||||
intel_iosf_sb_read
|
||||
intel_iosf_sb_write
|
||||
intel_l3_parity
|
||||
intel_lid
|
||||
intel_opregion_decode
|
||||
@@ -27,13 +25,7 @@ intel_panel_fitter
|
||||
intel_perf_counters
|
||||
intel_reg
|
||||
intel_reg_checker
|
||||
intel_reg_dumper
|
||||
intel_reg_read
|
||||
intel_reg_snapshot
|
||||
intel_reg_write
|
||||
intel_stepping
|
||||
intel_vga_read
|
||||
intel_vga_write
|
||||
intel_watermark
|
||||
skl_compute_wrpll
|
||||
skl_ddb_allocation
|
||||
|
||||
@@ -23,21 +23,13 @@ bin_PROGRAMS = \
|
||||
intel_gpu_top \
|
||||
intel_gtt \
|
||||
intel_infoframes \
|
||||
intel_iosf_sb_read \
|
||||
intel_iosf_sb_write \
|
||||
intel_l3_parity \
|
||||
intel_lid \
|
||||
intel_opregion_decode \
|
||||
intel_panel_fitter \
|
||||
intel_perf_counters \
|
||||
intel_reg_checker \
|
||||
intel_reg_dumper \
|
||||
intel_reg_read \
|
||||
intel_reg_snapshot \
|
||||
intel_reg_write \
|
||||
intel_stepping \
|
||||
intel_vga_read \
|
||||
intel_vga_write \
|
||||
intel_watermark
|
||||
|
||||
dist_bin_SCRIPTS = intel_gpu_abrt
|
||||
|
||||
@@ -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, ®_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;
|
||||
}
|
||||
@@ -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
@@ -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", ®);
|
||||
dump_range(reg, reg + (dwords * 4));
|
||||
|
||||
if (decode_bits)
|
||||
bit_decode(INREG(reg));
|
||||
}
|
||||
}
|
||||
|
||||
intel_register_access_fini();
|
||||
|
||||
out:
|
||||
free(cmdname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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", ®);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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", ®);
|
||||
printf("0x%X : 0x%X\n", reg, read_reg(reg, use_mmio));
|
||||
}
|
||||
|
||||
if (use_mmio)
|
||||
intel_register_access_fini();
|
||||
else
|
||||
iopl(0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -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", ®);
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user