2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2000-2004 Silicon Graphics, Inc. All rights reserved.
9 #include <asm/sn/shub_mmr.h>
11 #define DEADLOCKBIT SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_SHFT
12 #define WRITECOUNTMASK SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK
13 #define ALIAS_OFFSET (SH1_PIO_WRITE_STATUS_0_ALIAS-SH1_PIO_WRITE_STATUS_0)
16 .global sn2_ptc_deadlock_recovery_core
17 .proc sn2_ptc_deadlock_recovery_core
19 sn2_ptc_deadlock_recovery_core:
35 extr.u piowcphy=piowc,0,61;; // Convert piowc to uncached physical address
36 dep piowcphy=-1,piowcphy,63,1
37 movl mask=WRITECOUNTMASK
40 add scr2=ALIAS_OFFSET,piowc // Address of WRITE_STATUS alias register
41 mov scr1=7;; // Clear DEADLOCK, WRITE_ERROR, MULTI_WRITE_ERROR
44 5: ld8.acq scr1=[piowc];; // Wait for PIOs to complete.
45 and scr2=scr1,mask;; // mask of writecount bits
46 cmp.ne p6,p0=zeroval,scr2
51 ////////////// BEGIN PHYSICAL MODE ////////////////////
52 mov psrsave=psr // Disable IC (no PMIs)
53 rsm psr.i | psr.dt | psr.ic;;
56 st8.rel [ptc0]=data0 // Write PTC0 & wait for completion.
58 5: ld8.acq scr1=[piowcphy];; // Wait for PIOs to complete.
59 and scr2=scr1,mask;; // mask of writecount bits
60 cmp.ne p6,p0=zeroval,scr2
61 (p6) br.cond.sptk 5b;;
63 tbit.nz p8,p7=scr1,DEADLOCKBIT;;// Test for DEADLOCK
64 (p7) cmp.ne p7,p0=r0,ptc1;; // Test for non-null ptc1
66 (p7) st8.rel [ptc1]=data1;; // Now write PTC1.
68 5: ld8.acq scr1=[piowcphy];; // Wait for PIOs to complete.
69 and scr2=scr1,mask;; // mask of writecount bits
70 cmp.ne p6,p0=zeroval,scr2
73 tbit.nz p8,p0=scr1,DEADLOCKBIT;;// Test for DEADLOCK
75 mov psr.l=psrsave;; // Reenable IC
77 ////////////// END PHYSICAL MODE ////////////////////
79 (p8) br.cond.spnt 1b;; // Repeat if DEADLOCK occurred.
82 .endp sn2_ptc_deadlock_recovery_core