|
|
1.1 root 1: /******************************************************************************
2: * Copyright (c) 2004, 2008 IBM Corporation
3: * All rights reserved.
4: * This program and the accompanying materials
5: * are made available under the terms of the BSD License
6: * which accompanies this distribution, and is available at
7: * http://www.opensource.org/licenses/bsd-license.php
8: *
9: * Contributors:
10: * IBM Corporation - initial implementation
11: *****************************************************************************/
12:
13: #ifndef __CPU_H
14: #define __CPU_H
15:
16: /* Used in boot_abort.S, will need something better for KVM */
17: #define HSPRG0 304
18:
19: /* XXX FIXME: Can be more efficient, no dcbst nor loop needed on P7 */
20: /* This macro uses r0 */
21: #define FLUSH_CACHE(r, n) add n, n, r; \
22: addi n, n, 127; \
23: rlwinm r, r, 0,0,24; \
24: rlwinm n, n, 0,0,24; \
25: sub n, n, r; \
26: srwi n, n, 7; \
27: mtctr n; \
28: 0: dcbst 0, r; \
29: sync; \
30: icbi 0, r; \
31: sync; \
32: isync; \
33: addi r, r, 128; \
34: bdnz 0b;
35:
36: #ifndef __ASSEMBLER__
37: #define STRINGIFY(x...) #x
38: #define EXPAND(x) STRINGIFY(x)
39:
40: static inline void flush_cache(void* r, long n)
41: {
42: asm volatile(EXPAND(FLUSH_CACHE(%0, %1))
43: : "+r"(r), "+r"(n)
44: :: "memory", "cc", "r0", "ctr");
45: }
46:
47:
48: #endif /* __ASSEMBLER__ */
49:
50: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.