[Skiboot] [RFC PATCH 1/2] occ: Export per-chip Vid in device tree
Shilpasri G Bhat
shilpa.bhat at linux.vnet.ibm.com
Mon Feb 15 15:13:47 AEDT 2016
Each chip can have a distinctive Voltage identifier, so export this
as a per-chip information so that it can readily consumed for
characterization. This data is exported in newly created 'occ' node
under /ibm,opal/power-mgt node.
Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
---
hw/occ.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/hw/occ.c b/hw/occ.c
index 987d007..93dd7ce 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -243,11 +243,9 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom)
dt_core_max[i] = occ_data->core_max[i];
}
- for( i=0; i < nr_pstates; i++) {
+ for (i = 0; i < nr_pstates; i++) {
dt_id[i] = occ_data->pstates[i].id;
- dt_freq[i] = occ_data->pstates[i].freq_khz/1000;
- dt_vdd[i] = occ_data->pstates[i].vdd;
- dt_vcs[i] = occ_data->pstates[i].vcs;
+ dt_freq[i] = occ_data->pstates[i].freq_khz / 1000;
}
/* Add the device-tree entries */
@@ -255,8 +253,6 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom)
nr_pstates * sizeof(u32));
dt_add_property(power_mgt, "ibm,pstate-frequencies-mhz", dt_freq,
nr_pstates * sizeof(u32));
- dt_add_property(power_mgt, "ibm,pstate-vdds", dt_vdd, nr_pstates);
- dt_add_property(power_mgt, "ibm,pstate-vcss", dt_vcs, nr_pstates);
dt_add_property_cells(power_mgt, "ibm,pstate-min", occ_data->pstate_min);
dt_add_property_cells(power_mgt, "ibm,pstate-nominal", occ_data->pstate_nom);
dt_add_property_cells(power_mgt, "ibm,pstate-max", pmax);
@@ -273,6 +269,30 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom)
/* Return pstate to set for each core */
*pstate_nom = occ_data->pstate_nom;
+
+ for_each_chip(chip) {
+ struct dt_node *occ_node;
+
+ occ_data = chip_occ_data(chip);
+ occ_node = dt_new_addr(power_mgt, "occ", (uint64_t)occ_data);
+ if (!occ_node) {
+ prerror("OCC: Failed to create node /ibm,opal/power-mgt/occ@%lld\n",
+ (uint64_t)occ_data);
+ goto out_free_vcs;
+ }
+
+ for (i = 0; i < nr_pstates; i++) {
+ dt_vdd[i] = occ_data->pstates[i].vdd;
+ dt_vcs[i] = occ_data->pstates[i].vcs;
+ }
+
+ dt_add_property_cells(occ_node, "ibm,chip-id", chip->id);
+ dt_add_property(occ_node, "ibm,pstate-vdds", dt_vdd,
+ nr_pstates);
+ dt_add_property(occ_node, "ibm,pstate-vcss", dt_vcs,
+ nr_pstates);
+ }
+
rc = true;
out_free_vcs:
--
1.9.3
More information about the Skiboot
mailing list