2 * This file contains miscellaneous low-level functions.
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
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 <asm/processor.h>
21 #if defined(CONFIG_4xx) || defined(CONFIG_8xx)
22 #define CACHE_LINE_SIZE 16
23 #define LG_CACHE_LINE_SIZE 4
24 #define MAX_COPY_PREFETCH 1
26 #define CACHE_LINE_SIZE 32
27 #define LG_CACHE_LINE_SIZE 5
28 #define MAX_COPY_PREFETCH 4
29 #endif /* CONFIG_4xx || CONFIG_8xx */
34 * Clear a page using the dcbz instruction, which doesn't cause any
35 * memory traffic (except to write out any cache lines which get
36 * displaced). This only works on cacheable memory.
39 li r0,4096/CACHE_LINE_SIZE
50 addi r3,r3,CACHE_LINE_SIZE
55 * Copy a whole page. We use the dcbz instruction on the destination
56 * to reduce memory traffic (it eliminates the unnecessary reads of
57 * the destination into cache). This requires that the destination
60 #define COPY_16_BYTES \
76 #if MAX_COPY_PREFETCH > 1
77 li r0,MAX_COPY_PREFETCH
81 addi r11,r11,CACHE_LINE_SIZE
83 #else /* MAX_COPY_PREFETCH == 1 */
85 li r11,CACHE_LINE_SIZE+4
86 #endif /* MAX_COPY_PREFETCH */
87 #endif /* CONFIG_8xx */
89 li r0,4096/CACHE_LINE_SIZE
97 #if CACHE_LINE_SIZE >= 32
99 #if CACHE_LINE_SIZE >= 64
102 #if CACHE_LINE_SIZE >= 128