Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Netlogic: Update comments in smpboot.S

No change in logic, comments update and whitespace cleanup.

* A few comments in the file were in assembler style and the rest
int C style, convert all of them to C style.
* Mark workarounds for Ax silicon with a macro XLP_AX_WORKAROUND
* Whitespace fixes - use tabs consistently
* rename __config_lsu macro to xlp_config_lsu

Signed-off-by: Jayachandran C <jayachandranc@netlogicmicro.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/3749/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Jayachandran C and committed by
Ralf Baechle
cedc8ef8 28a33cbc

+58 -48
+58 -48
arch/mips/netlogic/common/smpboot.S
··· 54 54 XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \ 55 55 SYS_CPU_NONCOHERENT_MODE * 4 56 56 57 - .macro __config_lsu 58 - li t0, LSU_DEFEATURE 59 - mfcr t1, t0 57 + #define XLP_AX_WORKAROUND /* enable Ax silicon workarounds */ 60 58 61 - lui t2, 0x4080 /* Enable Unaligned Access, L2HPE */ 62 - or t1, t1, t2 63 - li t2, ~0xe /* S1RCM */ 59 + /* Enable XLP features and workarounds in the LSU */ 60 + .macro xlp_config_lsu 61 + li t0, LSU_DEFEATURE 62 + mfcr t1, t0 63 + 64 + lui t2, 0x4080 /* Enable Unaligned Access, L2HPE */ 65 + or t1, t1, t2 66 + #ifdef XLP_AX_WORKAROUND 67 + li t2, ~0xe /* S1RCM */ 64 68 and t1, t1, t2 69 + #endif 65 70 mtcr t1, t0 66 71 67 - li t0, SCHED_DEFEATURE 68 - lui t1, 0x0100 /* Experimental: Disable BRU accepting ALU ops */ 69 - mtcr t1, t0 72 + #ifdef XLP_AX_WORKAROUND 73 + li t0, SCHED_DEFEATURE 74 + lui t1, 0x0100 /* Disable BRU accepting ALU ops */ 75 + mtcr t1, t0 76 + #endif 70 77 .endm 71 78 72 79 /* 73 - * The cores can come start when they are woken up. This is also the NMI 74 - * entry, so check that first. 80 + * This is the code that will be copied to the reset entry point for 81 + * XLR and XLP. The XLP cores start here when they are woken up. This 82 + * is also the NMI entry point. 75 83 * 76 - * The data corresponding to reset is stored at RESET_DATA_PHYS location, 77 - * this will have the thread mask (used when core is woken up) and the 78 - * current NMI handler in case we reached here for an NMI. 84 + * The data corresponding to reset/NMI is stored at RESET_DATA_PHYS 85 + * location, this will have the thread mask (used when core is woken up) 86 + * and the current NMI handler in case we reached here for an NMI. 79 87 * 80 88 * When a core or thread is newly woken up, it loops in a 'wait'. When 81 89 * the CPU really needs waking up, we send an NMI to it, with the NMI ··· 97 89 FEXPORT(nlm_reset_entry) 98 90 dmtc0 k0, $22, 6 99 91 dmtc0 k1, $22, 7 100 - mfc0 k0, CP0_STATUS 101 - li k1, 0x80000 102 - and k1, k0, k1 103 - beqz k1, 1f /* go to real reset entry */ 92 + mfc0 k0, CP0_STATUS 93 + li k1, 0x80000 94 + and k1, k0, k1 95 + beqz k1, 1f /* go to real reset entry */ 104 96 nop 105 - li k1, CKSEG1ADDR(RESET_DATA_PHYS) /* NMI */ 97 + li k1, CKSEG1ADDR(RESET_DATA_PHYS) /* NMI */ 106 98 ld k0, BOOT_NMI_HANDLER(k1) 107 99 jr k0 108 100 nop ··· 122 114 li t2, SYS_CPU_COHERENT_BASE(0) 123 115 add t2, t2, t3 /* t2 <- SYS offset for node */ 124 116 lw t1, 0(t2) 125 - and t1, t1, t0 126 - sw t1, 0(t2) 117 + and t1, t1, t0 118 + sw t1, 0(t2) 127 119 128 120 /* read back to ensure complete */ 129 - lw t1, 0(t2) 121 + lw t1, 0(t2) 130 122 sync 131 123 132 124 /* Configure LSU on Non-0 Cores. */ 133 - __config_lsu 125 + xlp_config_lsu 126 + /* FALL THROUGH */ 134 127 135 128 /* 136 129 * Wake up sibling threads from the initial thread in 137 130 * a core. 138 131 */ 139 132 EXPORT(nlm_boot_siblings) 133 + /* Enable hw threads by writing to MAP_THREADMODE of the core */ 140 134 li t0, CKSEG1ADDR(RESET_DATA_PHYS) 141 135 lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ 142 136 li t0, ((CPU_BLOCKID_MAP << 8) | MAP_THREADMODE) ··· 149 139 /* 150 140 * The new hardware thread starts at the next instruction 151 141 * For all the cases other than core 0 thread 0, we will 152 - * jump to the secondary wait function. 153 - */ 142 + * jump to the secondary wait function. 143 + */ 154 144 mfc0 v0, CP0_EBASE, 1 155 145 andi v0, 0x7f /* v0 <- node/core */ 156 146 157 - #if 1 158 - /* A0 errata - Write MMU_SETUP after changing thread mode register. */ 147 + /* Init MMU in the first thread after changing THREAD_MODE 148 + * register (Ax Errata?) 149 + */ 159 150 andi v1, v0, 0x3 /* v1 <- thread id */ 160 151 bnez v1, 2f 161 152 nop ··· 165 154 li t1, 0 166 155 mtcr t1, t0 167 156 ehb 168 - #endif 169 157 170 - 2: beqz v0, 4f 158 + 2: beqz v0, 4f /* boot cpu (cpuid == 0)? */ 171 159 nop 172 160 173 161 /* setup status reg */ ··· 193 183 * For the boot CPU, we have to restore registers and 194 184 * return 195 185 */ 196 - 4: dmfc0 t0, $4, 2 /* restore SP from UserLocal */ 186 + 4: dmfc0 t0, $4, 2 /* restore SP from UserLocal */ 197 187 li t1, 0xfadebeef 198 - dmtc0 t1, $4, 2 /* restore SP from UserLocal */ 188 + dmtc0 t1, $4, 2 /* restore SP from UserLocal */ 199 189 PTR_SUBU sp, t0, PT_SIZE 200 190 RESTORE_ALL 201 191 jr ra ··· 203 193 EXPORT(nlm_reset_entry_end) 204 194 205 195 FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ 206 - __config_lsu 196 + xlp_config_lsu 207 197 dmtc0 sp, $4, 2 /* SP saved in UserLocal */ 208 198 SAVE_ALL 209 199 sync ··· 244 234 */ 245 235 __CPUINIT 246 236 NESTED(nlm_rmiboot_preboot, 16, sp) 247 - mfc0 t0, $15, 1 # read ebase 248 - andi t0, 0x1f # t0 has the processor_id() 249 - andi t2, t0, 0x3 # thread no 250 - sll t0, 2 # offset in cpu array 237 + mfc0 t0, $15, 1 /* read ebase */ 238 + andi t0, 0x1f /* t0 has the processor_id() */ 239 + andi t2, t0, 0x3 /* thread num */ 240 + sll t0, 2 /* offset in cpu array */ 251 241 252 - PTR_LA t1, nlm_cpu_ready # mark CPU ready 242 + PTR_LA t1, nlm_cpu_ready /* mark CPU ready */ 253 243 PTR_ADDU t1, t0 254 244 li t3, 1 255 245 sw t3, 0(t1) 256 246 257 - bnez t2, 1f # skip thread programming 258 - nop # for non zero hw threads 247 + bnez t2, 1f /* skip thread programming */ 248 + nop /* for thread id != 0 */ 259 249 260 250 /* 261 - * MMU setup only for first thread in core 251 + * XLR MMU setup only for first thread in core 262 252 */ 263 253 li t0, 0x400 264 254 mfcr t1, t0 265 - li t2, 6 # XLR thread mode mask 255 + li t2, 6 /* XLR thread mode mask */ 266 256 nor t3, t2, zero 267 - and t2, t1, t2 # t2 - current thread mode 257 + and t2, t1, t2 /* t2 - current thread mode */ 268 258 li v0, CKSEG1ADDR(RESET_DATA_PHYS) 269 - lw v1, BOOT_THREAD_MODE(v0) # v1 - new thread mode 259 + lw v1, BOOT_THREAD_MODE(v0) /* v1 - new thread mode */ 270 260 sll v1, 1 271 - beq v1, t2, 1f # same as request value 272 - nop # nothing to do */ 261 + beq v1, t2, 1f /* same as request value */ 262 + nop /* nothing to do */ 273 263 274 - and t2, t1, t3 # mask out old thread mode 275 - or t1, t2, v1 # put in new value 276 - mtcr t1, t0 # update core control 264 + and t2, t1, t3 /* mask out old thread mode */ 265 + or t1, t2, v1 /* put in new value */ 266 + mtcr t1, t0 /* update core control */ 277 267 278 268 1: wait 279 269 j 1b