Add effectiveModel and Step to cpu property

Add effectiveModel and Step to cpu property. And correct the
effectiveFamily of cpu property.

Reference:
https://en.wikipedia.org/wiki/CPUID#EAX=1:_Processor_Info_and_Feature_Bits

Change-Id: I4d0ced7081003f41c7e7df13c29089b2f89a7721
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
diff --git a/src/cpu.cpp b/src/cpu.cpp
index 4ae98b9..7c10a09 100644
--- a/src/cpu.cpp
+++ b/src/cpu.cpp
@@ -159,8 +159,52 @@
     // this class is for type CPU  //offset 5h
     family(cpuInfo->family, cpuInfo->family2); // offset 6h and 28h
     manufacturer(cpuInfo->manufacturer, cpuInfo->length,
-                 dataIn);                               // offset 7h
-    id(cpuInfo->id);                                    // offset 8h
+                 dataIn); // offset 7h
+    id(cpuInfo->id);      // offset 8h
+
+    // Step, EffectiveFamily, EffectiveModel computation for Intel processors.
+    std::map<uint8_t, const char*>::const_iterator it =
+        familyTable.find(cpuInfo->family);
+    if (it != familyTable.end())
+    {
+        std::string familyStr = it->second;
+        if ((familyStr.find(" Xeon ") != std::string::npos) ||
+            (familyStr.find(" Intel ") != std::string::npos))
+        {
+            // Processor ID field
+            // SteppinID:   4;
+            // Model:       4;
+            // Family:      4;
+            // Type:        2;
+            // Reserved1:   2;
+            // XModel:      4;
+            // XFamily:     8;
+            // Reserved2:   4;
+            uint16_t cpuStep = cpuInfo->id & 0xf;
+            uint16_t cpuModel = (cpuInfo->id & 0xf0) >> 4;
+            uint16_t cpuFamily = (cpuInfo->id & 0xf00) >> 8;
+            uint16_t cpuXModel = (cpuInfo->id & 0xf0000) >> 16;
+            uint16_t cpuXFamily = (cpuInfo->id & 0xff00000) >> 20;
+            step(cpuStep);
+            if (cpuFamily == 0xf)
+            {
+                effectiveFamily(cpuXFamily + cpuFamily);
+            }
+            else
+            {
+                effectiveFamily(cpuFamily);
+            }
+            if (cpuFamily == 0x6 || cpuFamily == 0xf)
+            {
+                effectiveModel((cpuXModel << 4) | cpuModel);
+            }
+            else
+            {
+                effectiveModel(cpuModel);
+            }
+        }
+    }
+
     version(cpuInfo->version, cpuInfo->length, dataIn); // offset 10h
     maxSpeedInMhz(cpuInfo->maxSpeed);                   // offset 14h
     serialNumber(cpuInfo->serialNum, cpuInfo->length,