1 /* $Id: VIS.h,v 1.4 1999/05/25 16:52:50 jj Exp $
2 * VIS.h: High speed copy/clear operations utilizing the UltraSparc
3 * Visual Instruction Set.
5 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright (C) 1996, 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
9 /* VIS code can be used for numerous copy/set operation variants.
10 * It can be made to work in the kernel, one single instance,
11 * for all of memcpy, copy_to_user, and copy_from_user by setting
12 * the ASI src/dest globals correctly. Furthermore it can
13 * be used for kernel-->kernel page copies as well, a hook label
14 * is put in here just for this purpose.
16 * For userland, compiling this without __KERNEL__ defined makes
17 * it work just fine as a generic libc bcopy and memcpy.
18 * If for userland it is compiled with a 32bit gcc (but you need
19 * -Wa,-Av9a), the code will just rely on lower 32bits of
20 * IEU registers, if you compile it with 64bit gcc (ie. define
21 * __sparc_v9__), the code will use full 64bit.
31 #define ASI_AIUS 0x11 /* Secondary, user */
32 #define ASI_BLK_AIUS 0x71 /* Secondary, user, blk ld/st */
33 #define ASI_P 0x80 /* Primary, implicit */
34 #define ASI_S 0x81 /* Secondary, implicit */
35 #define ASI_BLK_COMMIT_P 0xe0 /* Primary, blk store commit */
36 #define ASI_BLK_COMMIT_S 0xe1 /* Secondary, blk store commit */
37 #define ASI_BLK_P 0xf0 /* Primary, blk ld/st */
38 #define ASI_BLK_S 0xf1 /* Secondary, blk ld/st */
42 /* I'm telling you, they really did this chip right.
43 * Perhaps the SunSoft folks should visit some of the
44 * people in Sun Microelectronics and start some brain
45 * cell exchange program...
47 #define ASI_BLK_XOR (ASI_P ^ ASI_BLK_P)
48 /* Well, things get more hairy if we use ASI_AIUS as
49 * USER_DS and ASI_P as KERNEL_DS, we'd reach
50 * commit block stores this way which is not what we want...
52 /* ASI_P->ASI_BLK_P && ASI_AIUS->ASI_BLK_AIUS transitions can be done
53 * as blkasi = asi | ASI_BLK_OR
55 #define ASI_BLK_OR (ASI_BLK_P & ~ASI_P)
56 /* Transition back from ASI_BLK_P->ASI_P && ASI_BLK_AIUS->ASI_AIUS is
58 * asi = blkasi ^ (blkasi >> 3) ^ ASI_BLK_XOR1
60 #define ASI_BLK_XOR1 (ASI_BLK_P ^ (ASI_BLK_P >> 3) ^ ASI_P)
66 #define ASI_SETSRC_BLK wr asi_src, 0, %asi;
67 #define ASI_SETSRC_NOBLK wr asi_src, 0, %asi;
68 #define ASI_SETDST_BLK wr asi_dest, 0, %asi;
69 #define ASI_SETDST_NOBLK wr asi_dest, 0, %asi;
71 #define ASINORMAL %asi
87 #define ASI_SETSRC_BLK
88 #define ASI_SETSRC_NOBLK
89 #define ASI_SETDST_BLK
90 #define ASI_SETDST_NOBLK
91 #define ASI_SETDST_SPECIAL