MIPS: Netlogic: nlm_core_id for xlp9xx
authorJayachandran C <jchandra@broadcom.com>
Wed, 7 Jan 2015 11:28:31 +0000 (16:58 +0530)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 1 Apr 2015 15:21:51 +0000 (17:21 +0200)
XLP9XX has 5 bits that specify the core in the EBASE register. XLP5XX
case added as well for completeness.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8890/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/netlogic/mips-extns.h

index 06f1f75bfa9bf0402ec4e802dfefef7a4de723af..788baf399e693f9fcbbe0838902697e5ad7206af 100644 (file)
@@ -157,7 +157,13 @@ static inline int nlm_nodeid(void)
 
 static inline unsigned int nlm_core_id(void)
 {
-       return (read_c0_ebase() & 0x1c) >> 2;
+       uint32_t prid = read_c0_prid() & PRID_IMP_MASK;
+
+       if ((prid == PRID_IMP_NETLOGIC_XLP9XX) ||
+                       (prid == PRID_IMP_NETLOGIC_XLP5XX))
+               return (read_c0_ebase() & 0x7c) >> 2;
+       else
+               return (read_c0_ebase() & 0x1c) >> 2;
 }
 
 static inline unsigned int nlm_thread_id(void)