xref: /openbmc/linux/arch/sparc/lib/NG4copy_to_user.S (revision ae2c6ca64118b934ef85f66adb03d5bbfdd57201)
1*ae2c6ca6SDavid S. Miller/* NG4copy_to_user.S: Niagara-4 optimized copy to userspace.
2*ae2c6ca6SDavid S. Miller *
3*ae2c6ca6SDavid S. Miller * Copyright (C) 2012 David S. Miller (davem@davemloft.net)
4*ae2c6ca6SDavid S. Miller */
5*ae2c6ca6SDavid S. Miller
6*ae2c6ca6SDavid S. Miller#define EX_ST(x)		\
7*ae2c6ca6SDavid S. Miller98:	x;			\
8*ae2c6ca6SDavid S. Miller	.section __ex_table,"a";\
9*ae2c6ca6SDavid S. Miller	.align 4;		\
10*ae2c6ca6SDavid S. Miller	.word 98b, __retl_one_asi;\
11*ae2c6ca6SDavid S. Miller	.text;			\
12*ae2c6ca6SDavid S. Miller	.align 4;
13*ae2c6ca6SDavid S. Miller
14*ae2c6ca6SDavid S. Miller#ifndef ASI_AIUS
15*ae2c6ca6SDavid S. Miller#define ASI_AIUS	0x11
16*ae2c6ca6SDavid S. Miller#endif
17*ae2c6ca6SDavid S. Miller
18*ae2c6ca6SDavid S. Miller#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS
19*ae2c6ca6SDavid S. Miller#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23
20*ae2c6ca6SDavid S. Miller#endif
21*ae2c6ca6SDavid S. Miller
22*ae2c6ca6SDavid S. Miller#define FUNC_NAME		NG4copy_to_user
23*ae2c6ca6SDavid S. Miller#define STORE(type,src,addr)	type##a src, [addr] %asi
24*ae2c6ca6SDavid S. Miller#define STORE_ASI		ASI_BLK_INIT_QUAD_LDD_AIUS
25*ae2c6ca6SDavid S. Miller#define EX_RETVAL(x)		0
26*ae2c6ca6SDavid S. Miller
27*ae2c6ca6SDavid S. Miller#ifdef __KERNEL__
28*ae2c6ca6SDavid S. Miller	/* Writing to %asi is _expensive_ so we hardcode it.
29*ae2c6ca6SDavid S. Miller	 * Reading %asi to check for KERNEL_DS is comparatively
30*ae2c6ca6SDavid S. Miller	 * cheap.
31*ae2c6ca6SDavid S. Miller	 */
32*ae2c6ca6SDavid S. Miller#define PREAMBLE					\
33*ae2c6ca6SDavid S. Miller	rd		%asi, %g1;			\
34*ae2c6ca6SDavid S. Miller	cmp		%g1, ASI_AIUS;			\
35*ae2c6ca6SDavid S. Miller	bne,pn		%icc, ___copy_in_user;		\
36*ae2c6ca6SDavid S. Miller	 nop
37*ae2c6ca6SDavid S. Miller#endif
38*ae2c6ca6SDavid S. Miller
39*ae2c6ca6SDavid S. Miller#include "NG4memcpy.S"
40