2 * This file contains miscellaneous low-level functions.
8 * A couple of functions stolen from arch/ppc/kernel/misc.S for UML
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
18 #include <linux/config.h>
19 #include <asm/processor.h>
22 #if defined(CONFIG_4xx) || defined(CONFIG_8xx)
23 #define CACHE_LINE_SIZE 16
24 #define LG_CACHE_LINE_SIZE 4
25 #define MAX_COPY_PREFETCH 1
27 #define CACHE_LINE_SIZE 32
28 #define LG_CACHE_LINE_SIZE 5
29 #define MAX_COPY_PREFETCH 4
30 #endif /* CONFIG_4xx || CONFIG_8xx */
35 * Clear a page using the dcbz instruction, which doesn't cause any
36 * memory traffic (except to write out any cache lines which get
37 * displaced). This only works on cacheable memory.
40 li r0,4096/CACHE_LINE_SIZE
51 addi r3,r3,CACHE_LINE_SIZE
56 * Copy a whole page. We use the dcbz instruction on the destination
57 * to reduce memory traffic (it eliminates the unnecessary reads of
58 * the destination into cache). This requires that the destination
61 #define COPY_16_BYTES \
77 #if MAX_COPY_PREFETCH > 1
78 li r0,MAX_COPY_PREFETCH
82 addi r11,r11,CACHE_LINE_SIZE
84 #else /* MAX_COPY_PREFETCH == 1 */
86 li r11,CACHE_LINE_SIZE+4
87 #endif /* MAX_COPY_PREFETCH */
88 #endif /* CONFIG_8xx */
90 li r0,4096/CACHE_LINE_SIZE
98 #if CACHE_LINE_SIZE >= 32
100 #if CACHE_LINE_SIZE >= 64
103 #if CACHE_LINE_SIZE >= 128