ptc_deadlock.S 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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-2005 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 8
  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. mov r8=r0
  32. 1:
  33. cmp.ne p8,p9=r0,ptc1 // Test for shub type (ptc1 non-null on shub1)
  34. // p8 = 1 if shub1, p9 = 1 if shub2
  35. add scr2=ALIAS_OFFSET,piowc // Address of WRITE_STATUS alias register
  36. mov scr1=7;; // Clear DEADLOCK, WRITE_ERROR, MULTI_WRITE_ERROR
  37. (p8) st8.rel [scr2]=scr1;;
  38. (p9) ld8.acq scr1=[scr2];;
  39. 5: ld8.acq scr1=[piowc];; // Wait for PIOs to complete.
  40. hint @pause
  41. and scr2=scr1,mask;; // mask of writecount bits
  42. cmp.ne p6,p0=zeroval,scr2
  43. (p6) br.cond.sptk 5b
  44. ////////////// BEGIN PHYSICAL MODE ////////////////////
  45. mov psrsave=psr // Disable IC (no PMIs)
  46. rsm psr.i | psr.dt | psr.ic;;
  47. srlz.i;;
  48. st8.rel [ptc0]=data0 // Write PTC0 & wait for completion.
  49. 5: ld8.acq scr1=[piowcphy];; // Wait for PIOs to complete.
  50. hint @pause
  51. and scr2=scr1,mask;; // mask of writecount bits
  52. cmp.ne p6,p0=zeroval,scr2
  53. (p6) br.cond.sptk 5b;;
  54. tbit.nz p8,p7=scr1,DEADLOCKBIT;;// Test for DEADLOCK
  55. (p7) cmp.ne p7,p0=r0,ptc1;; // Test for non-null ptc1
  56. (p7) st8.rel [ptc1]=data1;; // Now write PTC1.
  57. 5: ld8.acq scr1=[piowcphy];; // Wait for PIOs to complete.
  58. hint @pause
  59. and scr2=scr1,mask;; // mask of writecount bits
  60. cmp.ne p6,p0=zeroval,scr2
  61. (p6) br.cond.sptk 5b
  62. tbit.nz p8,p0=scr1,DEADLOCKBIT;;// Test for DEADLOCK
  63. mov psr.l=psrsave;; // Reenable IC
  64. srlz.i;;
  65. ////////////// END PHYSICAL MODE ////////////////////
  66. (p8) add r8=1,r8
  67. (p8) br.cond.spnt 1b;; // Repeat if DEADLOCK occurred.
  68. br.ret.sptk rp
  69. .endp sn2_ptc_deadlock_recovery_core