// check temperature of FB-DIMM modules on tyan s2696 // http://lists.lm-sensors.org/pipermail/lm-sensors/2007-January/018655.html // http://lists.lm-sensors.org/pipermail/lm-sensors/2007-January/018661.html // g++ -o ~alpha/bin/fbdimm_temp fbdimm_temp.c #include #include #include #include #include int main(int argc,char* argv) { int fd = open("/dev/mem", O_RDONLY); if ( fd == -1 ) { perror("failed to open /dev/mem"); return(1); } unsigned char* addr = (unsigned char*) mmap(0, 128*1024*1024, PROT_READ, MAP_PRIVATE, fd, 0xFE000000); if ( addr == MAP_FAILED ) { perror("mmap failed"); return(1); } // we want function 3, 4 channels, 16AMB/channel for (int i=0, dimm=0; i < 64; i++ ) { char buf[128]; int idx = i*2048; if ( addr[idx] != 0xff || addr[idx+1] != 0xff ) { sprintf(buf, "Intel sig at %i: %02x %02x", i, addr[idx], addr[idx+1]); // offset 85h function 3 usleep(1000); // delay to get correct value printf("FB-DIMM %d temp is: %.1f deg C (%s)\n", ++dimm, addr[idx+(256*3)+0x85]/2., buf); } } munmap(addr, 128*1024*1024); return(0); }