diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-08-08 20:11:39 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-08-08 20:33:45 -0400 |
commit | 6c70b6fc7b6fc321636a014082d9e32333da1f80 (patch) | |
tree | ff0e52bb7ba43b058b7cbb88b952fd268fbe3ad2 /arch/sparc64/lib/GENpage.S | |
parent | 68c9f9fd336dc7e793cecad25f8ac40ccaa7a256 (diff) |
[SPARC64]: Do not assume sun4v chips have load-twin/store-init support.
Check the cpu type in the OBP device tree before committing to
using the optimized Niagara memcpy and memset implementation.
If we don't recognize the cpu type, use a completely generic
version.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/lib/GENpage.S')
-rw-r--r-- | arch/sparc64/lib/GENpage.S | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/arch/sparc64/lib/GENpage.S b/arch/sparc64/lib/GENpage.S new file mode 100644 index 000000000000..2ef9d05f21bc --- /dev/null +++ b/arch/sparc64/lib/GENpage.S | |||
@@ -0,0 +1,77 @@ | |||
1 | /* GENpage.S: Generic clear and copy page. | ||
2 | * | ||
3 | * Copyright (C) 2007 (davem@davemloft.net) | ||
4 | */ | ||
5 | #include <asm/page.h> | ||
6 | |||
7 | .text | ||
8 | .align 32 | ||
9 | |||
10 | GENcopy_user_page: | ||
11 | set PAGE_SIZE, %g7 | ||
12 | 1: ldx [%o1 + 0x00], %o2 | ||
13 | ldx [%o1 + 0x08], %o3 | ||
14 | ldx [%o1 + 0x10], %o4 | ||
15 | ldx [%o1 + 0x18], %o5 | ||
16 | stx %o2, [%o0 + 0x00] | ||
17 | stx %o3, [%o0 + 0x08] | ||
18 | stx %o4, [%o0 + 0x10] | ||
19 | stx %o5, [%o0 + 0x18] | ||
20 | ldx [%o1 + 0x20], %o2 | ||
21 | ldx [%o1 + 0x28], %o3 | ||
22 | ldx [%o1 + 0x30], %o4 | ||
23 | ldx [%o1 + 0x38], %o5 | ||
24 | stx %o2, [%o0 + 0x20] | ||
25 | stx %o3, [%o0 + 0x28] | ||
26 | stx %o4, [%o0 + 0x30] | ||
27 | stx %o5, [%o0 + 0x38] | ||
28 | subcc %g7, 64, %g7 | ||
29 | add %o1, 64, %o1 | ||
30 | bne,pt %xcc, 1b | ||
31 | add %o0, 64, %o0 | ||
32 | retl | ||
33 | nop | ||
34 | |||
35 | GENclear_page: | ||
36 | GENclear_user_page: | ||
37 | set PAGE_SIZE, %g7 | ||
38 | 1: stx %g0, [%o0 + 0x00] | ||
39 | stx %g0, [%o0 + 0x08] | ||
40 | stx %g0, [%o0 + 0x10] | ||
41 | stx %g0, [%o0 + 0x18] | ||
42 | stx %g0, [%o0 + 0x20] | ||
43 | stx %g0, [%o0 + 0x28] | ||
44 | stx %g0, [%o0 + 0x30] | ||
45 | stx %g0, [%o0 + 0x38] | ||
46 | subcc %g7, 64, %g7 | ||
47 | bne,pt %xcc, 1b | ||
48 | add %o0, 64, %o0 | ||
49 | |||
50 | #define BRANCH_ALWAYS 0x10680000 | ||
51 | #define NOP 0x01000000 | ||
52 | #define GEN_DO_PATCH(OLD, NEW) \ | ||
53 | sethi %hi(NEW), %g1; \ | ||
54 | or %g1, %lo(NEW), %g1; \ | ||
55 | sethi %hi(OLD), %g2; \ | ||
56 | or %g2, %lo(OLD), %g2; \ | ||
57 | sub %g1, %g2, %g1; \ | ||
58 | sethi %hi(BRANCH_ALWAYS), %g3; \ | ||
59 | sll %g1, 11, %g1; \ | ||
60 | srl %g1, 11 + 2, %g1; \ | ||
61 | or %g3, %lo(BRANCH_ALWAYS), %g3; \ | ||
62 | or %g3, %g1, %g3; \ | ||
63 | stw %g3, [%g2]; \ | ||
64 | sethi %hi(NOP), %g3; \ | ||
65 | or %g3, %lo(NOP), %g3; \ | ||
66 | stw %g3, [%g2 + 0x4]; \ | ||
67 | flush %g2; | ||
68 | |||
69 | .globl generic_patch_pageops | ||
70 | .type generic_patch_pageops,#function | ||
71 | generic_patch_pageops: | ||
72 | GEN_DO_PATCH(copy_user_page, GENcopy_user_page) | ||
73 | GEN_DO_PATCH(_clear_page, GENclear_page) | ||
74 | GEN_DO_PATCH(clear_user_page, GENclear_user_page) | ||
75 | retl | ||
76 | nop | ||
77 | .size generic_patch_pageops,.-generic_patch_pageops | ||