Changes in boot/arch/ppc32/src/asm.S [0dd8c29:b372015] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ppc32/src/asm.S
r0dd8c29 rb372015 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 … … 247 293 lwz r31, 4(r3) # r31 = memory size 248 294 249 lis r29, 0x0002 250 cmpw r31, r29 251 blt no_bat # less than 128 KB -> no BAT 252 253 li r29, 18 254 srw r31, r31, r29 # r31 = total >> 18 255 256 # create Block Length mask by replicating 257 # the leading logical one 14 times 258 259 li r29, 14 260 mtctr r31 261 li r29, 1 262 263 bat_mask: 264 srw r30, r31, r29 # r30 = mask >> 1 265 or r31, r31, r30 # mask = mask | r30 266 267 bdnz bat_mask 268 269 andi. r31, r31, 0x07ff # mask = mask & 0x07ff (BAT can map up to 256 MB) 270 271 li r29, 2 272 slw r31, r31, r29 # mask = mask << 2 273 ori r31, r31, 0x0002 # mask = mask | 0x0002 (priviledged access only) 274 275 lis r29, 0x8000 276 or r29, r29, r31 277 278 lis r30, 0x0000 279 ori r30, r30, 0x0002 280 281 mtspr ibat0u, r29 282 mtspr ibat0l, r30 283 284 mtspr dbat0u, r29 285 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 286 395 287 396 no_bat:
Note:
See TracChangeset
for help on using the changeset viewer.