Added support for fan control on ITE 87XX chips and a mainboard specific configuration for the Gigabyte GA 970A UD3 (both based on a patch from Eric Hokanson).
3 This Source Code Form is subject to the terms of the Mozilla Public
4 License, v. 2.0. If a copy of the MPL was not distributed with this
5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
8 Copyright (C) 2010 Paul Werelds
12 using System.Collections.Generic;
13 using OpenHardwareMonitor.Collections;
15 namespace OpenHardwareMonitor.Hardware.HDD {
17 [NamePrefix(""), RequireSmart(0xAB), RequireSmart(0xB1)]
18 internal class SSDSandforce : AbstractHarddrive {
20 private static readonly IEnumerable<SmartAttribute> smartAttributes =
21 new List<SmartAttribute> {
22 new SmartAttribute(0x01, SmartNames.RawReadErrorRate),
23 new SmartAttribute(0x05, SmartNames.RetiredBlockCount, RawToInt),
24 new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
25 new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
26 new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
27 new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
28 new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
29 new SmartAttribute(0xB1, SmartNames.WearRangeDelta, RawToInt),
30 new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt),
31 new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt),
32 new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
33 new SmartAttribute(0xC2, SmartNames.Temperature,
34 (byte[] raw, byte value, IReadOnlyArray<IParameter> p)
35 => { return value + (p == null ? 0 : p[0].Value); },
36 SensorType.Temperature, 0, true,
37 new[] { new ParameterDescription("Offset [°C]",
38 "Temperature offset of the thermal sensor.\n" +
39 "Temperature = Value + Offset.", 0) }),
40 new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc),
41 new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
42 new SmartAttribute(0xE7, SmartNames.RemainingLife, null,
44 new SmartAttribute(0xE9, SmartNames.ControllerWritesToNAND, RawToInt,
46 new SmartAttribute(0xEA, SmartNames.HostWritesToController, RawToInt,
48 new SmartAttribute(0xF1, SmartNames.HostWrites, RawToInt,
50 new SmartAttribute(0xF2, SmartNames.HostReads, RawToInt,
54 private Sensor writeAmplification;
56 public SSDSandforce(ISmart smart, string name, string firmwareRevision,
57 int index, ISettings settings)
58 : base(smart, name, firmwareRevision, index, smartAttributes, settings)
60 this.writeAmplification = new Sensor("Write Amplification", 1,
61 SensorType.Factor, this, settings);
64 public override void UpdateAdditionalSensors(DriveAttributeValue[] values) {
65 float? controllerWritesToNAND = null;
66 float? hostWritesToController = null;
67 foreach (DriveAttributeValue value in values) {
68 if (value.Identifier == 0xE9)
69 controllerWritesToNAND = RawToInt(value.RawValue, value.AttrValue, null);
71 if (value.Identifier == 0xEA)
72 hostWritesToController = RawToInt(value.RawValue, value.AttrValue, null);
74 if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) {
75 if (hostWritesToController.Value > 0)
76 writeAmplification.Value =
77 controllerWritesToNAND.Value / hostWritesToController.Value;
79 writeAmplification.Value = 0;
80 ActivateSensor(writeAmplification);