diff mbox series

occ: Use major version number while checking the pstate table format

Message ID 1525331294-495-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com
State Superseded
Headers show
Series occ: Use major version number while checking the pstate table format | expand

Commit Message

Shilpasri G Bhat May 3, 2018, 7:08 a.m. UTC
The minor version increments of the pstate table are backward
compatible. The minor version is changed when the pstate table
remains same and the existing reserved bytes are used for pointing
new data. So use only major version number while parsing the pstate
table. This will allow old skiboot to parse the pstate table and
handle minor version updates.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
 hw/occ.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/hw/occ.c b/hw/occ.c
index c89d4d7..c4b61c7 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -66,7 +66,7 @@ 
  *
  * struct occ_pstate_table -	Pstate table layout
  * @valid:			Indicates if data is valid
- * @version:			Layout version
+ * @version:			Layout version [Major/Minor]
  * @v2.throttle:		Reason for limiting the max pstate
  * @v9.occ_role:		OCC role (Master/Slave)
  * @v#.pstate_min:		Minimum pstate ever allowed
@@ -527,11 +527,8 @@  static bool add_cpu_pstate_properties(int *pstate_nom)
 	ultra_turbo_supported = true;
 
 	/* Parse Pmax, Pmin and Pnominal */
-	switch (occ_data->version) {
-	case 0x01:
-		ultra_turbo_supported = false;
-		/* fallthrough */
-	case 0x02:
+	switch (occ_data->version >> 4) {  /* Check major version */
+	case 0:
 		if (proc_gen == proc_gen_p9) {
 			/**
 			 * @fwts-label OCCInvalidVersion02
@@ -544,6 +541,8 @@  static bool add_cpu_pstate_properties(int *pstate_nom)
 				occ_data->version);
 			return false;
 		}
+		if ((occ_data->version & 0xF) == 0x1)
+			ultra_turbo_supported = false;
 		pmin = occ_data->v2.pstate_min;
 		pnom = occ_data->v2.pstate_nom;
 		if (ultra_turbo_supported)
@@ -551,7 +550,7 @@  static bool add_cpu_pstate_properties(int *pstate_nom)
 		else
 			pmax = occ_data->v2.pstate_turbo;
 		break;
-	case 0x90:
+	case 9:
 		if (proc_gen == proc_gen_p8) {
 			/**
 			 * @fwts-label OCCInvalidVersion90