2 * inteltool - dump all registers on an Intel CPU + chipset based system.
4 * Copyright (C) 2008 by coresystems GmbH
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "inteltool.h"
28 * (G)MCH MMIO Config Space
30 int print_mchbar(struct pci_dev *nb)
32 int i, size = (16 * 1024);
33 volatile uint8_t *mchbar;
36 printf("\n============= MCHBAR ============\n\n");
38 switch (nb->device_id) {
39 case PCI_DEVICE_ID_INTEL_82945GM:
40 mchbar_phys = pci_read_long(nb, 0x44) & 0xfffffffe;
42 case 0x1234: // Dummy for non-existent functionality
43 printf("This northbrigde does not have MCHBAR.\n");
46 printf("Error: Dumping MCHBAR on this northbridge is not (yet) supported.\n");
50 mchbar = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
51 fd_mem, (off_t) mchbar_phys);
53 if (mchbar == MAP_FAILED) {
54 perror("Error mapping MCHBAR");
58 printf("MCHBAR = 0x%08x (MEM)\n\n", mchbar_phys);
60 for (i = 0; i < size; i += 4) {
61 if (*(uint32_t *)(mchbar + i))
62 printf("0x%04x: 0x%08x\n", i, *(uint32_t *)(mchbar+i));
65 munmap((void *)mchbar, size);