Vladimir Serbinenko | 188aec0 | 2015-05-20 14:04:41 +0200 | [diff] [blame] | 1 | /* |
| 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. |
Vladimir Serbinenko | 188aec0 | 2015-05-20 14:04:41 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <stdio.h> |
| 18 | #include <stdlib.h> |
| 19 | #include <inttypes.h> |
| 20 | #include "inteltool.h" |
| 21 | |
| 22 | #define MMIO_SIZE 0x100000 |
| 23 | |
| 24 | int print_gfx(struct pci_dev *gfx) |
| 25 | { |
Roger Pau Monne | 5cd34e2 | 2015-08-26 16:51:01 +0200 | [diff] [blame] | 26 | uint64_t mmio_phys; |
| 27 | uint8_t *mmio; |
| 28 | uint32_t i; |
Vladimir Serbinenko | 188aec0 | 2015-05-20 14:04:41 +0200 | [diff] [blame] | 29 | if (!gfx) { |
| 30 | printf ("No IGD found\n"); |
| 31 | return 0; |
| 32 | } |
| 33 | printf("\n============= IGD ==============\n\n"); |
| 34 | mmio_phys = gfx->base_addr[0] & ~0x7ULL; |
| 35 | printf("IGD MMIO = 0x%08llx (MEM)\n\n", (unsigned long long)mmio_phys); |
| 36 | mmio = map_physical(mmio_phys, MMIO_SIZE); |
| 37 | if (mmio == NULL) { |
| 38 | perror("Error mapping MMIO"); |
| 39 | exit(1); |
| 40 | } |
| 41 | for (i = 0; i < MMIO_SIZE; i += 4) { |
| 42 | if (*(uint32_t *)(mmio + i)) |
| 43 | printf("0x%06x: 0x%08x\n", i, *(uint32_t *)(mmio + i)); |
| 44 | } |
| 45 | unmap_physical((void *)mmio, MMIO_SIZE); |
| 46 | return 0; |
| 47 | |
| 48 | } |