Changeset 3306

Show
Ignore:
Timestamp:
05/26/06 11:23:10 (7 years ago)
Author:
khali
Message:

Decode size (Direct Rambus and Rambus). At this point, this
script provides all the information "sensors" does for SPD eeproms, so
we're not so far from dropping eeprom support from sensors.
Code cleanups.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/eeprom/decode-dimms.pl

    r3305 r3306  
    420420 
    421421#size computation 
    422  
    423         my $a = $bytes->[3]; 
    424         my $b = $bytes->[4]; 
    425         my $c = $bytes->[5]; 
    426         my $d = $bytes->[17]; 
    427422        my $k=0; 
    428423        my $ii=0; 
    429424         
    430         $ii = (($a) & 0x0f) + (( $b) & 0x0f) - 17; 
    431         if (( $c <= 8) && ( $d <= 8)) { 
    432                  $k = ( $c) * ( $d); 
     425        $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; 
     426        if (($bytes->[5] <= 8) && ($bytes->[17] <= 8)) { 
     427                 $k = $bytes->[5] * $bytes->[17]; 
    433428        } 
    434429         
     
    436431                printl "Size", ((1 << $ii) * $k) . " MB"; } 
    437432        else {  
    438                 printl "INVALID SIZE", $a . "," . $b . "," . $c . "," . $d; 
     433                printl "INVALID SIZE", $bytes->[3] . "," . $bytes->[4] . "," . 
     434                                       $bytes->[5] . "," . $bytes->[17]; 
    439435        } 
    440436 
     
    577573        if (@cas >= 1) { 
    578574                $l = "Cycle Time (CAS ".$cas[$#cas].")"; 
    579                 $temp = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; 
    580                 printl $l, "$temp ns"; 
     575                printl $l, "$ctime ns"; 
    581576 
    582577                $l = "Access Time (CAS ".$cas[$#cas].")"; 
     
    712707 
    713708#size computation 
    714  
    715709        my $k=0; 
    716710        my $ii=0; 
     
    825819 
    826820#size computation 
    827         my $a = $bytes->[3]; 
    828         my $b = $bytes->[4]; 
    829         my $c = $bytes->[5]; 
    830         my $d = $bytes->[17]; 
    831821        my $k=0; 
    832822        my $ii=0; 
    833823 
    834         $ii = ($a & 0x0f) + ($b & 0x0f) - 17; 
    835         $k = (($c & 0x7) + 1) * $d; 
     824        $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; 
     825        $k = (($bytes->[5] & 0x7) + 1) * $bytes->[17]; 
    836826         
    837827        if($ii > 0 && $ii <= 12 && $k > 0) { 
    838828                printl "Size", ((1 << $ii) * $k) . " MB";  
    839829        } else { 
    840                 printl "INVALID SIZE", $a . "," . $b . "," . $c . "," . $d; 
     830                printl "INVALID SIZE", $bytes->[3] . "," . $bytes->[4] . "," . 
     831                                       $bytes->[5] . "," . $bytes->[17]; 
    841832        } 
    842833 
     
    863854} 
    864855 
     856# Parameter: bytes 0-63 
     857sub decode_direct_rambus($) 
     858{ 
     859        my $bytes = shift; 
     860 
     861#size computation 
     862        my $ii; 
     863 
     864        $ii = ($bytes->[4] & 0x0f) + ($bytes->[4] >> 4) + ($bytes->[5] & 0x07) - 13; 
     865         
     866        if ($ii > 0 && $ii < 16) { 
     867                printl "Size", (1 << $ii) . " MB"; 
     868        } else { 
     869                printl "INVALID SIZE", sprintf("0x%02x, 0x%02x", 
     870                                               $bytes->[4], $bytes->[5]); 
     871        } 
     872} 
     873 
     874# Parameter: bytes 0-63 
     875sub decode_rambus($) 
     876{ 
     877        my $bytes = shift; 
     878 
     879#size computation 
     880        my $ii; 
     881         
     882        $ii = ($bytes->[3] & 0x0f) + ($bytes->[3] >> 4) + ($bytes->[5] & 0x07) - 13; 
     883         
     884        if ($ii > 0 && $ii < 16) { 
     885                printl "Size", (1 << $ii) . " MB"; 
     886        } else { 
     887                printl "INVALID SIZE", sprintf("0x%02x, 0x%02x", 
     888                                               $bytes->[3], $bytes->[5]); 
     889        } 
     890} 
     891 
    865892%decode_callback = ( 
    866893        "SDR SDRAM"     => \&decode_sdr_sdram, 
    867894        "DDR SDRAM"     => \&decode_ddr_sdram, 
    868895        "DDR2 SDRAM"    => \&decode_ddr2_sdram, 
     896        "Direct Rambus" => \&decode_direct_rambus, 
     897        "Rambus"        => \&decode_rambus, 
    869898); 
    870899