blob: bd85fae2aa8ccd12642fc10a07647702391936fd [file] [log] [blame]
Patrick Georgiea063cb2020-05-08 19:28:13 +02001/* inteltool - dump all registers on an Intel CPU + chipset based system */
Patrick Georgi7333a112020-05-08 20:48:04 +02002/* SPDX-License-Identifier: GPL-2.0-only */
Vladimir Serbinenko188aec02015-05-20 14:04:41 +02003
4#include <stdio.h>
5#include <stdlib.h>
6#include <inttypes.h>
7#include "inteltool.h"
8
9#define MMIO_SIZE 0x100000
10
11int print_gfx(struct pci_dev *gfx)
12{
Roger Pau Monne5cd34e22015-08-26 16:51:01 +020013 uint64_t mmio_phys;
14 uint8_t *mmio;
15 uint32_t i;
Vladimir Serbinenko188aec02015-05-20 14:04:41 +020016 if (!gfx) {
17 printf ("No IGD found\n");
18 return 0;
19 }
20 printf("\n============= IGD ==============\n\n");
21 mmio_phys = gfx->base_addr[0] & ~0x7ULL;
22 printf("IGD MMIO = 0x%08llx (MEM)\n\n", (unsigned long long)mmio_phys);
23 mmio = map_physical(mmio_phys, MMIO_SIZE);
24 if (mmio == NULL) {
25 perror("Error mapping MMIO");
26 exit(1);
27 }
28 for (i = 0; i < MMIO_SIZE; i += 4) {
Michael Niewöhner10d52212020-03-13 19:08:21 +010029 if (read32(mmio + i))
30 printf("0x%06x: 0x%08x\n", i, read32(mmio + i));
Vladimir Serbinenko188aec02015-05-20 14:04:41 +020031 }
32 unmap_physical((void *)mmio, MMIO_SIZE);
33 return 0;
34
35}