Merge branch 'thinkpad-acpi' into release
[linux-2.6] / arch / sparc / lib / NG2copy_to_user.S
1 /* NG2copy_to_user.S: Niagara-2 optimized copy to userspace.
2  *
3  * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4  */
5
6 #define EX_ST(x)                \
7 98:     x;                      \
8         .section .fixup;        \
9         .align 4;               \
10 99:     wr      %g0, ASI_AIUS, %asi;\
11         retl;                   \
12          mov    1, %o0;         \
13         .section __ex_table,"a";\
14         .align 4;               \
15         .word 98b, 99b;         \
16         .text;                  \
17         .align 4;
18
19 #ifndef ASI_AIUS
20 #define ASI_AIUS        0x11
21 #endif
22
23 #ifndef ASI_BLK_AIUS_4V
24 #define ASI_BLK_AIUS_4V 0x17
25 #endif
26
27 #ifndef ASI_BLK_INIT_QUAD_LDD_AIUS
28 #define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23
29 #endif
30
31 #define FUNC_NAME               NG2copy_to_user
32 #define STORE(type,src,addr)    type##a src, [addr] ASI_AIUS
33 #define STORE_ASI               ASI_BLK_INIT_QUAD_LDD_AIUS
34 #define STORE_BLK(src,addr)     stda src, [addr] ASI_BLK_AIUS_4V
35 #define EX_RETVAL(x)            0
36
37 #ifdef __KERNEL__
38         /* Writing to %asi is _expensive_ so we hardcode it.
39          * Reading %asi to check for KERNEL_DS is comparatively
40          * cheap.
41          */
42 #define PREAMBLE                                        \
43         rd              %asi, %g1;                      \
44         cmp             %g1, ASI_AIUS;                  \
45         bne,pn          %icc, memcpy_user_stub;         \
46          nop
47 #endif
48
49 #include "NG2memcpy.S"