Changeset 114

Show
Ignore:
Timestamp:
02/17/06 18:30:21 (3 years ago)
Author:
ludo
Message:

memory module inventory (from r3062)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/admin/perl/info

    r101 r114  
    77 
    88$mac = ""; 
     9 
     10# 
     11# SMBios constants 
     12# 
     13 
     14@typetbl = ( "", "", "", "Desktop", "Low Profile Desktop", 
     15        "Pizza Box", "Mini Tower", "Tower", "Portable", "LapTop", "Notebook", 
     16        "Hand Held", "Docking Station", "All in One", "Sub Notebook",  
     17        "Space-saving", "Lunch Box", "Main Server Chassis", "Expansion Chassis", 
     18        "SubChassis", "Bus Expansion Chassis", "Peripheral Chassis",  
     19        "RAID Chassis", "Rack Mount Chassis", "Sealed-case", "Multi-system chassis" 
     20        ) ; 
     21 
     22@memform = ( "", "", "", "SIMM", "SIP", "Chip", "DIP", "ZIP", "Proprietary card",  
     23        "DIMM", "TSOP", "Row of chips", "RIMM", "SODIMM", "SRIMM"); 
     24         
     25@memtype = ( "", "", "", "DRAM", "EDRAM", "VRAM", "SRAM", "RAM", "ROM", 
     26        "FLASH", "EEPROM", "FEPROM", "EPROM", "CDRAM", "3DRAM", "SDRAM", 
     27        "SGRAM", "RDRAM", "DDR", "DDR2"); 
     28 
     29@memdetails = ( "", "", "", "Fast-paged", "Static column", "Pseudo-static", 
     30        "RAMBUS", "Synchronous", "CMOS", "EDO", "Window DRAM", "Cache DRAM", 
     31        "Non-volatile" );   
    932 
    1033# Program 
     
    125148  { 
    126149        my ($toto,$freq)=split(/:/); 
    127         $freq=$freq/1000
     150        $freq=int($freq/1000 + 0.5)
    128151        print "Freq=$freq\n"; 
    129152        next; 
     
    141164      chomp($sys); 
    142165      print "System=$sys\n"; 
     166      next; 
     167    } 
     168  if (/^S3:/) 
     169    { 
     170      my ($t,$sys)=split(/:/); 
     171      chomp($sys); 
     172      my ($fac, $type)=split(/\|/, $sys); 
     173      $typename = "Unknown"; 
     174      if ($type >= 1 && $type <= 26) { $typename = $typetbl[$type]; }  
     175      print "Chassis=$fac|$typename\n"; 
     176      next; 
     177    } 
     178  if (/^S4:/) 
     179    { 
     180      my ($t,$sys)=split(/:/); 
     181      chomp($sys); 
     182      print "CpuNum=$sys\n"; 
    143183      next; 
    144184    } 
     
    167207                    if (($list[2] eq 'a')) {print "Model=Pentium III Xeon\n";next;} 
    168208                    if (($list[2] eq 'b')) {print "Model=Pentium III 0.13u\n";next;} 
     209                    if (($list[2] eq 'd')) {print "Model=Pentium M 0.09u\n";next;} 
    169210                    print "Model=Pentium Pro/II/III\n"; 
    170211                    next; 
    171212                  } 
    172213                if (($list[1] eq '7')) {print "Model=Itanium\n";next;} 
    173                 if (($list[1] eq 'f')) {print "Model=Pentium 4\n";next;} 
     214                if (($list[1] eq 'f')) { 
     215                    if ($list[2] == '0') {print "Model=Pentium 4 0.18u\n";next;} 
     216                    if ($list[2] == '1') {print "Model=Pentium 4 0.18u\n";next;} 
     217                    if ($list[2] == '2') {print "Model=Pentium 4 0.13u\n";next;} 
     218                    if ($list[2] == '3') {print "Model=Pentium 4 0.09u\n";next;} 
     219                    if ($list[2] == '4') {print "Model=Pentium 4 0.09u\n";next;} 
     220                    print "Model=Pentium 4\n";next; 
     221                } 
    174222                print "Model=???\n"; 
    175223                next; 
     
    183231                    if ($list[2] == '1') {print "Model=Athlon 0.25u Slot A\n";next;} 
    184232                    if ($list[2] == '2') {print "Model=Athlon 0.18u Slot A\n";next;} 
    185                     if ($list[2] == '3') {print "Model=Duron\n";next;} 
    186                     if ($list[2] == '4') {print "Model=Athlon 0.18u\n";next;} 
     233                    if ($list[2] == '3') {print "Model=Duron (SF core)\n";next;} 
     234                    if ($list[2] == '4') {print "Model=Athlon (TB core) 0.18u\n";next;} 
    187235                    if ($list[2] == '6') {print "Model=Athlon MP/Mobile Athlon\n";next;} 
    188236                    if ($list[2] == '7') {print "Model=Mobile Duron\n";next;} 
     237                    if ($list[2] == '8') {print "Model=Athlon (TH/AP core)\n";next;} 
     238                    if ($list[2] == 'a') {print "Model=Athlon (BT core)\n";next;} 
    189239                    print "Model=Athlon/Duron\n"; 
    190240                    next; 
    191241                  } 
    192                 if (($list[1] == 'f')) {print "Model=Opteron/Athlon64\n";next;} 
     242                if (($list[1] == 'f')) {print "Model=Opteron/Athlon 64\n";next;} 
    193243                print "Model=???\n"; 
    194244                next; 
     
    196246        if ($list[13] == '43') 
    197247        {        
    198                 print "CpuVendor=Cyrix\n"; 
     248                print "CpuVendor=Cyrix/Via\n"; 
     249                if (($list[1] == '5')) {print "Model=Cyrix M1/Media GX\n";next;} 
     250                if (($list[1] == '6')) { 
     251                    if ($list[2] == '5') {print "Model=Cyrix M2\n";next;} 
     252                    print "Model=Via C3\n";next; 
     253                } 
    199254                print "Model=???\n"; 
    200255                next; 
     
    241296} 
    242297 
     298 
    243299sub hdmap 
    244300{ 
     
    259315  close(INFO); 
    260316} 
     317 
     318sub mem 
     319{ 
     320 my $file=$_[0]; 
     321 my $i=0; 
     322 
     323 open(FILE,$file) or die; 
     324 while (<FILE>) 
     325 { 
     326        next unless /^SM:/; 
     327 
     328        my @list=split(/[:(),=]+/); 
     329        my $used = ($list[1] ne "0")+0; 
     330        my $size = $list[1]; 
     331        if ($size > 0) { 
     332            $size *= 1024; 
     333        } else { 
     334            $size *= -1; 
     335        } 
     336        print "\n[MEM$i]\n"; 
     337        print "Used=$used\n"; 
     338        print "Capacity=$size\n" if ($used); 
     339        print "Form=".$memform[hex($list[2])]."\n"; 
     340        print "Location=".$list[3]."\n"; 
     341        my $details = ""; 
     342        my $bit = 1; 
     343        my $data = hex($list[4]) >> 16; 
     344        foreach $det (@memdetails) { 
     345            if ($data & $bit) { 
     346                $details .= " ".$det; 
     347            } 
     348            $bit *= 2; 
     349        } 
     350        print "Type=".$memtype[hex($list[4]) & 0xFFFF]."$details\n"; 
     351        print "Speed=$list[5]\n" if ($list[5] != 0); 
     352        $i++; 
     353 } 
     354 close(FILE); 
     355} 
     356 
    261357 
    262358# MAIN 
     
    285381disk($ARGV[0]); 
    286382hdmap($ARGV[0]); 
     383mem($ARGV[0]); 
    287384 
    288385# update the database if LRS Inventory is installed