diff --git a/CHANGES b/CHANGES index 25886cea..fb88a144 100644 --- a/CHANGES +++ b/CHANGES @@ -45,6 +45,7 @@ ask CVS about it: Explicitely support ADM1028 Scan all logical devices of PC87365 and PC87366 Detect LM92, LM76, MAX6633, MAX6634, MAX6635 + Detect eeproms with software write protect 2.8.6 (20040405) diff --git a/doc/chips/eeprom b/doc/chips/eeprom index fbbcc5a4..7ccce7dc 100644 --- a/doc/chips/eeprom +++ b/doc/chips/eeprom @@ -7,9 +7,15 @@ Supported chips: * Any EEPROM chip in the designated address range Prefix `eeprom' Addresses scanned: I2C 0x50 - 0x57 (inclusive) - Datasheets: Publicly available from Atmel (www.atmel.com), - Fairchild (www.fairchildsemi.com), and - Microchip (www.microchip.com) + Datasheets: Publicly available from: + Atmel (www.atmel.com), + Catalyst (www.catsemi.com), + Fairchild (www.fairchildsemi.com), + Microchip (www.microchip.com), + Philips (www.semiconductor.philips.com), + Rohm (www.rohm.com), + ST (www.st.com), + Xicor (www.xicor.com) Chip Size (bits) Address 24C01 1K 0x50 (shadows at 0x51 - 0x57) @@ -21,6 +27,8 @@ Supported chips: 0x53, 0x55, 0x56, 0x57) 24C16 16K 0x50 (additional data at 0x51 - 0x57) Sony 2K 0x57 + Microchip 24AA52 2K 0x50 - 0x57, SW write protect at 0x30-37 + ST M34C02 2K 0x50 - 0x57, SW write protect at 0x30-37 Author: Frodo Looijaard and Philip Edelbrock @@ -72,6 +80,15 @@ eeprom. Recent Sony Vaio laptops have an EEPROM at 0x57. We couldn't get the specification, so it is guess work and far from being complete. +The Microchip 24AA52/24LCS52 and the ST M34C02 support an additional +software write protect register at 0x30 - 0x37 (0x20 less than the +memory location). The chip responds to "write quick" detection at this +address but does not respond to byte reads. +If this register is present, the lower 128 bytes of the memory +array are not write protected. Any byte data write to this address +will write protect the memory array permanently, and the device +will no longer respond at the 0x30-37 address. +The eeprom driver does not support this register. Lacking functionality: @@ -84,7 +101,8 @@ These devices require two-byte address fields and are not supported. * Enable Writing. Again, no technical reason why not, but making it easy to change the contents of the EEPROMs (on DIMMs anyway) also makes it easy -to disable the DIMMs until the values are restored somehow. +to disable the DIMMs (potentially preventing the computer from booting) +until the values are restored somehow. Use: diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index ae082859..b36610ec 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1245,6 +1245,12 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect i2c_addrs => [0x57], i2c_detect => sub { eeprom_detect 1, @_ }, }, + { + name => "SPD EEPROM with Software Write-Protect", + driver => "eeprom", + i2c_addrs => [0x50..0x57], + i2c_detect => sub { eeprom_detect 2, @_ }, + }, { name => "LTC1710", driver => "ltc1710", @@ -3672,7 +3678,8 @@ sub ite_alias_detect return 1; } -# $_[0]: Chip to detect (0 = SPD EEPROM, 1 = Sony Vaio EEPROM) +# $_[0]: Chip to detect (0 = SPD EEPROM, 1 = Sony Vaio EEPROM +# 2 = SPD EEPROM with Software Write Protect) # $_[1]: A reference to the file descriptor to access this chip # $_[2]: Address # Returns: 8 for a memory eeprom, 4 to 9 for a Sony Vaio eeprom, @@ -3687,17 +3694,37 @@ sub ite_alias_detect sub eeprom_detect { my ($chip,$file,$addr) = @_; + my $checksum = 0; # Check the checksum for validity (works for most DIMMs and RIMMs) - my $checksum = 0; - for (my $i = 0; $i <= 62; $i ++) { - $checksum += i2c_smbus_read_byte_data($file,$i); + if ($chip != 1) { + for (my $i = 0; $i <= 62; $i ++) { + $checksum += i2c_smbus_read_byte_data($file,$i); + } + $checksum &= 255; + $checksum -= i2c_smbus_read_byte_data($file,63); + } + if ($chip == 0) { + if($checksum == 0) { + return 8; + } else { + return 1; + } + } + if ($chip == 2) { + # check for 'shadow' write-protect register at 0x30-37 + i2c_set_slave_addr($file,$addr - 0x20); + if(i2c_smbus_write_quick($file,$SMBUS_WRITE) >= 0 && + i2c_smbus_read_byte_data($file,0x80) == -1) { + if($checksum == 0) { + return (9, $addr - 0x20); + } else { + return (2, $addr - 0x20); + } + } } - $checksum &= 255; - return 8 - if $chip == 0 and i2c_smbus_read_byte_data($file,63) == $checksum; - # Look for a Sony Vaio EEPROM + # Look for a Sony Vaio EEPROM ($chip == 1) my $vaioconf = 1; $vaioconf += 4 if i2c_smbus_read_byte_data($file,0x80) == 0x50 @@ -3718,14 +3745,9 @@ sub eeprom_detect if $vaioconf > 9; if ($vaioconf > 1) { - return if $chip != 1; return $vaioconf; } - - # Even if all tests fail, it still may be an eeprom - return if $chip != 0; - # Default to SPD EEPROM - return 1; + return; } # $_[0]: A reference to the file descriptor to access this chip.