blob: f9b1fba17ae084bdfb9ef8dc5825aacaf125b6cc [file] [log] [blame]
Vladimir Serbinenko188aec02015-05-20 14:04:41 +02001/*
2 * inteltool - dump all registers on an Intel CPU + chipset based system.
3 *
4 * Copyright (C) 2008-2010 by coresystems GmbH
5 * Copyright (C) 2012 Anton Kochkov
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
Patrick Georgi25509ee2015-03-26 15:17:45 +010018 * Foundation, Inc.
Vladimir Serbinenko188aec02015-05-20 14:04:41 +020019 */
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <inttypes.h>
24#include "inteltool.h"
25
26#define MMIO_SIZE 0x100000
27
28int print_gfx(struct pci_dev *gfx)
29{
Roger Pau Monne5cd34e22015-08-26 16:51:01 +020030 uint64_t mmio_phys;
31 uint8_t *mmio;
32 uint32_t i;
Vladimir Serbinenko188aec02015-05-20 14:04:41 +020033 if (!gfx) {
34 printf ("No IGD found\n");
35 return 0;
36 }
37 printf("\n============= IGD ==============\n\n");
38 mmio_phys = gfx->base_addr[0] & ~0x7ULL;
39 printf("IGD MMIO = 0x%08llx (MEM)\n\n", (unsigned long long)mmio_phys);
40 mmio = map_physical(mmio_phys, MMIO_SIZE);
41 if (mmio == NULL) {
42 perror("Error mapping MMIO");
43 exit(1);
44 }
45 for (i = 0; i < MMIO_SIZE; i += 4) {
46 if (*(uint32_t *)(mmio + i))
47 printf("0x%06x: 0x%08x\n", i, *(uint32_t *)(mmio + i));
48 }
49 unmap_physical((void *)mmio, MMIO_SIZE);
50 return 0;
51
52}