2011-12-31 17:31:04 +00:00
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the License.
|
|
|
|
|
|
|
|
|
|
The Original Code is the Open Hardware Monitor code.
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Michael Möller <m.moeller@gmx.ch>.
|
2012-01-01 10:14:42 +00:00
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2009-2012
|
2011-12-31 17:31:04 +00:00
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Paul Werelds
|
|
|
|
|
|
|
|
|
|
Alternatively, the contents of this file may be used under the terms of
|
|
|
|
|
either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
|
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
|
in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
|
of those above. If you wish to allow use of your version of this file only
|
|
|
|
|
under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
|
use your version of this file under the terms of the MPL, indicate your
|
|
|
|
|
decision by deleting the provisions above and replace them with the notice
|
|
|
|
|
and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
|
the provisions above, a recipient may use your version of this file under
|
|
|
|
|
the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace OpenHardwareMonitor.Hardware.HDD {
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
2012-02-13 20:34:39 +00:00
|
|
|
|
[NamePrefix(""), RequireSmart(0xAB), RequireSmart(0xB1)]
|
2011-12-31 17:31:04 +00:00
|
|
|
|
internal class SSDSandforce : AbstractHarddrive {
|
|
|
|
|
|
|
|
|
|
private static readonly IEnumerable<SmartAttribute> smartAttributes =
|
|
|
|
|
new List<SmartAttribute> {
|
2012-02-13 21:56:29 +00:00
|
|
|
|
new SmartAttribute(0x01, SmartNames.RawReadErrorRate),
|
|
|
|
|
new SmartAttribute(0x05, SmartNames.RetiredBlockCount, RawToInt),
|
2012-01-02 18:44:19 +00:00
|
|
|
|
new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
|
|
|
|
|
new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
2012-02-13 21:56:29 +00:00
|
|
|
|
new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
|
|
|
|
|
new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
|
|
|
|
|
new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
|
|
|
|
|
new SmartAttribute(0xB1, SmartNames.WearRangeDelta, RawToInt),
|
|
|
|
|
new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt),
|
|
|
|
|
new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt),
|
|
|
|
|
new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
|
2012-02-14 23:07:55 +00:00
|
|
|
|
new SmartAttribute(0xC2, SmartNames.Temperature, (byte[] raw, byte value)
|
|
|
|
|
=> { return value; }, SensorType.Temperature, 0, true),
|
2012-01-02 18:44:19 +00:00
|
|
|
|
new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc),
|
2012-02-13 21:56:29 +00:00
|
|
|
|
new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
|
|
|
|
|
new SmartAttribute(0xE7, SmartNames.RemainingLife, null,
|
|
|
|
|
SensorType.Level, 0),
|
|
|
|
|
new SmartAttribute(0xE9, SmartNames.ControllerWritesToNAND, RawToInt,
|
2011-12-31 17:31:04 +00:00
|
|
|
|
SensorType.Data, 0),
|
2012-02-13 21:56:29 +00:00
|
|
|
|
new SmartAttribute(0xEA, SmartNames.HostWritesToController, RawToInt,
|
|
|
|
|
SensorType.Data, 1),
|
|
|
|
|
new SmartAttribute(0xF1, SmartNames.HostWrites, RawToInt,
|
|
|
|
|
SensorType.Data, 1),
|
|
|
|
|
new SmartAttribute(0xF2, SmartNames.HostReads, RawToInt,
|
|
|
|
|
SensorType.Data, 2)
|
2011-12-31 17:31:04 +00:00
|
|
|
|
};
|
|
|
|
|
|
2012-02-13 21:56:29 +00:00
|
|
|
|
private Sensor writeAmplification;
|
|
|
|
|
|
2012-01-01 10:14:42 +00:00
|
|
|
|
public SSDSandforce(ISmart smart, string name, string firmwareRevision,
|
|
|
|
|
int index, ISettings settings)
|
|
|
|
|
: base(smart, name, firmwareRevision, index, smartAttributes, settings)
|
2012-02-13 21:56:29 +00:00
|
|
|
|
{
|
|
|
|
|
this.writeAmplification = new Sensor("Write Amplification", 1,
|
2012-02-14 23:07:55 +00:00
|
|
|
|
SensorType.Factor, this, settings);
|
2012-02-13 21:56:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void UpdateAdditionalSensors(DriveAttributeValue[] values) {
|
|
|
|
|
float? controllerWritesToNAND = null;
|
|
|
|
|
float? hostWritesToController = null;
|
|
|
|
|
foreach (DriveAttributeValue value in values) {
|
|
|
|
|
if (value.Identifier == 0xE9)
|
|
|
|
|
controllerWritesToNAND = RawToInt(value.RawValue, value.AttrValue);
|
|
|
|
|
|
|
|
|
|
if (value.Identifier == 0xEA)
|
|
|
|
|
hostWritesToController = RawToInt(value.RawValue, value.AttrValue);
|
|
|
|
|
}
|
|
|
|
|
if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) {
|
2012-02-22 23:36:26 +00:00
|
|
|
|
if (hostWritesToController.Value > 0)
|
|
|
|
|
writeAmplification.Value =
|
|
|
|
|
controllerWritesToNAND.Value / hostWritesToController.Value;
|
|
|
|
|
else
|
|
|
|
|
writeAmplification.Value = 0;
|
2012-02-13 21:56:29 +00:00
|
|
|
|
ActivateSensor(writeAmplification);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-12-31 17:31:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|