From 1162f25a49e8f39822123d664cda10fef466b351 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Thu, 4 Dec 2008 15:18:20 +0000 Subject: Patch to util/inteltool: * PMBASE dumping now knows the registers. * Add support for i965, i975, ICH8M * Add support for Darwin OS using DirectIO Signed-off-by: Stefan Reinauer Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3794 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/inteltool/memory.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'util/inteltool/memory.c') diff --git a/util/inteltool/memory.c b/util/inteltool/memory.c index 99a57535dd..049ce828b7 100644 --- a/util/inteltool/memory.c +++ b/util/inteltool/memory.c @@ -20,8 +20,6 @@ #include #include -#include - #include "inteltool.h" /* @@ -31,15 +29,20 @@ int print_mchbar(struct pci_dev *nb) { int i, size = (16 * 1024); volatile uint8_t *mchbar; - uint32_t mchbar_phys; + uint64_t mchbar_phys; printf("\n============= MCHBAR ============\n\n"); switch (nb->device_id) { case PCI_DEVICE_ID_INTEL_82945GM: case PCI_DEVICE_ID_INTEL_82945P: + case PCI_DEVICE_ID_INTEL_82975X: mchbar_phys = pci_read_long(nb, 0x44) & 0xfffffffe; break; + case PCI_DEVICE_ID_INTEL_PM965: + mchbar_phys = pci_read_long(nb, 0x48) & 0xfffffffe; + mchbar_phys |= ((uint64_t)pci_read_long(nb, 0x4c)) << 32; + break; case 0x1234: // Dummy for non-existent functionality printf("This northbrigde does not have MCHBAR.\n"); return 1; @@ -48,22 +51,21 @@ int print_mchbar(struct pci_dev *nb) return 1; } - mchbar = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED, - fd_mem, (off_t) mchbar_phys); + mchbar = map_physical(mchbar_phys, size); - if (mchbar == MAP_FAILED) { + if (mchbar == NULL) { perror("Error mapping MCHBAR"); exit(1); } - printf("MCHBAR = 0x%08x (MEM)\n\n", mchbar_phys); + printf("MCHBAR = 0x%08llx (MEM)\n\n", mchbar_phys); for (i = 0; i < size; i += 4) { if (*(uint32_t *)(mchbar + i)) printf("0x%04x: 0x%08x\n", i, *(uint32_t *)(mchbar+i)); } - munmap((void *)mchbar, size); + unmap_physical((void *)mchbar, size); return 0; } -- cgit v1.2.3