Blob Blame History Raw
From 9faf09f9851fafd50b96b59d7eac77fcd1b641d7 Mon Sep 17 00:00:00 2001
From: Chandni Verma <chandni@linux.vnet.ibm.com>
Date: Thu, 20 Oct 2016 14:23:50 +0530
Subject: [PATCH 23/43] devtree: Fix physical ID info for CPU nodes

'reg' property contains processor core id. Use this info to fill
processor physical ID. This is useful to map processor core to
sysfs entry in cpufreq.cc code.

Signed-off-by: Chandni Verma <chandni@linux.vnet.ibm.com>
[Splited original patch and updated description - Vasant]
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 src/core/device-tree.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
index c60e49c..9c74e5a 100644
--- a/src/core/device-tree.cc
+++ b/src/core/device-tree.cc
@@ -473,6 +473,7 @@ static void scan_devtree_cpu_power(hwNode & core)
   {
     uint32_t l2_key = 0;
     uint32_t version = 0;
+    uint32_t reg;
     string basepath = string(DEVICETREE "/cpus/") + string(namelist[i]->d_name);
     hwNode cpu("cpu", hw::processor);
 
@@ -491,6 +492,9 @@ static void scan_devtree_cpu_power(hwNode & core)
     cpu.setDescription("CPU");
     set_cpu(cpu, currentcpu++, basepath);
 
+    reg = get_u32(basepath + "/reg");
+    cpu.setPhysId(tostring(reg));
+
     version = get_u32(basepath + "/cpu-version");
     if (version != 0)
       cpu.setVersion(tostring(version));
-- 
2.10.2