summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2017-01-11 17:33:08 -0600
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-02-02 16:22:00 +1100
commitcdf45901235245a7a8f4bfe3d170d7a0472c7f78 (patch)
treec3ef92fb0fc2f5cc91fae15ad970d8966108b7ab
parente0225ccaf9bd6c8882a2839256d07645737836e4 (diff)
downloadtalos-skiboot-cdf45901235245a7a8f4bfe3d170d7a0472c7f78.tar.gz
talos-skiboot-cdf45901235245a7a8f4bfe3d170d7a0472c7f78.zip
hdata: Fix ibm,pa-features for all CPU types
Hopefully the values are all right ;-) A future TODO is to use some nice macro to make it clearer who is what. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [stewart@linux.vnet.ibm.com: fake PVR_VERS_MAJ, use size_t] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hdata/cpu-common.c62
-rw-r--r--hdata/test/hdata_to_dt.c3
2 files changed, 60 insertions, 5 deletions
diff --git a/hdata/cpu-common.c b/hdata/cpu-common.c
index 528f0082..50c6adc7 100644
--- a/hdata/cpu-common.c
+++ b/hdata/cpu-common.c
@@ -30,8 +30,43 @@ struct dt_node * add_core_common(struct dt_node *cpus,
struct dt_node *cpu;
uint32_t version;
uint64_t freq;
- const uint8_t pa_features[] = {
- 6, 0, 0xf6, 0x3f, 0xc7, 0x00, 0x80, 0xc0 };
+ const uint8_t pa_features_p7[] = {
+ 6, 0,
+ 0xf6, 0x3f, 0xc7, 0x00, 0x80, 0xc0 };
+ const uint8_t pa_features_p7p[] = {
+ 6, 0,
+ 0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xc0 };
+ const uint8_t pa_features_p8[] = {
+ 24, 0,
+ 0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xd0, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
+ };
+ const uint8_t pa_features_p9_dd1[] = {
+ 64, 0,
+ 0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xd0, 0x80, 0x00, /* 0 .. 7 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8 .. 15 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 16 .. 23 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 24 .. 31 */
+ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, /* 32 .. 39 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 40 .. 47 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 48 .. 55 */
+ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, /* 56 .. 63 */
+ };
+ const uint8_t pa_features_p9_dd2[] = {
+ 64, 0,
+ 0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xd0, 0x80, 0x00, /* 0 .. 7 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8 .. 15 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 16 .. 23 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 24 .. 31 */
+ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, /* 32 .. 39 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 40 .. 47 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 48 .. 55 */
+ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 56 .. 63 */
+ };
+
+ const uint8_t *pa_features;
+ size_t pa_features_size;
prlog(PR_INFO, " Cache: I=%u D=%u/%u/%u/%u\n",
be32_to_cpu(cache->icache_size_kb),
@@ -47,20 +82,34 @@ struct dt_node * add_core_common(struct dt_node *cpus,
switch(PVR_TYPE(version)) {
case PVR_TYPE_P7:
name = "PowerPC,POWER7";
+ pa_features = pa_features_p7;
+ pa_features_size = sizeof(pa_features_p7);
break;
case PVR_TYPE_P7P:
name = "PowerPC,POWER7+";
+ pa_features = pa_features_p7p;
+ pa_features_size = sizeof(pa_features_p7p);
break;
case PVR_TYPE_P8E:
case PVR_TYPE_P8:
case PVR_TYPE_P8NVL:
name = "PowerPC,POWER8";
+ pa_features = pa_features_p8;
+ pa_features_size = sizeof(pa_features_p8);
break;
case PVR_TYPE_P9:
name = "PowerPC,POWER9";
+ if (PVR_VERS_MAJ(version) == 1) {
+ pa_features = pa_features_p9_dd1;
+ pa_features_size = sizeof(pa_features_p9_dd1);
+ } else {
+ pa_features = pa_features_p9_dd2;
+ pa_features_size = sizeof(pa_features_p9_dd2);
+ }
break;
default:
name = "PowerPC,Unknown";
+ pa_features = NULL;
}
cpu = dt_new_addr(cpus, name, int_server);
@@ -91,9 +140,12 @@ struct dt_node * add_core_common(struct dt_node *cpus,
0x18, 0x0008, /* 64K seg 16M pages */
0x18, 0x100, 1, 0x18, 0x0000, /* 16M seg 16M pages */
0x22, 0x120, 1, 0x22, 0x0003); /* 16G seg 16G pages */
-
- dt_add_property(cpu, "ibm,pa-features",
- pa_features, sizeof(pa_features));
+
+
+ if (pa_features) {
+ dt_add_property(cpu, "ibm,pa-features",
+ pa_features, pa_features_size);
+ }
dt_add_property_cells(cpu, "ibm,slb-size", 0x20);
dt_add_property_cells(cpu, "ibm,vmx", 0x2);
diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c
index 06f90054..e6108631 100644
--- a/hdata/test/hdata_to_dt.c
+++ b/hdata/test/hdata_to_dt.c
@@ -70,6 +70,9 @@ struct cpu_thread {
struct cpu_thread __boot_cpu, *boot_cpu = &__boot_cpu;
static unsigned long fake_pvr_type = PVR_TYPE_P7;
+// Fake PVR_VERS_MAJ to 1
+#define PVR_VERS_MAJ(v) (1)
+
static inline unsigned long mfspr(unsigned int spr)
{
assert(spr == SPR_PVR);
OpenPOWER on IntegriCloud