1/* 2 * BK Id: SCCS/s.misc.S 1.6 05/18/01 15:17:15 cort 3 */ 4/* 5 * Copyright (C) Paul Mackerras 1997. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 10 * 2 of the License, or (at your option) any later version. 11 */ 12 .text 13 14/* 15 * Use the BAT3 registers to map the 1st 8MB of RAM to 16 * the address given as the 1st argument. 17 */ 18 .globl setup_bats 19setup_bats: 20 mfpvr 5 21 rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */ 22 cmpi 0,5,1 23 li 0,0 24 bne 4f 25 mtibatl 3,0 /* invalidate BAT first */ 26 ori 3,3,4 /* set up BAT registers for 601 */ 27 li 4,0x7f 28 mtibatu 3,3 29 mtibatl 3,4 30 b 5f 314: mtdbatu 3,0 /* invalidate BATs first */ 32 mtibatu 3,0 33 ori 3,3,0xff /* set up BAT registers for 604 */ 34 li 4,2 35 mtdbatl 3,4 36 mtdbatu 3,3 37 mtibatl 3,4 38 mtibatu 3,3 395: sync 40 isync 41 blr 42 43/* 44 * Flush the dcache and invalidate the icache for a range of addresses. 45 * 46 * flush_cache(addr, len) 47 */ 48 .global flush_cache 49flush_cache: 50 addi 4,4,0x1f /* len = (len + 0x1f) / 0x20 */ 51 rlwinm. 4,4,27,5,31 52 mtctr 4 53 beqlr 541: dcbf 0,3 55 icbi 0,3 56 addi 3,3,0x20 57 bdnz 1b 58 sync 59 isync 60 blr 61