all: pciutils dep $(PROGRAM)
$(PROGRAM): $(OBJS)
- $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
+ $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
clean:
rm -f $(PROGRAM) *.o *~
printf "struct pci_access *pacc;\n"; \
printf "int main(int argc, char **argv)\n"; \
printf "{ pacc = pci_alloc(); return 0; }\n"; ) > .test.c )
- @$(CC) $(CFLAGS) $(LDFLAGS) .test.c -o .test &>/dev/null && \
+ @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \
printf "found.\n" || ( printf "not found.\n\n"; \
printf "Please install pciutils-devel and zlib-devel.\n"; \
printf "See README for more information.\n\n"; \
msr_t rdmsr(int addr)
{
- uint8_t buf[8];
+ uint32_t buf[2];
msr_t msr = { 0xffffffff, 0xffffffff };
if (lseek(fd_msr, (off_t) addr, SEEK_SET) == -1) {
}
if (read(fd_msr, buf, 8) == 8) {
- msr.lo = *(uint32_t *)buf;
- msr.hi = *(uint32_t *)(buf + 4);
-
+ msr.lo = buf[0];
+ msr.hi = buf[1];
return msr;
}
#include <stdio.h>
#include <stdlib.h>
+#include <inttypes.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/mman.h>
fd_mem, (off_t) phys_addr);
if (virt_addr == MAP_FAILED) {
- printf("Error mapping physical memory 0x%08lx[0x%zx]\n", phys_addr, len);
+ printf("Error mapping physical memory 0x%08" PRIx64 "[0x%zx]\n",
+ phys_addr, len);
return NULL;
}
#include <stdio.h>
#include <stdlib.h>
+#include <inttypes.h>
#include "inteltool.h"
/*
}
if (nb->device_id == PCI_DEVICE_ID_INTEL_82865)
- printf("BAR6 = 0x%08llx (MEM)\n\n", mchbar_phys);
+ printf("BAR6 = 0x%08" PRIx64 " (MEM)\n\n", mchbar_phys);
else
- printf("MCHBAR = 0x%08llx (MEM)\n\n", mchbar_phys);
+ printf("MCHBAR = 0x%08" PRIx64 " (MEM)\n\n", mchbar_phys);
for (i = 0; i < size; i += 4) {
if (*(uint32_t *)(mchbar + i))
#include <stdio.h>
#include <stdlib.h>
+#include <inttypes.h>
#include "inteltool.h"
/*
exit(1);
}
- printf("EPBAR = 0x%08llx (MEM)\n\n", epbar_phys);
+ printf("EPBAR = 0x%08" PRIx64 " (MEM)\n\n", epbar_phys);
for (i = 0; i < size; i += 4) {
if (*(uint32_t *)(epbar + i))
printf("0x%04x: 0x%08x\n", i, *(uint32_t *)(epbar+i));
exit(1);
}
- printf("DMIBAR = 0x%08llx (MEM)\n\n", dmibar_phys);
+ printf("DMIBAR = 0x%08" PRIx64 " (MEM)\n\n", dmibar_phys);
for (i = 0; i < size; i += 4) {
if (*(uint32_t *)(dmibar + i))
printf("0x%04x: 0x%08x\n", i, *(uint32_t *)(dmibar+i));
return 1;
}
- printf("PCIEXBAR: 0x%08llx\n", pciexbar_phys);
+ printf("PCIEXBAR: 0x%08" PRIx64 "\n", pciexbar_phys);
pciexbar = map_physical(pciexbar_phys, (max_busses * 1024 * 1024));
if (fd_stat.st_size < 128) {
lseek(fd, 127, SEEK_SET);
- write(fd, "\0", 1);
+ if (write(fd, "\0", 1) != 1) {
+ fprintf(stderr, "Unable to extended '%s' to its full size.\n",
+ nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_FILE].param);
+ exit(1);
+ }
fsync(fd);
}