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>
This commit is contained in:
parent
5a6b8d157b
commit
188aec0640
|
@ -27,7 +27,7 @@ PREFIX ?= /usr/local
|
||||||
CFLAGS ?= -O2 -g -Wall -W
|
CFLAGS ?= -O2 -g -Wall -W
|
||||||
LDFLAGS += -lpci -lz
|
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)
|
OS_ARCH = $(shell uname)
|
||||||
ifeq ($(OS_ARCH), Darwin)
|
ifeq ($(OS_ARCH), Darwin)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -217,6 +217,7 @@ void print_usage(const char *name)
|
||||||
" -v | --version: print the version\n"
|
" -v | --version: print the version\n"
|
||||||
" -h | --help: print this help\n\n"
|
" -h | --help: print this help\n\n"
|
||||||
" -s | --spi: dump southbridge spi and bios_cntrl registers\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: dump southbridge GPIO registers\n"
|
||||||
" -G | --gpio-diffs: show GPIO differences from defaults\n"
|
" -G | --gpio-diffs: show GPIO differences from defaults\n"
|
||||||
" -r | --rcba: dump southbridge RCBA registers\n"
|
" -r | --rcba: dump southbridge RCBA registers\n"
|
||||||
|
@ -235,16 +236,16 @@ void print_usage(const char *name)
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct pci_access *pacc;
|
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;
|
int i, opt, option_index = 0;
|
||||||
unsigned int id;
|
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_gpios = 0, dump_mchbar = 0, dump_rcba = 0;
|
||||||
int dump_pmbase = 0, dump_epbar = 0, dump_dmibar = 0;
|
int dump_pmbase = 0, dump_epbar = 0, dump_dmibar = 0;
|
||||||
int dump_pciexbar = 0, dump_coremsrs = 0, dump_ambs = 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;
|
int show_gpio_diffs = 0;
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
|
@ -262,10 +263,11 @@ int main(int argc, char *argv[])
|
||||||
{"ambs", 0, 0, 'A'},
|
{"ambs", 0, 0, 'A'},
|
||||||
{"spi", 0, 0, 's'},
|
{"spi", 0, 0, 's'},
|
||||||
{"all", 0, 0, 'a'},
|
{"all", 0, 0, 'a'},
|
||||||
|
{"gfx", 0, 0, 'f'},
|
||||||
{0, 0, 0, 0}
|
{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) {
|
long_options, &option_index)) != EOF) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'v':
|
case 'v':
|
||||||
|
@ -275,6 +277,9 @@ int main(int argc, char *argv[])
|
||||||
case 'g':
|
case 'g':
|
||||||
dump_gpios = 1;
|
dump_gpios = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
dump_gfx = 1;
|
||||||
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
show_gpio_diffs = 1;
|
show_gpio_diffs = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -311,6 +316,7 @@ int main(int argc, char *argv[])
|
||||||
dump_coremsrs = 1;
|
dump_coremsrs = 1;
|
||||||
dump_ambs = 1;
|
dump_ambs = 1;
|
||||||
dump_spi = 1;
|
dump_spi = 1;
|
||||||
|
dump_gfx = 1;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
dump_ambs = 1;
|
dump_ambs = 1;
|
||||||
|
@ -390,6 +396,15 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
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);
|
id = cpuid(1);
|
||||||
|
|
||||||
/* Intel has suggested applications to display the family of a CPU as
|
/* 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++)
|
for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++)
|
||||||
if (sb->device_id == supported_chips_list[i].device_id)
|
if (sb->device_id == supported_chips_list[i].device_id)
|
||||||
sbname = supported_chips_list[i].name;
|
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",
|
printf("Northbridge: %04x:%04x (%s)\n",
|
||||||
nb->vendor_id, nb->device_id, nbname);
|
nb->vendor_id, nb->device_id, nbname);
|
||||||
|
@ -416,6 +436,11 @@ int main(int argc, char *argv[])
|
||||||
printf("Southbridge: %04x:%04x (%s)\n",
|
printf("Southbridge: %04x:%04x (%s)\n",
|
||||||
sb->vendor_id, sb->device_id, sbname);
|
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 */
|
/* Now do the deed */
|
||||||
|
|
||||||
if (dump_gpios) {
|
if (dump_gpios) {
|
||||||
|
@ -468,6 +493,11 @@ int main(int argc, char *argv[])
|
||||||
if (dump_spi) {
|
if (dump_spi) {
|
||||||
print_spi(sb);
|
print_spi(sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dump_gfx) {
|
||||||
|
print_gfx(gfx);
|
||||||
|
}
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
pci_free_dev(nb);
|
pci_free_dev(nb);
|
||||||
// pci_free_dev(sb); // TODO: glibc detected "double free or corruption"
|
// pci_free_dev(sb); // TODO: glibc detected "double free or corruption"
|
||||||
|
|
|
@ -207,4 +207,5 @@ int print_dmibar(struct pci_dev *nb);
|
||||||
int print_pciexbar(struct pci_dev *nb);
|
int print_pciexbar(struct pci_dev *nb);
|
||||||
int print_ambs(struct pci_dev *nb, struct pci_access *pacc);
|
int print_ambs(struct pci_dev *nb, struct pci_access *pacc);
|
||||||
int print_spi(struct pci_dev *sb);
|
int print_spi(struct pci_dev *sb);
|
||||||
|
int print_gfx(struct pci_dev *gfx);
|
||||||
void ivybridge_dump_timings(void);
|
void ivybridge_dump_timings(void);
|
||||||
|
|
Loading…
Reference in New Issue