#if defined(CONFIG_CPU_BMIPS5000)
        mfc0    k0, CP0_PRID
        li      k1, PRID_IMP_BMIPS5000
-       andi    k0, 0xff00
+       /* mask with PRID_IMP_BMIPS5000 to cover both variants */
+       andi    k0, PRID_IMP_BMIPS5000
        bne     k0, k1, 1f
 
        /* if we're not on core 0, this must be the SMP boot signal */
 2:
 #endif /* CONFIG_CPU_BMIPS4350 || CONFIG_CPU_BMIPS4380 */
 #if defined(CONFIG_CPU_BMIPS5000)
-       /* set exception vector base */
+       /* mask with PRID_IMP_BMIPS5000 to cover both variants */
        li      k1, PRID_IMP_BMIPS5000
+       andi    k0, PRID_IMP_BMIPS5000
        bne     k0, k1, 3f
 
+       /* set exception vector base */
        la      k0, ebase
        lw      k0, 0(k0)
        mtc0    k0, $15, 1
 #endif /* CONFIG_CPU_BMIPS4380 */
 #if defined(CONFIG_CPU_BMIPS5000)
        li      t1, PRID_IMP_BMIPS5000
+       /* mask with PRID_IMP_BMIPS5000 to cover both variants */
+       andi    t2, PRID_IMP_BMIPS5000
        bne     t2, t1, 2f
 
        mfc0    t0, $22, 5