summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorVladimir Serbinenko <phcoder@gmail.com>2015-05-20 14:04:41 +0200
committerVladimir Serbinenko <phcoder@gmail.com>2015-05-25 18:51:59 +0200
commit188aec06401e802cddf209b564a5ad06e3945e9e (patch)
treecbdf979aa6647e83c841d80932c72143f45be95b /util
parent5a6b8d157bc88e243cde54d347c715243a6f1c1e (diff)
inteltool: dump gfx registers.
Useful for autoport and other gfx-related developpement. Change-Id: I1fc0952bc30ab15cd39a4f0c00649714dcf318f3 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/10276 Tested-by: build bot (Jenkins) Reviewed-by: Philipp Deppenwiese <zaolin@das-labor.org>
Diffstat (limited to 'util')
-rw-r--r--util/inteltool/Makefile2
-rw-r--r--util/inteltool/gfx.c52
-rw-r--r--util/inteltool/inteltool.c38
-rw-r--r--util/inteltool/inteltool.h1
4 files changed, 88 insertions, 5 deletions
diff --git a/util/inteltool/Makefile b/util/inteltool/Makefile
index f598ad4056..df939d577b 100644
--- a/util/inteltool/Makefile
+++ b/util/inteltool/Makefile
@@ -27,7 +27,7 @@ PREFIX ?= /usr/local
CFLAGS ?= -O2 -g -Wall -W
LDFLAGS += -lpci -lz
-OBJS = inteltool.o cpu.o gpio.o rootcmplx.o powermgt.o memory.o pcie.o amb.o ivy_memory.o spi.o
+OBJS = inteltool.o cpu.o gpio.o rootcmplx.o powermgt.o memory.o pcie.o amb.o ivy_memory.o spi.o gfx.o
OS_ARCH = $(shell uname)
ifeq ($(OS_ARCH), Darwin)
diff --git a/util/inteltool/gfx.c b/util/inteltool/gfx.c
new file mode 100644
index 0000000000..5a50c6e53e
--- /dev/null
+++ b/util/inteltool/gfx.c
@@ -0,0 +1,52 @@
+/*
+ * inteltool - dump all registers on an Intel CPU + chipset based system.
+ *
+ * Copyright (C) 2008-2010 by coresystems GmbH
+ * Copyright (C) 2012 Anton Kochkov
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <inttypes.h>
+#include "inteltool.h"
+
+#define MMIO_SIZE 0x100000
+
+int print_gfx(struct pci_dev *gfx)
+{
+ u64 mmio_phys;
+ u8 *mmio;
+ u32 i;
+ if (!gfx) {
+ printf ("No IGD found\n");
+ return 0;
+ }
+ printf("\n============= IGD ==============\n\n");
+ mmio_phys = gfx->base_addr[0] & ~0x7ULL;
+ printf("IGD MMIO = 0x%08llx (MEM)\n\n", (unsigned long long)mmio_phys);
+ mmio = map_physical(mmio_phys, MMIO_SIZE);
+ if (mmio == NULL) {
+ perror("Error mapping MMIO");
+ exit(1);
+ }
+ for (i = 0; i < MMIO_SIZE; i += 4) {
+ if (*(uint32_t *)(mmio + i))
+ printf("0x%06x: 0x%08x\n", i, *(uint32_t *)(mmio + i));
+ }
+ unmap_physical((void *)mmio, MMIO_SIZE);
+ return 0;
+
+}
diff --git a/util/inteltool/inteltool.c b/util/inteltool/inteltool.c
index f3520e2ce4..06dd20f24c 100644
--- a/util/inteltool/inteltool.c
+++ b/util/inteltool/inteltool.c
@@ -217,6 +217,7 @@ void print_usage(const char *name)
" -v | --version: print the version\n"
" -h | --help: print this help\n\n"
" -s | --spi: dump southbridge spi and bios_cntrl registers\n"
+ " -f | --gfx: dump graphics registers\n"
" -g | --gpio: dump southbridge GPIO registers\n"
" -G | --gpio-diffs: show GPIO differences from defaults\n"
" -r | --rcba: dump southbridge RCBA registers\n"
@@ -235,16 +236,16 @@ void print_usage(const char *name)
int main(int argc, char *argv[])
{
struct pci_access *pacc;
- struct pci_dev *sb = NULL, *nb, *dev;
+ struct pci_dev *sb = NULL, *nb, *gfx = NULL, *dev;
int i, opt, option_index = 0;
unsigned int id;
- char *sbname = "unknown", *nbname = "unknown";
+ char *sbname = "unknown", *nbname = "unknown", *gfxname = "unknown";
int dump_gpios = 0, dump_mchbar = 0, dump_rcba = 0;
int dump_pmbase = 0, dump_epbar = 0, dump_dmibar = 0;
int dump_pciexbar = 0, dump_coremsrs = 0, dump_ambs = 0;
- int dump_spi = 0;
+ int dump_spi = 0, dump_gfx = 0;
int show_gpio_diffs = 0;
static struct option long_options[] = {
@@ -262,10 +263,11 @@ int main(int argc, char *argv[])
{"ambs", 0, 0, 'A'},
{"spi", 0, 0, 's'},
{"all", 0, 0, 'a'},
+ {"gfx", 0, 0, 'f'},
{0, 0, 0, 0}
};
- while ((opt = getopt_long(argc, argv, "vh?gGrpmedPMaAs",
+ while ((opt = getopt_long(argc, argv, "vh?gGrpmedPMaAsf",
long_options, &option_index)) != EOF) {
switch (opt) {
case 'v':
@@ -275,6 +277,9 @@ int main(int argc, char *argv[])
case 'g':
dump_gpios = 1;
break;
+ case 'f':
+ dump_gfx = 1;
+ break;
case 'G':
show_gpio_diffs = 1;
break;
@@ -311,6 +316,7 @@ int main(int argc, char *argv[])
dump_coremsrs = 1;
dump_ambs = 1;
dump_spi = 1;
+ dump_gfx = 1;
break;
case 'A':
dump_ambs = 1;
@@ -390,6 +396,15 @@ int main(int argc, char *argv[])
exit(1);
}
+ gfx = pci_get_dev(pacc, 0, 0, 0x02, 0);
+
+ if (gfx) {
+ pci_fill_info(gfx, PCI_FILL_IDENT|PCI_FILL_BASES|PCI_FILL_SIZES|PCI_FILL_CLASS);
+
+ if (gfx->vendor_id != PCI_VENDOR_ID_INTEL)
+ gfx = 0;
+ }
+
id = cpuid(1);
/* Intel has suggested applications to display the family of a CPU as
@@ -409,6 +424,11 @@ int main(int argc, char *argv[])
for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++)
if (sb->device_id == supported_chips_list[i].device_id)
sbname = supported_chips_list[i].name;
+ if (gfx) {
+ for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++)
+ if (gfx->device_id == supported_chips_list[i].device_id)
+ gfxname = supported_chips_list[i].name;
+ }
printf("Northbridge: %04x:%04x (%s)\n",
nb->vendor_id, nb->device_id, nbname);
@@ -416,6 +436,11 @@ int main(int argc, char *argv[])
printf("Southbridge: %04x:%04x (%s)\n",
sb->vendor_id, sb->device_id, sbname);
+ if (gfx) {
+ printf("IGD: %04x:%04x (%s)\n",
+ gfx->vendor_id, gfx->device_id, gfxname);
+ }
+
/* Now do the deed */
if (dump_gpios) {
@@ -468,6 +493,11 @@ int main(int argc, char *argv[])
if (dump_spi) {
print_spi(sb);
}
+
+ if (dump_gfx) {
+ print_gfx(gfx);
+ }
+
/* Clean up */
pci_free_dev(nb);
// pci_free_dev(sb); // TODO: glibc detected "double free or corruption"
diff --git a/util/inteltool/inteltool.h b/util/inteltool/inteltool.h
index 283425f879..10b69a9d83 100644
--- a/util/inteltool/inteltool.h
+++ b/util/inteltool/inteltool.h
@@ -207,4 +207,5 @@ int print_dmibar(struct pci_dev *nb);
int print_pciexbar(struct pci_dev *nb);
int print_ambs(struct pci_dev *nb, struct pci_access *pacc);
int print_spi(struct pci_dev *sb);
+int print_gfx(struct pci_dev *gfx);
void ivybridge_dump_timings(void);