diff options
-rw-r--r-- | hdata/cpu-common.c | 62 | ||||
-rw-r--r-- | hdata/test/hdata_to_dt.c | 3 |
2 files changed, 60 insertions, 5 deletions
diff --git a/hdata/cpu-common.c b/hdata/cpu-common.c index 528f008..50c6adc 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 06f9005..e610863 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); |