2 * inteltool - dump all registers on an Intel CPU + chipset based system.
4 * Copyright (C) 2008-2010 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.
23 #include "inteltool.h"
26 * (G)MCH MMIO Config Space
28 int print_mchbar(struct pci_dev *nb)
30 int i, size = (16 * 1024);
31 volatile uint8_t *mchbar;
34 printf("\n============= MCHBAR ============\n\n");
36 switch (nb->device_id) {
37 case PCI_DEVICE_ID_INTEL_82915:
38 case PCI_DEVICE_ID_INTEL_82945GM:
39 case PCI_DEVICE_ID_INTEL_82945P:
40 case PCI_DEVICE_ID_INTEL_82975X:
41 mchbar_phys = pci_read_long(nb, 0x44) & 0xfffffffe;
43 case PCI_DEVICE_ID_INTEL_PM965:
44 case PCI_DEVICE_ID_INTEL_82Q35:
45 case PCI_DEVICE_ID_INTEL_82G33:
46 case PCI_DEVICE_ID_INTEL_82Q33:
47 mchbar_phys = pci_read_long(nb, 0x48) & 0xfffffffe;
48 mchbar_phys |= ((uint64_t)pci_read_long(nb, 0x4c)) << 32;
50 case PCI_DEVICE_ID_INTEL_82443LX:
51 case PCI_DEVICE_ID_INTEL_82443BX:
52 case PCI_DEVICE_ID_INTEL_82810:
53 case PCI_DEVICE_ID_INTEL_82810E_MC:
54 case PCI_DEVICE_ID_INTEL_82810DC:
55 case PCI_DEVICE_ID_INTEL_82830M:
56 printf("This northbrigde does not have MCHBAR.\n");
58 case PCI_DEVICE_ID_INTEL_GS45:
59 mchbar_phys = pci_read_long(nb, 0x48) & 0xfffffffe;
60 mchbar_phys |= ((uint64_t)pci_read_long(nb, 0x4c)) << 32;
63 printf("Error: Dumping MCHBAR on this northbridge is not (yet) supported.\n");
67 mchbar = map_physical(mchbar_phys, size);
70 perror("Error mapping MCHBAR");
74 printf("MCHBAR = 0x%08llx (MEM)\n\n", mchbar_phys);
76 for (i = 0; i < size; i += 4) {
77 if (*(uint32_t *)(mchbar + i))
78 printf("0x%04x: 0x%08x\n", i, *(uint32_t *)(mchbar+i));
81 unmap_physical((void *)mchbar, size);