Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / ia64 / sn / kernel / sn2 / ptc_deadlock.S
index 4bd638d..bebbcc4 100644 (file)
@@ -3,47 +3,53 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2000-2005 Silicon Graphics, Inc. All rights reserved.
  */
 
-#include <asm/sn/sn2/shub_mmr.h>
+#include <asm/types.h>
+#include <asm/sn/shub_mmr.h>
 
-#define ZEROVAL                0x3f            // "zero" value for outstanding PIO requests
-#define DEADLOCKBIT    SH_PIO_WRITE_STATUS_0_WRITE_DEADLOCK_SHFT
-#define WRITECOUNT     SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_SHFT
-#define ALIAS_OFFSET   (SH_PIO_WRITE_STATUS_0_ALIAS-SH_PIO_WRITE_STATUS_0)
+#define DEADLOCKBIT    SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_SHFT
+#define WRITECOUNTMASK SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK
+#define ALIAS_OFFSET   8
 
 
        .global sn2_ptc_deadlock_recovery_core
        .proc   sn2_ptc_deadlock_recovery_core
 
 sn2_ptc_deadlock_recovery_core:
-       .regstk 5,0,0,0
+       .regstk 6,0,0,0
 
        ptc0     = in0
        data0    = in1
        ptc1     = in2
        data1    = in3
        piowc    = in4
+       zeroval  = in5
        piowcphy = r30
        psrsave  = r2
-       zeroval  = r3
        scr1     = r16
        scr2     = r17
+       mask     = r18
 
 
        extr.u  piowcphy=piowc,0,61;;   // Convert piowc to uncached physical address
        dep     piowcphy=-1,piowcphy,63,1
-
-       mov     zeroval=ZEROVAL         // "zero" value for PIO write count
+       movl    mask=WRITECOUNTMASK
+       mov     r8=r0
 
 1:
+       cmp.ne  p8,p9=r0,ptc1           // Test for shub type (ptc1 non-null on shub1)
+                                       // p8 = 1 if shub1, p9 = 1 if shub2
+
        add     scr2=ALIAS_OFFSET,piowc // Address of WRITE_STATUS alias register 
        mov     scr1=7;;                // Clear DEADLOCK, WRITE_ERROR, MULTI_WRITE_ERROR
-       st8.rel [scr2]=scr1;;
+(p8)   st8.rel [scr2]=scr1;;
+(p9)   ld8.acq scr1=[scr2];;
 
 5:     ld8.acq scr1=[piowc];;          // Wait for PIOs to complete.
-       extr.u  scr2=scr1,WRITECOUNT,7;;// PIO count
+       hint    @pause
+       and     scr2=scr1,mask;;        // mask of writecount bits
        cmp.ne  p6,p0=zeroval,scr2
 (p6)   br.cond.sptk 5b
        
@@ -57,16 +63,19 @@ sn2_ptc_deadlock_recovery_core:
        st8.rel [ptc0]=data0            // Write PTC0 & wait for completion.
 
 5:     ld8.acq scr1=[piowcphy];;       // Wait for PIOs to complete.
-       extr.u  scr2=scr1,WRITECOUNT,7;;// PIO count
+       hint    @pause
+       and     scr2=scr1,mask;;        // mask of writecount bits
        cmp.ne  p6,p0=zeroval,scr2
 (p6)   br.cond.sptk 5b;;
 
        tbit.nz p8,p7=scr1,DEADLOCKBIT;;// Test for DEADLOCK
+(p7)   cmp.ne p7,p0=r0,ptc1;;          // Test for non-null ptc1
        
 (p7)   st8.rel [ptc1]=data1;;          // Now write PTC1.
 
 5:     ld8.acq scr1=[piowcphy];;       // Wait for PIOs to complete.
-       extr.u  scr2=scr1,WRITECOUNT,7;;// PIO count
+       hint    @pause
+       and     scr2=scr1,mask;;        // mask of writecount bits
        cmp.ne  p6,p0=zeroval,scr2
 (p6)   br.cond.sptk 5b
        
@@ -76,6 +85,7 @@ sn2_ptc_deadlock_recovery_core:
        srlz.i;;
        ////////////// END   PHYSICAL MODE ////////////////////
 
+(p8)   add     r8=1,r8
 (p8)   br.cond.spnt 1b;;               // Repeat if DEADLOCK occurred.
 
        br.ret.sptk     rp