Changes in boot/arch/ppc32/src/asm.S [b372015:a2da43c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ppc32/src/asm.S
rb372015 ra2da43c 56 56 tlbsync 57 57 sync 58 .endm59 60 .macro BAT_COMPUTE base size mask lower upper61 # less than 128 KB -> no BAT62 63 lis \upper, 0x000264 cmpw \size, \upper65 blt no_bat66 67 # mask = total >> 1868 69 li \upper, 1870 srw \mask, \size, \upper71 72 # create Block Length mask by replicating73 # the leading logical one 14 times74 75 li \upper, 1476 mtctr \mask77 li \upper, 178 79 0:80 # mask = (mask >> 1) | mask81 82 srw \lower, \mask, \upper83 or \mask, \mask, \lower84 85 bdnz 0b86 87 # mask = mask & 0x07ff88 # (BAT can map up to 256 MB)89 90 andi. \mask, \mask, 0x07ff91 92 # mask = (mask << 2) | 0x000293 # (priviledged access only)94 95 li \upper, 296 slw \mask, \mask, \upper97 ori \mask, \mask, 0x000298 99 lis \upper, (0x8000 + \base)100 or \upper, \upper, \mask101 102 lis \lower, \base103 ori \lower, \lower, 0x0002104 58 .endm 105 59 … … 289 243 clear_end: 290 244 245 #ifdef CONFIG_BAT 246 291 247 # create BAT identity mapping 292 248 293 249 lwz r31, 4(r3) # r31 = memory size 294 250 295 lis r30, 268435456@h 296 ori r30, r30, 268435456@l # r30 = 256 MB 297 298 # BAT0 299 300 # r29 = min(r31, r30) 301 302 cmpw r31, r30 303 blt bat0_r31 304 305 mr r29, r30 306 b bat0_r30 307 308 bat0_r31: 309 310 mr r29, r31 311 312 bat0_r30: 313 314 BAT_COMPUTE 0x0000 r29 r28 r27 r26 315 mtspr ibat0u, r26 316 mtspr ibat0l, r27 317 318 mtspr dbat0u, r26 319 mtspr dbat0l, r27 320 321 # BAT1 322 323 sub r31, r31, r29 # r31 = r31 - r29 324 325 # r29 = min(r31, r30) 326 327 cmpw r31, r30 328 blt bat1_r31 329 330 mr r29, r30 331 b bat1_r30 332 333 bat1_r31: 334 335 mr r29, r31 336 337 bat1_r30: 338 339 BAT_COMPUTE 0x1000 r29 r28 r27 r26 340 mtspr ibat1u, r26 341 mtspr ibat1l, r27 342 343 mtspr dbat1u, r26 344 mtspr dbat1l, r27 345 346 # BAT2 347 348 sub r31, r31, r29 # r31 = r31 - r29 349 350 # r29 = min(r31, r30) 351 352 cmpw r31, r30 353 blt bat2_r31 354 355 mr r29, r30 356 b bat2_r30 357 358 bat2_r31: 359 360 mr r29, r31 361 362 bat2_r30: 363 364 BAT_COMPUTE 0x2000 r29 r28 r27 r26 365 mtspr ibat2u, r26 366 mtspr ibat2l, r27 367 368 mtspr dbat2u, r26 369 mtspr dbat2l, r27 370 371 # BAT3 372 373 sub r31, r31, r29 # r31 = r31 - r29 374 375 # r29 = min(r31, r30) 376 377 cmpw r31, r30 378 blt bat3_r31 379 380 mr r29, r30 381 b bat3_r30 382 383 bat3_r31: 384 385 mr r29, r31 386 387 bat3_r30: 388 389 BAT_COMPUTE 0x3000 r29 r28 r27 r26 390 mtspr ibat3u, r26 391 mtspr ibat3l, r27 392 393 mtspr dbat3u, r26 394 mtspr dbat3l, r27 251 lis r29, 0x0002 252 cmpw r31, r29 253 blt no_bat # less than 128 KB -> no BAT 254 255 li r29, 18 256 srw r31, r31, r29 # r31 = total >> 18 257 258 # create Block Length mask by replicating 259 # the leading logical one 14 times 260 261 li r29, 14 262 mtctr r31 263 li r29, 1 264 265 bat_mask: 266 srw r30, r31, r29 # r30 = mask >> 1 267 or r31, r31, r30 # mask = mask | r30 268 269 bdnz bat_mask 270 271 andi. r31, r31, 0x07ff # mask = mask & 0x07ff (BAT can map up to 256 MB) 272 273 li r29, 2 274 slw r31, r31, r29 # mask = mask << 2 275 ori r31, r31, 0x0002 # mask = mask | 0x0002 (priviledged access only) 276 277 lis r29, 0x8000 278 or r29, r29, r31 279 280 lis r30, 0x0000 281 ori r30, r30, 0x0002 282 283 mtspr ibat0u, r29 284 mtspr ibat0l, r30 285 286 mtspr dbat0u, r29 287 mtspr dbat0l, r30 395 288 396 289 no_bat: 290 291 #endif 397 292 398 293 # flush TLB
Note:
See TracChangeset
for help on using the changeset viewer.