[parisc-linux-cvs] absolute accesses in gsc_ functions

Matthew Wilcox willy@ldl.fc.hp.com
Mon, 05 Mar 2001 15:55:09 -0700


Use absolute accesses for gsc_{readl,writel,readq,writeq} instead of
playing with the PSW D-bit.  Manipulating the PSW is _expensive_.

Index: drivers/gsc/gsc.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/gsc/gsc.c,v
retrieving revision 1.19
diff -u -p -r1.19 gsc.c
--- gsc.c	2001/02/26 18:57:10	1.19
+++ gsc.c	2001/03/05 21:56:18
@@ -87,14 +87,11 @@ u16 _gsc_readw(void *addr)
 
 u32 _gsc_readl(void *addr)
 {
-	long flags;
 	u32 ret;
 
 	asm volatile(
-	"	rsm	2,%0
-		ldwx	0(%2),%1
-		mtsm	%0"
-	: "=&r" (flags), "=r" (ret) : "r" (addr) );
+	"	ldwax	0(%1),%0"
+	: "=r" (ret) : "r" (addr) );
 
 	return ret;
 }
@@ -103,12 +100,9 @@ u64 _gsc_readq(void *addr)
 {
 	u64 ret;
 #ifdef __LP64__
-	long flags;
 	asm volatile(
-	"	rsm	2,%0
-		ldd	0(%2),%1
-		mtsm	%0"
-	: "=&r" (flags), "=r" (ret) : "r" (addr) );
+	"	ldda	0(%1),%0"
+	:  "=r" (ret) : "r" (addr) );
 #else
 	/* two reads may have side effects.. */
 	ret = _gsc_readl(addr);
@@ -140,23 +134,17 @@ void _gsc_writew(u16 val, void *addr)
 
 void _gsc_writel(u32 val, void *addr)
 {
-	long flags;
 	asm volatile(
-	"	rsm	2,%0
-		stws	%1,0(%2)
-		mtsm	%0"
-	: "=&r" (flags) :  "r" (val), "r" (addr) );
+	"	stwas	%0,0(%1)"
+	: :  "r" (val), "r" (addr) );
 }
 
 void _gsc_writeq(u64 val, void *addr)
 {
 #ifdef __LP64__
-	long flags;
 	asm volatile(
-	"	rsm	2,%0
-		std	%1,0(%2)
-		mtsm	%0"
-	: "=&r" (flags) :  "r" (val), "r" (addr) );
+	"	stda	%0,0(%1)"
+	: :  "r" (val), "r" (addr) );
 #else
 	/* two writes may have side effects.. */
 	_gsc_writel(val>>32, addr);