Changeset 544a2e4 in mainline for boot/arch/ppc32/src/asm.S
- Timestamp:
- 2011-05-30T21:37:43Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7b712b60
- Parents:
- 18ba2e4f (diff), 0743493a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ppc32/src/asm.S
r18ba2e4f r544a2e4 58 58 .endm 59 59 60 .macro BAT_COMPUTE base size mask lower upper 61 # less than 128 KB -> no BAT 62 63 lis \upper, 0x0002 64 cmpw \size, \upper 65 blt no_bat 66 67 # mask = total >> 18 68 69 li \upper, 18 70 srw \mask, \size, \upper 71 72 # create Block Length mask by replicating 73 # the leading logical one 14 times 74 75 li \upper, 14 76 mtctr \mask 77 li \upper, 1 78 79 0: 80 # mask = (mask >> 1) | mask 81 82 srw \lower, \mask, \upper 83 or \mask, \mask, \lower 84 85 bdnz 0b 86 87 # mask = mask & 0x07ff 88 # (BAT can map up to 256 MB) 89 90 andi. \mask, \mask, 0x07ff 91 92 # mask = (mask << 2) | 0x0002 93 # (priviledged access only) 94 95 li \upper, 2 96 slw \mask, \mask, \upper 97 ori \mask, \mask, 0x0002 98 99 lis \upper, (0x8000 + \base) 100 or \upper, \upper, \mask 101 102 lis \lower, \base 103 ori \lower, \lower, 0x0002 104 .endm 105 60 106 .global start 61 107 .global halt … … 243 289 clear_end: 244 290 245 #ifdef CONFIG_BAT246 247 291 # create BAT identity mapping 248 292 249 293 lwz r31, 4(r3) # r31 = memory size 250 294 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 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 288 395 289 396 no_bat: 290 291 #endif292 397 293 398 # flush TLB
Note:
See TracChangeset
for help on using the changeset viewer.