ptc_deadlock.S 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  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
  4. * for more details.
  5. *
  6. * Copyright (C) 2000-2004 Silicon Graphics, Inc. All rights reserved.
  7. */
  8. #include <asm/types.h>
  9. #include <asm/sn/shub_mmr.h>
  10. #define DEADLOCKBIT SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_SHFT
  11. #define WRITECOUNTMASK SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK
  12. #define ALIAS_OFFSET (SH1_PIO_WRITE_STATUS_0_ALIAS-SH1_PIO_WRITE_STATUS_0)
  13. .global sn2_ptc_deadlock_recovery_core
  14. .proc sn2_ptc_deadlock_recovery_core
  15. sn2_ptc_deadlock_recovery_core:
  16. .regstk 6,0,0,0
  17. ptc0 = in0
  18. data0 = in1
  19. ptc1 = in2
  20. data1 = in3
  21. piowc = in4
  22. zeroval = in5
  23. piowcphy = r30
  24. psrsave = r2
  25. scr1 = r16
  26. scr2 = r17
  27. mask = r18
  28. extr.u piowcphy=piowc,0,61;; // Convert piowc to uncached physical address
  29. dep piowcphy=-1,piowcphy,63,1
  30. movl mask=WRITECOUNTMASK
  31. 1:
  32. add scr2=ALIAS_OFFSET,piowc // Address of WRITE_STATUS alias register
  33. mov scr1=7;; // Clear DEADLOCK, WRITE_ERROR, MULTI_WRITE_ERROR
  34. st8.rel [scr2]=scr1;;
  35. 5: ld8.acq scr1=[piowc];; // Wait for PIOs to complete.
  36. and scr2=scr1,mask;; // mask of writecount bits
  37. cmp.ne p6,p0=zeroval,scr2
  38. (p6) br.cond.sptk 5b
  39. ////////////// BEGIN PHYSICAL MODE ////////////////////
  40. mov psrsave=psr // Disable IC (no PMIs)
  41. rsm psr.i | psr.dt | psr.ic;;
  42. srlz.i;;
  43. st8.rel [ptc0]=data0 // Write PTC0 & wait for completion.
  44. 5: ld8.acq scr1=[piowcphy];; // Wait for PIOs to complete.
  45. and scr2=scr1,mask;; // mask of writecount bits
  46. cmp.ne p6,p0=zeroval,scr2
  47. (p6) br.cond.sptk 5b;;
  48. tbit.nz p8,p7=scr1,DEADLOCKBIT;;// Test for DEADLOCK
  49. (p7) cmp.ne p7,p0=r0,ptc1;; // Test for non-null ptc1
  50. (p7) st8.rel [ptc1]=data1;; // Now write PTC1.
  51. 5: ld8.acq scr1=[piowcphy];; // Wait for PIOs to complete.
  52. and scr2=scr1,mask;; // mask of writecount bits
  53. cmp.ne p6,p0=zeroval,scr2
  54. (p6) br.cond.sptk 5b
  55. tbit.nz p8,p0=scr1,DEADLOCKBIT;;// Test for DEADLOCK
  56. mov psr.l=psrsave;; // Reenable IC
  57. srlz.i;;
  58. ////////////// END PHYSICAL MODE ////////////////////
  59. (p8) br.cond.spnt 1b;; // Repeat if DEADLOCK occurred.
  60. br.ret.sptk rp
  61. .endp sn2_ptc_deadlock_recovery_core