Skip to contentSkip to conversation

powernow-k8: reorder the PST table to match the ACPI table

PATCH New Mark Langsdorf 1 participant 1 message Jun 15, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powernow-k8: reorder the PST table to match the ACPI table

The PST code in powernow-k8 orders pstate entries in the opposite order from the ACPI code. This can confuse some userspace tools. Get both codes to order pstates in the same way.

powernow-k8.c renamed from powernow-k8.c.orig +7 -3
@@ -590,10 +590,14 @@
 		return -ENOMEM;
 	}
 
+	/*
+	 * Reverse order of table entries to match ACPI entry order,
+	 * since all userspace utilities depend on that.
+	 */
 	for (j = 0; j < data->numps; j++) {
-		powernow_table[j].index = pst[j].fid; /* lower 8 bits */
-		powernow_table[j].index |= (pst[j].vid << 8); /* upper 8 bits */
-		powernow_table[j].frequency = find_khz_freq_from_fid(pst[j].fid);
+		powernow_table[data->numps - j - 1].index = pst[j].fid; /* lower 8 bits */
+		powernow_table[data->numps - j - 1].index |= (pst[j].vid << 8); /* upper 8 bits */
+		powernow_table[data->numps - j - 1].frequency = find_khz_freq_from_fid(pst[j].fid);
 	}
 	powernow_table[data->numps].frequency = CPUFREQ_TABLE_END;
 	powernow_table[data->numps].index = 0;