Added readingFormat for PXE1410 in IpmbSensor.

Since ADM1278 and PXE1410 has two different format in reading
sensor value. Added a new reading format as linearElevenBit
for PXE1410 with sign extension.

TESTED: Tested in tiogapass and verified the sensor value.

root@tiogapass:~# busctl introspect xyz.openbmc_project.IpmbSensor /xyz/openbmc_project/sensors/current/MB_HSC_OUT_CURR
NAME                                                  TYPE      SIGNATURE RESULT/VALUE                             FLAGS
org.freedesktop.DBus.Introspectable                   interface -         -                                        -
.Introspect                                           method    -         s                                        -
org.freedesktop.DBus.Peer                             interface -         -                                        -
.GetMachineId                                         method    -         s                                        -
.Ping                                                 method    -         -                                        -
org.freedesktop.DBus.Properties                       interface -         -                                        -
.Get                                                  method    ss        v                                        -
.GetAll                                               method    s         a{sv}                                    -
.Set                                                  method    ssv       -                                        -
.PropertiesChanged                                    signal    sa{sv}as  -                                        -
xyz.openbmc_project.Association.Definitions           interface -         -                                        -
.Associations                                         property  a(sss)    1 "chassis" "all_sensors" "/xyz/openbmc… emits-change
xyz.openbmc_project.Sensor.Threshold.Critical         interface -         -                                        -
.CriticalAlarmHigh                                    property  b         false                                    emits-change
.CriticalHigh                                         property  d         52.8                                     emits-change writable
xyz.openbmc_project.Sensor.Value                      interface -         -                                        -
.MaxValue                                             property  d         255                                      emits-change
.MinValue                                             property  d         0                                        emits-change
.Value                                                property  d         7.6649                                   emits-change writable
xyz.openbmc_project.State.Decorator.Availability      interface -         -                                        -
.Available                                            property  b         true                                     emits-change writable
xyz.openbmc_project.State.Decorator.OperationalStatus interface -         -                                        -
.Functional                                           property  b         true                                     emits-change

Signed-off-by: Jayashree Dhanapal <jayashree-d@hcl.com>
Change-Id: I1348f09f4e93690e1303601d6bc2d1678e7b30b2
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index 0f35353..2d40dc3 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -155,7 +155,7 @@
         initData = {0x57,          0x01, 0x00, 0x14, hostSMbusIndex,
                     deviceAddress, 0x00, 0x00, 0x00, 0x00,
                     0x02,          0x00, 0x00, 0x00};
-        readingFormat = ReadingFormat::elevenBit;
+        readingFormat = ReadingFormat::linearElevenBit;
     }
     else if (type == IpmbType::IR38363VR)
     {
@@ -277,9 +277,6 @@
             }
 
             int16_t value = ((data[4] << 8) | data[3]);
-            constexpr const size_t shift = 16 - 11; // 11bit into 16bit
-            value <<= shift;
-            value >>= shift;
             resp = value;
             return true;
         }
@@ -298,6 +295,25 @@
             resp = ((data[4] << 8) | data[3]) >> 3;
             return true;
         }
+        case (ReadingFormat::linearElevenBit):
+        {
+            if (data.size() < 5)
+            {
+                if (!errCount)
+                {
+                    std::cerr << "Invalid data length returned for " << name
+                              << "\n";
+                }
+                return false;
+            }
+
+            int16_t value = ((data[4] << 8) | data[3]);
+            constexpr const size_t shift = 16 - 11; // 11bit into 16bit
+            value <<= shift;
+            value >>= shift;
+            resp = value;
+            return true;
+        }
         default:
             throw std::runtime_error("Invalid reading type");
     }