summaryrefslogtreecommitdiff
path: root/util/inteltool/memory.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2008-12-04 15:18:20 +0000
committerStefan Reinauer <stepan@openbios.org>2008-12-04 15:18:20 +0000
commit1162f25a49e8f39822123d664cda10fef466b351 (patch)
tree22afd92c49e7b79fdea37c3e3aef6b34cb70af2f /util/inteltool/memory.c
parentfcf9be3b9305cfddaf74594fcaec4d6f23541154 (diff)
downloadcoreboot-1162f25a49e8f39822123d664cda10fef466b351.tar.xz
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 <stepan@coresystems.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3794 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/inteltool/memory.c')
-rw-r--r--util/inteltool/memory.c18
1 files changed, 10 insertions, 8 deletions
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 <stdio.h>
#include <stdlib.h>
-#include <sys/mman.h>
-
#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;
}