sym_fw1.h 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790
  1. /*
  2. * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family
  3. * of PCI-SCSI IO processors.
  4. *
  5. * Copyright (C) 1999-2001 Gerard Roudier <groudier@free.fr>
  6. *
  7. * This driver is derived from the Linux sym53c8xx driver.
  8. * Copyright (C) 1998-2000 Gerard Roudier
  9. *
  10. * The sym53c8xx driver is derived from the ncr53c8xx driver that had been
  11. * a port of the FreeBSD ncr driver to Linux-1.2.13.
  12. *
  13. * The original ncr driver has been written for 386bsd and FreeBSD by
  14. * Wolfgang Stanglmeier <wolf@cologne.de>
  15. * Stefan Esser <se@mi.Uni-Koeln.de>
  16. * Copyright (C) 1994 Wolfgang Stanglmeier
  17. *
  18. * Other major contributions:
  19. *
  20. * NVRAM detection and reading.
  21. * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
  22. *
  23. *-----------------------------------------------------------------------------
  24. *
  25. * This program is free software; you can redistribute it and/or modify
  26. * it under the terms of the GNU General Public License as published by
  27. * the Free Software Foundation; either version 2 of the License, or
  28. * (at your option) any later version.
  29. *
  30. * This program is distributed in the hope that it will be useful,
  31. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  32. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  33. * GNU General Public License for more details.
  34. *
  35. * You should have received a copy of the GNU General Public License
  36. * along with this program; if not, write to the Free Software
  37. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  38. */
  39. /*
  40. * Scripts for SYMBIOS-Processor
  41. *
  42. * We have to know the offsets of all labels before we reach
  43. * them (for forward jumps). Therefore we declare a struct
  44. * here. If you make changes inside the script,
  45. *
  46. * DONT FORGET TO CHANGE THE LENGTHS HERE!
  47. */
  48. /*
  49. * Script fragments which are loaded into the on-chip RAM
  50. * of 825A, 875, 876, 895, 895A, 896 and 1010 chips.
  51. * Must not exceed 4K bytes.
  52. */
  53. struct SYM_FWA_SCR {
  54. u32 start [ 11];
  55. u32 getjob_begin [ 4];
  56. u32 _sms_a10 [ 5];
  57. u32 getjob_end [ 4];
  58. u32 _sms_a20 [ 4];
  59. #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
  60. u32 select [ 8];
  61. #else
  62. u32 select [ 6];
  63. #endif
  64. u32 _sms_a30 [ 5];
  65. u32 wf_sel_done [ 2];
  66. u32 send_ident [ 2];
  67. #ifdef SYM_CONF_IARB_SUPPORT
  68. u32 select2 [ 8];
  69. #else
  70. u32 select2 [ 2];
  71. #endif
  72. u32 command [ 2];
  73. u32 dispatch [ 28];
  74. u32 sel_no_cmd [ 10];
  75. u32 init [ 6];
  76. u32 clrack [ 4];
  77. u32 datai_done [ 11];
  78. u32 datai_done_wsr [ 20];
  79. u32 datao_done [ 11];
  80. u32 datao_done_wss [ 6];
  81. u32 datai_phase [ 5];
  82. u32 datao_phase [ 5];
  83. u32 msg_in [ 2];
  84. u32 msg_in2 [ 10];
  85. #ifdef SYM_CONF_IARB_SUPPORT
  86. u32 status [ 14];
  87. #else
  88. u32 status [ 10];
  89. #endif
  90. u32 complete [ 6];
  91. u32 complete2 [ 8];
  92. u32 _sms_a40 [ 12];
  93. u32 done [ 5];
  94. u32 _sms_a50 [ 5];
  95. u32 _sms_a60 [ 2];
  96. u32 done_end [ 4];
  97. u32 complete_error [ 5];
  98. u32 save_dp [ 11];
  99. u32 restore_dp [ 7];
  100. u32 disconnect [ 11];
  101. u32 disconnect2 [ 5];
  102. u32 _sms_a65 [ 3];
  103. #ifdef SYM_CONF_IARB_SUPPORT
  104. u32 idle [ 4];
  105. #else
  106. u32 idle [ 2];
  107. #endif
  108. #ifdef SYM_CONF_IARB_SUPPORT
  109. u32 ungetjob [ 7];
  110. #else
  111. u32 ungetjob [ 5];
  112. #endif
  113. #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
  114. u32 reselect [ 4];
  115. #else
  116. u32 reselect [ 2];
  117. #endif
  118. u32 reselected [ 19];
  119. u32 _sms_a70 [ 6];
  120. u32 _sms_a80 [ 4];
  121. u32 reselected1 [ 25];
  122. u32 _sms_a90 [ 4];
  123. u32 resel_lun0 [ 7];
  124. u32 _sms_a100 [ 4];
  125. u32 resel_tag [ 8];
  126. #if SYM_CONF_MAX_TASK*4 > 512
  127. u32 _sms_a110 [ 23];
  128. #elif SYM_CONF_MAX_TASK*4 > 256
  129. u32 _sms_a110 [ 17];
  130. #else
  131. u32 _sms_a110 [ 13];
  132. #endif
  133. u32 _sms_a120 [ 2];
  134. u32 resel_go [ 4];
  135. u32 _sms_a130 [ 7];
  136. u32 resel_dsa [ 2];
  137. u32 resel_dsa1 [ 4];
  138. u32 _sms_a140 [ 7];
  139. u32 resel_no_tag [ 4];
  140. u32 _sms_a145 [ 7];
  141. u32 data_in [SYM_CONF_MAX_SG * 2];
  142. u32 data_in2 [ 4];
  143. u32 data_out [SYM_CONF_MAX_SG * 2];
  144. u32 data_out2 [ 4];
  145. u32 pm0_data [ 12];
  146. u32 pm0_data_out [ 6];
  147. u32 pm0_data_end [ 7];
  148. u32 pm_data_end [ 4];
  149. u32 _sms_a150 [ 4];
  150. u32 pm1_data [ 12];
  151. u32 pm1_data_out [ 6];
  152. u32 pm1_data_end [ 9];
  153. };
  154. /*
  155. * Script fragments which stay in main memory for all chips
  156. * except for chips that support 8K on-chip RAM.
  157. */
  158. struct SYM_FWB_SCR {
  159. u32 no_data [ 2];
  160. #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
  161. u32 sel_for_abort [ 18];
  162. #else
  163. u32 sel_for_abort [ 16];
  164. #endif
  165. u32 sel_for_abort_1 [ 2];
  166. u32 msg_in_etc [ 12];
  167. u32 msg_received [ 5];
  168. u32 msg_weird_seen [ 5];
  169. u32 msg_extended [ 17];
  170. u32 _sms_b10 [ 4];
  171. u32 msg_bad [ 6];
  172. u32 msg_weird [ 4];
  173. u32 msg_weird1 [ 8];
  174. u32 wdtr_resp [ 6];
  175. u32 send_wdtr [ 4];
  176. u32 sdtr_resp [ 6];
  177. u32 send_sdtr [ 4];
  178. u32 ppr_resp [ 6];
  179. u32 send_ppr [ 4];
  180. u32 nego_bad_phase [ 4];
  181. u32 msg_out [ 4];
  182. u32 msg_out_done [ 4];
  183. u32 data_ovrun [ 3];
  184. u32 data_ovrun1 [ 22];
  185. u32 data_ovrun2 [ 8];
  186. u32 abort_resel [ 16];
  187. u32 resend_ident [ 4];
  188. u32 ident_break [ 4];
  189. u32 ident_break_atn [ 4];
  190. u32 sdata_in [ 6];
  191. u32 resel_bad_lun [ 4];
  192. u32 bad_i_t_l [ 4];
  193. u32 bad_i_t_l_q [ 4];
  194. u32 bad_status [ 7];
  195. u32 wsr_ma_helper [ 4];
  196. /* Data area */
  197. u32 zero [ 1];
  198. u32 scratch [ 1];
  199. u32 scratch1 [ 1];
  200. u32 prev_done [ 1];
  201. u32 done_pos [ 1];
  202. u32 nextjob [ 1];
  203. u32 startpos [ 1];
  204. u32 targtbl [ 1];
  205. };
  206. /*
  207. * Script fragments used at initialisations.
  208. * Only runs out of main memory.
  209. */
  210. struct SYM_FWZ_SCR {
  211. u32 snooptest [ 9];
  212. u32 snoopend [ 2];
  213. };
  214. static struct SYM_FWA_SCR SYM_FWA_SCR = {
  215. /*--------------------------< START >----------------------------*/ {
  216. /*
  217. * Switch the LED on.
  218. * Will be patched with a NO_OP if LED
  219. * not needed or not desired.
  220. */
  221. SCR_REG_REG (gpreg, SCR_AND, 0xfe),
  222. 0,
  223. /*
  224. * Clear SIGP.
  225. */
  226. SCR_FROM_REG (ctest2),
  227. 0,
  228. /*
  229. * Stop here if the C code wants to perform
  230. * some error recovery procedure manually.
  231. * (Indicate this by setting SEM in ISTAT)
  232. */
  233. SCR_FROM_REG (istat),
  234. 0,
  235. /*
  236. * Report to the C code the next position in
  237. * the start queue the SCRIPTS will schedule.
  238. * The C code must not change SCRATCHA.
  239. */
  240. SCR_COPY (4),
  241. PADDR_B (startpos),
  242. RADDR_1 (scratcha),
  243. SCR_INT ^ IFTRUE (MASK (SEM, SEM)),
  244. SIR_SCRIPT_STOPPED,
  245. /*
  246. * Start the next job.
  247. *
  248. * @DSA = start point for this job.
  249. * SCRATCHA = address of this job in the start queue.
  250. *
  251. * We will restore startpos with SCRATCHA if we fails the
  252. * arbitration or if it is the idle job.
  253. *
  254. * The below GETJOB_BEGIN to GETJOB_END section of SCRIPTS
  255. * is a critical path. If it is partially executed, it then
  256. * may happen that the job address is not yet in the DSA
  257. * and the next queue position points to the next JOB.
  258. */
  259. }/*-------------------------< GETJOB_BEGIN >---------------------*/,{
  260. /*
  261. * Copy to a fixed location both the next STARTPOS
  262. * and the current JOB address, using self modifying
  263. * SCRIPTS.
  264. */
  265. SCR_COPY (4),
  266. RADDR_1 (scratcha),
  267. PADDR_A (_sms_a10),
  268. SCR_COPY (8),
  269. }/*-------------------------< _SMS_A10 >-------------------------*/,{
  270. 0,
  271. PADDR_B (nextjob),
  272. /*
  273. * Move the start address to TEMP using self-
  274. * modifying SCRIPTS and jump indirectly to
  275. * that address.
  276. */
  277. SCR_COPY (4),
  278. PADDR_B (nextjob),
  279. RADDR_1 (dsa),
  280. }/*-------------------------< GETJOB_END >-----------------------*/,{
  281. SCR_COPY (4),
  282. RADDR_1 (dsa),
  283. PADDR_A (_sms_a20),
  284. SCR_COPY (4),
  285. }/*-------------------------< _SMS_A20 >-------------------------*/,{
  286. 0,
  287. RADDR_1 (temp),
  288. SCR_RETURN,
  289. 0,
  290. }/*-------------------------< SELECT >---------------------------*/,{
  291. /*
  292. * DSA contains the address of a scheduled
  293. * data structure.
  294. *
  295. * SCRATCHA contains the address of the start queue
  296. * entry which points to the next job.
  297. *
  298. * Set Initiator mode.
  299. *
  300. * (Target mode is left as an exercise for the reader)
  301. */
  302. #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
  303. SCR_CLR (SCR_TRG),
  304. 0,
  305. #endif
  306. /*
  307. * And try to select this target.
  308. */
  309. SCR_SEL_TBL_ATN ^ offsetof (struct sym_dsb, select),
  310. PADDR_A (ungetjob),
  311. /*
  312. * Now there are 4 possibilities:
  313. *
  314. * (1) The chip loses arbitration.
  315. * This is ok, because it will try again,
  316. * when the bus becomes idle.
  317. * (But beware of the timeout function!)
  318. *
  319. * (2) The chip is reselected.
  320. * Then the script processor takes the jump
  321. * to the RESELECT label.
  322. *
  323. * (3) The chip wins arbitration.
  324. * Then it will execute SCRIPTS instruction until
  325. * the next instruction that checks SCSI phase.
  326. * Then will stop and wait for selection to be
  327. * complete or selection time-out to occur.
  328. *
  329. * After having won arbitration, the SCRIPTS
  330. * processor is able to execute instructions while
  331. * the SCSI core is performing SCSI selection.
  332. */
  333. /*
  334. * Copy the CCB header to a fixed location
  335. * in the HCB using self-modifying SCRIPTS.
  336. */
  337. SCR_COPY (4),
  338. RADDR_1 (dsa),
  339. PADDR_A (_sms_a30),
  340. SCR_COPY (sizeof(struct sym_ccbh)),
  341. }/*-------------------------< _SMS_A30 >-------------------------*/,{
  342. 0,
  343. HADDR_1 (ccb_head),
  344. /*
  345. * Initialize the status register
  346. */
  347. SCR_COPY (4),
  348. HADDR_1 (ccb_head.status),
  349. RADDR_1 (scr0),
  350. }/*-------------------------< WF_SEL_DONE >----------------------*/,{
  351. SCR_INT ^ IFFALSE (WHEN (SCR_MSG_OUT)),
  352. SIR_SEL_ATN_NO_MSG_OUT,
  353. }/*-------------------------< SEND_IDENT >-----------------------*/,{
  354. /*
  355. * Selection complete.
  356. * Send the IDENTIFY and possibly the TAG message
  357. * and negotiation message if present.
  358. */
  359. SCR_MOVE_TBL ^ SCR_MSG_OUT,
  360. offsetof (struct sym_dsb, smsg),
  361. }/*-------------------------< SELECT2 >--------------------------*/,{
  362. #ifdef SYM_CONF_IARB_SUPPORT
  363. /*
  364. * Set IMMEDIATE ARBITRATION if we have been given
  365. * a hint to do so. (Some job to do after this one).
  366. */
  367. SCR_FROM_REG (HF_REG),
  368. 0,
  369. SCR_JUMPR ^ IFFALSE (MASK (HF_HINT_IARB, HF_HINT_IARB)),
  370. 8,
  371. SCR_REG_REG (scntl1, SCR_OR, IARB),
  372. 0,
  373. #endif
  374. /*
  375. * Anticipate the COMMAND phase.
  376. * This is the PHASE we expect at this point.
  377. */
  378. SCR_JUMP ^ IFFALSE (WHEN (SCR_COMMAND)),
  379. PADDR_A (sel_no_cmd),
  380. }/*-------------------------< COMMAND >--------------------------*/,{
  381. /*
  382. * ... and send the command
  383. */
  384. SCR_MOVE_TBL ^ SCR_COMMAND,
  385. offsetof (struct sym_dsb, cmd),
  386. }/*-------------------------< DISPATCH >-------------------------*/,{
  387. /*
  388. * MSG_IN is the only phase that shall be
  389. * entered at least once for each (re)selection.
  390. * So we test it first.
  391. */
  392. SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_IN)),
  393. PADDR_A (msg_in),
  394. SCR_JUMP ^ IFTRUE (IF (SCR_DATA_OUT)),
  395. PADDR_A (datao_phase),
  396. SCR_JUMP ^ IFTRUE (IF (SCR_DATA_IN)),
  397. PADDR_A (datai_phase),
  398. SCR_JUMP ^ IFTRUE (IF (SCR_STATUS)),
  399. PADDR_A (status),
  400. SCR_JUMP ^ IFTRUE (IF (SCR_COMMAND)),
  401. PADDR_A (command),
  402. SCR_JUMP ^ IFTRUE (IF (SCR_MSG_OUT)),
  403. PADDR_B (msg_out),
  404. /*
  405. * Discard as many illegal phases as
  406. * required and tell the C code about.
  407. */
  408. SCR_JUMPR ^ IFFALSE (WHEN (SCR_ILG_OUT)),
  409. 16,
  410. SCR_MOVE_ABS (1) ^ SCR_ILG_OUT,
  411. HADDR_1 (scratch),
  412. SCR_JUMPR ^ IFTRUE (WHEN (SCR_ILG_OUT)),
  413. -16,
  414. SCR_JUMPR ^ IFFALSE (WHEN (SCR_ILG_IN)),
  415. 16,
  416. SCR_MOVE_ABS (1) ^ SCR_ILG_IN,
  417. HADDR_1 (scratch),
  418. SCR_JUMPR ^ IFTRUE (WHEN (SCR_ILG_IN)),
  419. -16,
  420. SCR_INT,
  421. SIR_BAD_PHASE,
  422. SCR_JUMP,
  423. PADDR_A (dispatch),
  424. }/*-------------------------< SEL_NO_CMD >-----------------------*/,{
  425. /*
  426. * The target does not switch to command
  427. * phase after IDENTIFY has been sent.
  428. *
  429. * If it stays in MSG OUT phase send it
  430. * the IDENTIFY again.
  431. */
  432. SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_OUT)),
  433. PADDR_B (resend_ident),
  434. /*
  435. * If target does not switch to MSG IN phase
  436. * and we sent a negotiation, assert the
  437. * failure immediately.
  438. */
  439. SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_IN)),
  440. PADDR_A (dispatch),
  441. SCR_FROM_REG (HS_REG),
  442. 0,
  443. SCR_INT ^ IFTRUE (DATA (HS_NEGOTIATE)),
  444. SIR_NEGO_FAILED,
  445. /*
  446. * Jump to dispatcher.
  447. */
  448. SCR_JUMP,
  449. PADDR_A (dispatch),
  450. }/*-------------------------< INIT >-----------------------------*/,{
  451. /*
  452. * Wait for the SCSI RESET signal to be
  453. * inactive before restarting operations,
  454. * since the chip may hang on SEL_ATN
  455. * if SCSI RESET is active.
  456. */
  457. SCR_FROM_REG (sstat0),
  458. 0,
  459. SCR_JUMPR ^ IFTRUE (MASK (IRST, IRST)),
  460. -16,
  461. SCR_JUMP,
  462. PADDR_A (start),
  463. }/*-------------------------< CLRACK >---------------------------*/,{
  464. /*
  465. * Terminate possible pending message phase.
  466. */
  467. SCR_CLR (SCR_ACK),
  468. 0,
  469. SCR_JUMP,
  470. PADDR_A (dispatch),
  471. }/*-------------------------< DATAI_DONE >-----------------------*/,{
  472. /*
  473. * Save current pointer to LASTP.
  474. */
  475. SCR_COPY (4),
  476. RADDR_1 (temp),
  477. HADDR_1 (ccb_head.lastp),
  478. /*
  479. * If the SWIDE is not full, jump to dispatcher.
  480. * We anticipate a STATUS phase.
  481. */
  482. SCR_FROM_REG (scntl2),
  483. 0,
  484. SCR_JUMP ^ IFTRUE (MASK (WSR, WSR)),
  485. PADDR_A (datai_done_wsr),
  486. SCR_JUMP ^ IFTRUE (WHEN (SCR_STATUS)),
  487. PADDR_A (status),
  488. SCR_JUMP,
  489. PADDR_A (dispatch),
  490. }/*-------------------------< DATAI_DONE_WSR >-------------------*/,{
  491. /*
  492. * The SWIDE is full.
  493. * Clear this condition.
  494. */
  495. SCR_REG_REG (scntl2, SCR_OR, WSR),
  496. 0,
  497. /*
  498. * We are expecting an IGNORE RESIDUE message
  499. * from the device, otherwise we are in data
  500. * overrun condition. Check against MSG_IN phase.
  501. */
  502. SCR_INT ^ IFFALSE (WHEN (SCR_MSG_IN)),
  503. SIR_SWIDE_OVERRUN,
  504. SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
  505. PADDR_A (dispatch),
  506. /*
  507. * We are in MSG_IN phase,
  508. * Read the first byte of the message.
  509. * If it is not an IGNORE RESIDUE message,
  510. * signal overrun and jump to message
  511. * processing.
  512. */
  513. SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
  514. HADDR_1 (msgin[0]),
  515. SCR_INT ^ IFFALSE (DATA (M_IGN_RESIDUE)),
  516. SIR_SWIDE_OVERRUN,
  517. SCR_JUMP ^ IFFALSE (DATA (M_IGN_RESIDUE)),
  518. PADDR_A (msg_in2),
  519. /*
  520. * We got the message we expected.
  521. * Read the 2nd byte, and jump to dispatcher.
  522. */
  523. SCR_CLR (SCR_ACK),
  524. 0,
  525. SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
  526. HADDR_1 (msgin[1]),
  527. SCR_CLR (SCR_ACK),
  528. 0,
  529. SCR_JUMP,
  530. PADDR_A (dispatch),
  531. }/*-------------------------< DATAO_DONE >-----------------------*/,{
  532. /*
  533. * Save current pointer to LASTP.
  534. */
  535. SCR_COPY (4),
  536. RADDR_1 (temp),
  537. HADDR_1 (ccb_head.lastp),
  538. /*
  539. * If the SODL is not full jump to dispatcher.
  540. * We anticipate a STATUS phase.
  541. */
  542. SCR_FROM_REG (scntl2),
  543. 0,
  544. SCR_JUMP ^ IFTRUE (MASK (WSS, WSS)),
  545. PADDR_A (datao_done_wss),
  546. SCR_JUMP ^ IFTRUE (WHEN (SCR_STATUS)),
  547. PADDR_A (status),
  548. SCR_JUMP,
  549. PADDR_A (dispatch),
  550. }/*-------------------------< DATAO_DONE_WSS >-------------------*/,{
  551. /*
  552. * The SODL is full, clear this condition.
  553. */
  554. SCR_REG_REG (scntl2, SCR_OR, WSS),
  555. 0,
  556. /*
  557. * And signal a DATA UNDERRUN condition
  558. * to the C code.
  559. */
  560. SCR_INT,
  561. SIR_SODL_UNDERRUN,
  562. SCR_JUMP,
  563. PADDR_A (dispatch),
  564. }/*-------------------------< DATAI_PHASE >----------------------*/,{
  565. /*
  566. * Jump to current pointer.
  567. */
  568. SCR_COPY (4),
  569. HADDR_1 (ccb_head.lastp),
  570. RADDR_1 (temp),
  571. SCR_RETURN,
  572. 0,
  573. }/*-------------------------< DATAO_PHASE >----------------------*/,{
  574. /*
  575. * Jump to current pointer.
  576. */
  577. SCR_COPY (4),
  578. HADDR_1 (ccb_head.lastp),
  579. RADDR_1 (temp),
  580. SCR_RETURN,
  581. 0,
  582. }/*-------------------------< MSG_IN >---------------------------*/,{
  583. /*
  584. * Get the first byte of the message.
  585. *
  586. * The script processor doesn't negate the
  587. * ACK signal after this transfer.
  588. */
  589. SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
  590. HADDR_1 (msgin[0]),
  591. }/*-------------------------< MSG_IN2 >--------------------------*/,{
  592. /*
  593. * Check first against 1 byte messages
  594. * that we handle from SCRIPTS.
  595. */
  596. SCR_JUMP ^ IFTRUE (DATA (M_COMPLETE)),
  597. PADDR_A (complete),
  598. SCR_JUMP ^ IFTRUE (DATA (M_DISCONNECT)),
  599. PADDR_A (disconnect),
  600. SCR_JUMP ^ IFTRUE (DATA (M_SAVE_DP)),
  601. PADDR_A (save_dp),
  602. SCR_JUMP ^ IFTRUE (DATA (M_RESTORE_DP)),
  603. PADDR_A (restore_dp),
  604. /*
  605. * We handle all other messages from the
  606. * C code, so no need to waste on-chip RAM
  607. * for those ones.
  608. */
  609. SCR_JUMP,
  610. PADDR_B (msg_in_etc),
  611. }/*-------------------------< STATUS >---------------------------*/,{
  612. /*
  613. * get the status
  614. */
  615. SCR_MOVE_ABS (1) ^ SCR_STATUS,
  616. HADDR_1 (scratch),
  617. #ifdef SYM_CONF_IARB_SUPPORT
  618. /*
  619. * If STATUS is not GOOD, clear IMMEDIATE ARBITRATION,
  620. * since we may have to tamper the start queue from
  621. * the C code.
  622. */
  623. SCR_JUMPR ^ IFTRUE (DATA (S_GOOD)),
  624. 8,
  625. SCR_REG_REG (scntl1, SCR_AND, ~IARB),
  626. 0,
  627. #endif
  628. /*
  629. * save status to scsi_status.
  630. * mark as complete.
  631. */
  632. SCR_TO_REG (SS_REG),
  633. 0,
  634. SCR_LOAD_REG (HS_REG, HS_COMPLETE),
  635. 0,
  636. /*
  637. * Anticipate the MESSAGE PHASE for
  638. * the TASK COMPLETE message.
  639. */
  640. SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_IN)),
  641. PADDR_A (msg_in),
  642. SCR_JUMP,
  643. PADDR_A (dispatch),
  644. }/*-------------------------< COMPLETE >-------------------------*/,{
  645. /*
  646. * Complete message.
  647. *
  648. * When we terminate the cycle by clearing ACK,
  649. * the target may disconnect immediately.
  650. *
  651. * We don't want to be told of an "unexpected disconnect",
  652. * so we disable this feature.
  653. */
  654. SCR_REG_REG (scntl2, SCR_AND, 0x7f),
  655. 0,
  656. /*
  657. * Terminate cycle ...
  658. */
  659. SCR_CLR (SCR_ACK|SCR_ATN),
  660. 0,
  661. /*
  662. * ... and wait for the disconnect.
  663. */
  664. SCR_WAIT_DISC,
  665. 0,
  666. }/*-------------------------< COMPLETE2 >------------------------*/,{
  667. /*
  668. * Save host status.
  669. */
  670. SCR_COPY (4),
  671. RADDR_1 (scr0),
  672. HADDR_1 (ccb_head.status),
  673. /*
  674. * Move back the CCB header using self-modifying
  675. * SCRIPTS.
  676. */
  677. SCR_COPY (4),
  678. RADDR_1 (dsa),
  679. PADDR_A (_sms_a40),
  680. SCR_COPY (sizeof(struct sym_ccbh)),
  681. HADDR_1 (ccb_head),
  682. }/*-------------------------< _SMS_A40 >-------------------------*/,{
  683. 0,
  684. /*
  685. * Some bridges may reorder DMA writes to memory.
  686. * We donnot want the CPU to deal with completions
  687. * without all the posted write having been flushed
  688. * to memory. This DUMMY READ should flush posted
  689. * buffers prior to the CPU having to deal with
  690. * completions.
  691. */
  692. SCR_COPY (4), /* DUMMY READ */
  693. HADDR_1 (ccb_head.status),
  694. RADDR_1 (scr0),
  695. /*
  696. * If command resulted in not GOOD status,
  697. * call the C code if needed.
  698. */
  699. SCR_FROM_REG (SS_REG),
  700. 0,
  701. SCR_CALL ^ IFFALSE (DATA (S_GOOD)),
  702. PADDR_B (bad_status),
  703. /*
  704. * If we performed an auto-sense, call
  705. * the C code to synchronyze task aborts
  706. * with UNIT ATTENTION conditions.
  707. */
  708. SCR_FROM_REG (HF_REG),
  709. 0,
  710. SCR_JUMP ^ IFFALSE (MASK (0 ,(HF_SENSE|HF_EXT_ERR))),
  711. PADDR_A (complete_error),
  712. }/*-------------------------< DONE >-----------------------------*/,{
  713. /*
  714. * Copy the DSA to the DONE QUEUE and
  715. * signal completion to the host.
  716. * If we are interrupted between DONE
  717. * and DONE_END, we must reset, otherwise
  718. * the completed CCB may be lost.
  719. */
  720. SCR_COPY (4),
  721. PADDR_B (done_pos),
  722. PADDR_A (_sms_a50),
  723. SCR_COPY (4),
  724. RADDR_1 (dsa),
  725. }/*-------------------------< _SMS_A50 >-------------------------*/,{
  726. 0,
  727. SCR_COPY (4),
  728. PADDR_B (done_pos),
  729. PADDR_A (_sms_a60),
  730. /*
  731. * The instruction below reads the DONE QUEUE next
  732. * free position from memory.
  733. * In addition it ensures that all PCI posted writes
  734. * are flushed and so the DSA value of the done
  735. * CCB is visible by the CPU before INTFLY is raised.
  736. */
  737. SCR_COPY (8),
  738. }/*-------------------------< _SMS_A60 >-------------------------*/,{
  739. 0,
  740. PADDR_B (prev_done),
  741. }/*-------------------------< DONE_END >-------------------------*/,{
  742. SCR_INT_FLY,
  743. 0,
  744. SCR_JUMP,
  745. PADDR_A (start),
  746. }/*-------------------------< COMPLETE_ERROR >-------------------*/,{
  747. SCR_COPY (4),
  748. PADDR_B (startpos),
  749. RADDR_1 (scratcha),
  750. SCR_INT,
  751. SIR_COMPLETE_ERROR,
  752. }/*-------------------------< SAVE_DP >--------------------------*/,{
  753. /*
  754. * Clear ACK immediately.
  755. * No need to delay it.
  756. */
  757. SCR_CLR (SCR_ACK),
  758. 0,
  759. /*
  760. * Keep track we received a SAVE DP, so
  761. * we will switch to the other PM context
  762. * on the next PM since the DP may point
  763. * to the current PM context.
  764. */
  765. SCR_REG_REG (HF_REG, SCR_OR, HF_DP_SAVED),
  766. 0,
  767. /*
  768. * SAVE_DP message:
  769. * Copy LASTP to SAVEP.
  770. */
  771. SCR_COPY (4),
  772. HADDR_1 (ccb_head.lastp),
  773. HADDR_1 (ccb_head.savep),
  774. /*
  775. * Anticipate the MESSAGE PHASE for
  776. * the DISCONNECT message.
  777. */
  778. SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_IN)),
  779. PADDR_A (msg_in),
  780. SCR_JUMP,
  781. PADDR_A (dispatch),
  782. }/*-------------------------< RESTORE_DP >-----------------------*/,{
  783. /*
  784. * Clear ACK immediately.
  785. * No need to delay it.
  786. */
  787. SCR_CLR (SCR_ACK),
  788. 0,
  789. /*
  790. * Copy SAVEP to LASTP.
  791. */
  792. SCR_COPY (4),
  793. HADDR_1 (ccb_head.savep),
  794. HADDR_1 (ccb_head.lastp),
  795. SCR_JUMP,
  796. PADDR_A (dispatch),
  797. }/*-------------------------< DISCONNECT >-----------------------*/,{
  798. /*
  799. * DISCONNECTing ...
  800. *
  801. * disable the "unexpected disconnect" feature,
  802. * and remove the ACK signal.
  803. */
  804. SCR_REG_REG (scntl2, SCR_AND, 0x7f),
  805. 0,
  806. SCR_CLR (SCR_ACK|SCR_ATN),
  807. 0,
  808. /*
  809. * Wait for the disconnect.
  810. */
  811. SCR_WAIT_DISC,
  812. 0,
  813. /*
  814. * Status is: DISCONNECTED.
  815. */
  816. SCR_LOAD_REG (HS_REG, HS_DISCONNECT),
  817. 0,
  818. /*
  819. * Save host status.
  820. */
  821. SCR_COPY (4),
  822. RADDR_1 (scr0),
  823. HADDR_1 (ccb_head.status),
  824. }/*-------------------------< DISCONNECT2 >----------------------*/,{
  825. /*
  826. * Move back the CCB header using self-modifying
  827. * SCRIPTS.
  828. */
  829. SCR_COPY (4),
  830. RADDR_1 (dsa),
  831. PADDR_A (_sms_a65),
  832. SCR_COPY (sizeof(struct sym_ccbh)),
  833. HADDR_1 (ccb_head),
  834. }/*-------------------------< _SMS_A65 >-------------------------*/,{
  835. 0,
  836. SCR_JUMP,
  837. PADDR_A (start),
  838. }/*-------------------------< IDLE >-----------------------------*/,{
  839. /*
  840. * Nothing to do?
  841. * Switch the LED off and wait for reselect.
  842. * Will be patched with a NO_OP if LED
  843. * not needed or not desired.
  844. */
  845. SCR_REG_REG (gpreg, SCR_OR, 0x01),
  846. 0,
  847. #ifdef SYM_CONF_IARB_SUPPORT
  848. SCR_JUMPR,
  849. 8,
  850. #endif
  851. }/*-------------------------< UNGETJOB >-------------------------*/,{
  852. #ifdef SYM_CONF_IARB_SUPPORT
  853. /*
  854. * Set IMMEDIATE ARBITRATION, for the next time.
  855. * This will give us better chance to win arbitration
  856. * for the job we just wanted to do.
  857. */
  858. SCR_REG_REG (scntl1, SCR_OR, IARB),
  859. 0,
  860. #endif
  861. /*
  862. * We are not able to restart the SCRIPTS if we are
  863. * interrupted and these instruction haven't been
  864. * all executed. BTW, this is very unlikely to
  865. * happen, but we check that from the C code.
  866. */
  867. SCR_LOAD_REG (dsa, 0xff),
  868. 0,
  869. SCR_COPY (4),
  870. RADDR_1 (scratcha),
  871. PADDR_B (startpos),
  872. }/*-------------------------< RESELECT >-------------------------*/,{
  873. #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
  874. /*
  875. * Make sure we are in initiator mode.
  876. */
  877. SCR_CLR (SCR_TRG),
  878. 0,
  879. #endif
  880. /*
  881. * Sleep waiting for a reselection.
  882. */
  883. SCR_WAIT_RESEL,
  884. PADDR_A(start),
  885. }/*-------------------------< RESELECTED >-----------------------*/,{
  886. /*
  887. * Switch the LED on.
  888. * Will be patched with a NO_OP if LED
  889. * not needed or not desired.
  890. */
  891. SCR_REG_REG (gpreg, SCR_AND, 0xfe),
  892. 0,
  893. /*
  894. * load the target id into the sdid
  895. */
  896. SCR_REG_SFBR (ssid, SCR_AND, 0x8F),
  897. 0,
  898. SCR_TO_REG (sdid),
  899. 0,
  900. /*
  901. * Load the target control block address
  902. */
  903. SCR_COPY (4),
  904. PADDR_B (targtbl),
  905. RADDR_1 (dsa),
  906. SCR_SFBR_REG (dsa, SCR_SHL, 0),
  907. 0,
  908. SCR_REG_REG (dsa, SCR_SHL, 0),
  909. 0,
  910. SCR_REG_REG (dsa, SCR_AND, 0x3c),
  911. 0,
  912. SCR_COPY (4),
  913. RADDR_1 (dsa),
  914. PADDR_A (_sms_a70),
  915. SCR_COPY (4),
  916. }/*-------------------------< _SMS_A70 >-------------------------*/,{
  917. 0,
  918. RADDR_1 (dsa),
  919. /*
  920. * Copy the TCB header to a fixed place in
  921. * the HCB.
  922. */
  923. SCR_COPY (4),
  924. RADDR_1 (dsa),
  925. PADDR_A (_sms_a80),
  926. SCR_COPY (sizeof(struct sym_tcbh)),
  927. }/*-------------------------< _SMS_A80 >-------------------------*/,{
  928. 0,
  929. HADDR_1 (tcb_head),
  930. /*
  931. * We expect MESSAGE IN phase.
  932. * If not, get help from the C code.
  933. */
  934. SCR_INT ^ IFFALSE (WHEN (SCR_MSG_IN)),
  935. SIR_RESEL_NO_MSG_IN,
  936. }/*-------------------------< RESELECTED1 >----------------------*/,{
  937. /*
  938. * Load the synchronous transfer registers.
  939. */
  940. SCR_COPY (1),
  941. HADDR_1 (tcb_head.wval),
  942. RADDR_1 (scntl3),
  943. SCR_COPY (1),
  944. HADDR_1 (tcb_head.sval),
  945. RADDR_1 (sxfer),
  946. /*
  947. * Get the IDENTIFY message.
  948. */
  949. SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
  950. HADDR_1 (msgin),
  951. /*
  952. * If IDENTIFY LUN #0, use a faster path
  953. * to find the LCB structure.
  954. */
  955. SCR_JUMP ^ IFTRUE (MASK (0x80, 0xbf)),
  956. PADDR_A (resel_lun0),
  957. /*
  958. * If message isn't an IDENTIFY,
  959. * tell the C code about.
  960. */
  961. SCR_INT ^ IFFALSE (MASK (0x80, 0x80)),
  962. SIR_RESEL_NO_IDENTIFY,
  963. /*
  964. * It is an IDENTIFY message,
  965. * Load the LUN control block address.
  966. */
  967. SCR_COPY (4),
  968. HADDR_1 (tcb_head.luntbl_sa),
  969. RADDR_1 (dsa),
  970. SCR_SFBR_REG (dsa, SCR_SHL, 0),
  971. 0,
  972. SCR_REG_REG (dsa, SCR_SHL, 0),
  973. 0,
  974. SCR_REG_REG (dsa, SCR_AND, 0xfc),
  975. 0,
  976. SCR_COPY (4),
  977. RADDR_1 (dsa),
  978. PADDR_A (_sms_a90),
  979. SCR_COPY (4),
  980. }/*-------------------------< _SMS_A90 >-------------------------*/,{
  981. 0,
  982. RADDR_1 (dsa),
  983. SCR_JUMPR,
  984. 12,
  985. }/*-------------------------< RESEL_LUN0 >-----------------------*/,{
  986. /*
  987. * LUN 0 special case (but usual one :))
  988. */
  989. SCR_COPY (4),
  990. HADDR_1 (tcb_head.lun0_sa),
  991. RADDR_1 (dsa),
  992. /*
  993. * Jump indirectly to the reselect action for this LUN.
  994. * (lcb.head.resel_sa assumed at offset zero of lcb).
  995. */
  996. SCR_COPY (4),
  997. RADDR_1 (dsa),
  998. PADDR_A (_sms_a100),
  999. SCR_COPY (4),
  1000. }/*-------------------------< _SMS_A100 >------------------------*/,{
  1001. 0,
  1002. RADDR_1 (temp),
  1003. SCR_RETURN,
  1004. 0,
  1005. /* In normal situations, we jump to RESEL_TAG or RESEL_NO_TAG */
  1006. }/*-------------------------< RESEL_TAG >------------------------*/,{
  1007. /*
  1008. * ACK the IDENTIFY previously received.
  1009. */
  1010. SCR_CLR (SCR_ACK),
  1011. 0,
  1012. /*
  1013. * It shall be a tagged command.
  1014. * Read SIMPLE+TAG.
  1015. * The C code will deal with errors.
  1016. * Aggressive optimization, isn't it? :)
  1017. */
  1018. SCR_MOVE_ABS (2) ^ SCR_MSG_IN,
  1019. HADDR_1 (msgin),
  1020. /*
  1021. * Copy the LCB header to a fixed place in
  1022. * the HCB using self-modifying SCRIPTS.
  1023. */
  1024. SCR_COPY (4),
  1025. RADDR_1 (dsa),
  1026. PADDR_A (_sms_a110),
  1027. SCR_COPY (sizeof(struct sym_lcbh)),
  1028. }/*-------------------------< _SMS_A110 >------------------------*/,{
  1029. 0,
  1030. HADDR_1 (lcb_head),
  1031. /*
  1032. * Load the pointer to the tagged task
  1033. * table for this LUN.
  1034. */
  1035. SCR_COPY (4),
  1036. HADDR_1 (lcb_head.itlq_tbl_sa),
  1037. RADDR_1 (dsa),
  1038. /*
  1039. * The SIDL still contains the TAG value.
  1040. * Aggressive optimization, isn't it? :):)
  1041. */
  1042. SCR_REG_SFBR (sidl, SCR_SHL, 0),
  1043. 0,
  1044. #if SYM_CONF_MAX_TASK*4 > 512
  1045. SCR_JUMPR ^ IFFALSE (CARRYSET),
  1046. 8,
  1047. SCR_REG_REG (dsa1, SCR_OR, 2),
  1048. 0,
  1049. SCR_REG_REG (sfbr, SCR_SHL, 0),
  1050. 0,
  1051. SCR_JUMPR ^ IFFALSE (CARRYSET),
  1052. 8,
  1053. SCR_REG_REG (dsa1, SCR_OR, 1),
  1054. 0,
  1055. #elif SYM_CONF_MAX_TASK*4 > 256
  1056. SCR_JUMPR ^ IFFALSE (CARRYSET),
  1057. 8,
  1058. SCR_REG_REG (dsa1, SCR_OR, 1),
  1059. 0,
  1060. #endif
  1061. /*
  1062. * Retrieve the DSA of this task.
  1063. * JUMP indirectly to the restart point of the CCB.
  1064. */
  1065. SCR_SFBR_REG (dsa, SCR_AND, 0xfc),
  1066. 0,
  1067. SCR_COPY (4),
  1068. RADDR_1 (dsa),
  1069. PADDR_A (_sms_a120),
  1070. SCR_COPY (4),
  1071. }/*-------------------------< _SMS_A120 >------------------------*/,{
  1072. 0,
  1073. RADDR_1 (dsa),
  1074. }/*-------------------------< RESEL_GO >-------------------------*/,{
  1075. SCR_COPY (4),
  1076. RADDR_1 (dsa),
  1077. PADDR_A (_sms_a130),
  1078. /*
  1079. * Move 'ccb.phys.head.go' action to
  1080. * scratch/scratch1. So scratch1 will
  1081. * contain the 'restart' field of the
  1082. * 'go' structure.
  1083. */
  1084. SCR_COPY (8),
  1085. }/*-------------------------< _SMS_A130 >------------------------*/,{
  1086. 0,
  1087. PADDR_B (scratch),
  1088. SCR_COPY (4),
  1089. PADDR_B (scratch1), /* phys.head.go.restart */
  1090. RADDR_1 (temp),
  1091. SCR_RETURN,
  1092. 0,
  1093. /* In normal situations we branch to RESEL_DSA */
  1094. }/*-------------------------< RESEL_DSA >------------------------*/,{
  1095. /*
  1096. * ACK the IDENTIFY or TAG previously received.
  1097. */
  1098. SCR_CLR (SCR_ACK),
  1099. 0,
  1100. }/*-------------------------< RESEL_DSA1 >-----------------------*/,{
  1101. /*
  1102. * Copy the CCB header to a fixed location
  1103. * in the HCB using self-modifying SCRIPTS.
  1104. */
  1105. SCR_COPY (4),
  1106. RADDR_1 (dsa),
  1107. PADDR_A (_sms_a140),
  1108. SCR_COPY (sizeof(struct sym_ccbh)),
  1109. }/*-------------------------< _SMS_A140 >------------------------*/,{
  1110. 0,
  1111. HADDR_1 (ccb_head),
  1112. /*
  1113. * Initialize the status register
  1114. */
  1115. SCR_COPY (4),
  1116. HADDR_1 (ccb_head.status),
  1117. RADDR_1 (scr0),
  1118. /*
  1119. * Jump to dispatcher.
  1120. */
  1121. SCR_JUMP,
  1122. PADDR_A (dispatch),
  1123. }/*-------------------------< RESEL_NO_TAG >---------------------*/,{
  1124. /*
  1125. * Copy the LCB header to a fixed place in
  1126. * the HCB using self-modifying SCRIPTS.
  1127. */
  1128. SCR_COPY (4),
  1129. RADDR_1 (dsa),
  1130. PADDR_A (_sms_a145),
  1131. SCR_COPY (sizeof(struct sym_lcbh)),
  1132. }/*-------------------------< _SMS_A145 >------------------------*/,{
  1133. 0,
  1134. HADDR_1 (lcb_head),
  1135. /*
  1136. * Load the DSA with the unique ITL task.
  1137. */
  1138. SCR_COPY (4),
  1139. HADDR_1 (lcb_head.itl_task_sa),
  1140. RADDR_1 (dsa),
  1141. SCR_JUMP,
  1142. PADDR_A (resel_go),
  1143. }/*-------------------------< DATA_IN >--------------------------*/,{
  1144. /*
  1145. * Because the size depends on the
  1146. * #define SYM_CONF_MAX_SG parameter,
  1147. * it is filled in at runtime.
  1148. *
  1149. * ##===========< i=0; i<SYM_CONF_MAX_SG >=========
  1150. * || SCR_CHMOV_TBL ^ SCR_DATA_IN,
  1151. * || offsetof (struct sym_dsb, data[ i]),
  1152. * ##==========================================
  1153. */
  1154. 0
  1155. }/*-------------------------< DATA_IN2 >-------------------------*/,{
  1156. SCR_CALL,
  1157. PADDR_A (datai_done),
  1158. SCR_JUMP,
  1159. PADDR_B (data_ovrun),
  1160. }/*-------------------------< DATA_OUT >-------------------------*/,{
  1161. /*
  1162. * Because the size depends on the
  1163. * #define SYM_CONF_MAX_SG parameter,
  1164. * it is filled in at runtime.
  1165. *
  1166. * ##===========< i=0; i<SYM_CONF_MAX_SG >=========
  1167. * || SCR_CHMOV_TBL ^ SCR_DATA_OUT,
  1168. * || offsetof (struct sym_dsb, data[ i]),
  1169. * ##==========================================
  1170. */
  1171. 0
  1172. }/*-------------------------< DATA_OUT2 >------------------------*/,{
  1173. SCR_CALL,
  1174. PADDR_A (datao_done),
  1175. SCR_JUMP,
  1176. PADDR_B (data_ovrun),
  1177. }/*-------------------------< PM0_DATA >-------------------------*/,{
  1178. /*
  1179. * Read our host flags to SFBR, so we will be able
  1180. * to check against the data direction we expect.
  1181. */
  1182. SCR_FROM_REG (HF_REG),
  1183. 0,
  1184. /*
  1185. * Check against actual DATA PHASE.
  1186. */
  1187. SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
  1188. PADDR_A (pm0_data_out),
  1189. /*
  1190. * Actual phase is DATA IN.
  1191. * Check against expected direction.
  1192. */
  1193. SCR_JUMP ^ IFFALSE (MASK (HF_DATA_IN, HF_DATA_IN)),
  1194. PADDR_B (data_ovrun),
  1195. /*
  1196. * Keep track we are moving data from the
  1197. * PM0 DATA mini-script.
  1198. */
  1199. SCR_REG_REG (HF_REG, SCR_OR, HF_IN_PM0),
  1200. 0,
  1201. /*
  1202. * Move the data to memory.
  1203. */
  1204. SCR_CHMOV_TBL ^ SCR_DATA_IN,
  1205. offsetof (struct sym_ccb, phys.pm0.sg),
  1206. SCR_JUMP,
  1207. PADDR_A (pm0_data_end),
  1208. }/*-------------------------< PM0_DATA_OUT >---------------------*/,{
  1209. /*
  1210. * Actual phase is DATA OUT.
  1211. * Check against expected direction.
  1212. */
  1213. SCR_JUMP ^ IFTRUE (MASK (HF_DATA_IN, HF_DATA_IN)),
  1214. PADDR_B (data_ovrun),
  1215. /*
  1216. * Keep track we are moving data from the
  1217. * PM0 DATA mini-script.
  1218. */
  1219. SCR_REG_REG (HF_REG, SCR_OR, HF_IN_PM0),
  1220. 0,
  1221. /*
  1222. * Move the data from memory.
  1223. */
  1224. SCR_CHMOV_TBL ^ SCR_DATA_OUT,
  1225. offsetof (struct sym_ccb, phys.pm0.sg),
  1226. }/*-------------------------< PM0_DATA_END >---------------------*/,{
  1227. /*
  1228. * Clear the flag that told we were moving
  1229. * data from the PM0 DATA mini-script.
  1230. */
  1231. SCR_REG_REG (HF_REG, SCR_AND, (~HF_IN_PM0)),
  1232. 0,
  1233. /*
  1234. * Return to the previous DATA script which
  1235. * is guaranteed by design (if no bug) to be
  1236. * the main DATA script for this transfer.
  1237. */
  1238. SCR_COPY (4),
  1239. RADDR_1 (dsa),
  1240. RADDR_1 (scratcha),
  1241. SCR_REG_REG (scratcha, SCR_ADD, offsetof (struct sym_ccb,phys.pm0.ret)),
  1242. 0,
  1243. }/*-------------------------< PM_DATA_END >----------------------*/,{
  1244. SCR_COPY (4),
  1245. RADDR_1 (scratcha),
  1246. PADDR_A (_sms_a150),
  1247. SCR_COPY (4),
  1248. }/*-------------------------< _SMS_A150 >------------------------*/,{
  1249. 0,
  1250. RADDR_1 (temp),
  1251. SCR_RETURN,
  1252. 0,
  1253. }/*-------------------------< PM1_DATA >-------------------------*/,{
  1254. /*
  1255. * Read our host flags to SFBR, so we will be able
  1256. * to check against the data direction we expect.
  1257. */
  1258. SCR_FROM_REG (HF_REG),
  1259. 0,
  1260. /*
  1261. * Check against actual DATA PHASE.
  1262. */
  1263. SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
  1264. PADDR_A (pm1_data_out),
  1265. /*
  1266. * Actual phase is DATA IN.
  1267. * Check against expected direction.
  1268. */
  1269. SCR_JUMP ^ IFFALSE (MASK (HF_DATA_IN, HF_DATA_IN)),
  1270. PADDR_B (data_ovrun),
  1271. /*
  1272. * Keep track we are moving data from the
  1273. * PM1 DATA mini-script.
  1274. */
  1275. SCR_REG_REG (HF_REG, SCR_OR, HF_IN_PM1),
  1276. 0,
  1277. /*
  1278. * Move the data to memory.
  1279. */
  1280. SCR_CHMOV_TBL ^ SCR_DATA_IN,
  1281. offsetof (struct sym_ccb, phys.pm1.sg),
  1282. SCR_JUMP,
  1283. PADDR_A (pm1_data_end),
  1284. }/*-------------------------< PM1_DATA_OUT >---------------------*/,{
  1285. /*
  1286. * Actual phase is DATA OUT.
  1287. * Check against expected direction.
  1288. */
  1289. SCR_JUMP ^ IFTRUE (MASK (HF_DATA_IN, HF_DATA_IN)),
  1290. PADDR_B (data_ovrun),
  1291. /*
  1292. * Keep track we are moving data from the
  1293. * PM1 DATA mini-script.
  1294. */
  1295. SCR_REG_REG (HF_REG, SCR_OR, HF_IN_PM1),
  1296. 0,
  1297. /*
  1298. * Move the data from memory.
  1299. */
  1300. SCR_CHMOV_TBL ^ SCR_DATA_OUT,
  1301. offsetof (struct sym_ccb, phys.pm1.sg),
  1302. }/*-------------------------< PM1_DATA_END >---------------------*/,{
  1303. /*
  1304. * Clear the flag that told we were moving
  1305. * data from the PM1 DATA mini-script.
  1306. */
  1307. SCR_REG_REG (HF_REG, SCR_AND, (~HF_IN_PM1)),
  1308. 0,
  1309. /*
  1310. * Return to the previous DATA script which
  1311. * is guaranteed by design (if no bug) to be
  1312. * the main DATA script for this transfer.
  1313. */
  1314. SCR_COPY (4),
  1315. RADDR_1 (dsa),
  1316. RADDR_1 (scratcha),
  1317. SCR_REG_REG (scratcha, SCR_ADD, offsetof (struct sym_ccb,phys.pm1.ret)),
  1318. 0,
  1319. SCR_JUMP,
  1320. PADDR_A (pm_data_end),
  1321. }/*--------------------------<>----------------------------------*/
  1322. };
  1323. static struct SYM_FWB_SCR SYM_FWB_SCR = {
  1324. /*-------------------------< NO_DATA >--------------------------*/ {
  1325. SCR_JUMP,
  1326. PADDR_B (data_ovrun),
  1327. }/*-------------------------< SEL_FOR_ABORT >--------------------*/,{
  1328. /*
  1329. * We are jumped here by the C code, if we have
  1330. * some target to reset or some disconnected
  1331. * job to abort. Since error recovery is a serious
  1332. * busyness, we will really reset the SCSI BUS, if
  1333. * case of a SCSI interrupt occurring in this path.
  1334. */
  1335. #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
  1336. /*
  1337. * Set initiator mode.
  1338. */
  1339. SCR_CLR (SCR_TRG),
  1340. 0,
  1341. #endif
  1342. /*
  1343. * And try to select this target.
  1344. */
  1345. SCR_SEL_TBL_ATN ^ offsetof (struct sym_hcb, abrt_sel),
  1346. PADDR_A (reselect),
  1347. /*
  1348. * Wait for the selection to complete or
  1349. * the selection to time out.
  1350. */
  1351. SCR_JUMPR ^ IFFALSE (WHEN (SCR_MSG_OUT)),
  1352. -8,
  1353. /*
  1354. * Call the C code.
  1355. */
  1356. SCR_INT,
  1357. SIR_TARGET_SELECTED,
  1358. /*
  1359. * The C code should let us continue here.
  1360. * Send the 'kiss of death' message.
  1361. * We expect an immediate disconnect once
  1362. * the target has eaten the message.
  1363. */
  1364. SCR_REG_REG (scntl2, SCR_AND, 0x7f),
  1365. 0,
  1366. SCR_MOVE_TBL ^ SCR_MSG_OUT,
  1367. offsetof (struct sym_hcb, abrt_tbl),
  1368. SCR_CLR (SCR_ACK|SCR_ATN),
  1369. 0,
  1370. SCR_WAIT_DISC,
  1371. 0,
  1372. /*
  1373. * Tell the C code that we are done.
  1374. */
  1375. SCR_INT,
  1376. SIR_ABORT_SENT,
  1377. }/*-------------------------< SEL_FOR_ABORT_1 >------------------*/,{
  1378. /*
  1379. * Jump at scheduler.
  1380. */
  1381. SCR_JUMP,
  1382. PADDR_A (start),
  1383. }/*-------------------------< MSG_IN_ETC >-----------------------*/,{
  1384. /*
  1385. * If it is an EXTENDED (variable size message)
  1386. * Handle it.
  1387. */
  1388. SCR_JUMP ^ IFTRUE (DATA (M_EXTENDED)),
  1389. PADDR_B (msg_extended),
  1390. /*
  1391. * Let the C code handle any other
  1392. * 1 byte message.
  1393. */
  1394. SCR_JUMP ^ IFTRUE (MASK (0x00, 0xf0)),
  1395. PADDR_B (msg_received),
  1396. SCR_JUMP ^ IFTRUE (MASK (0x10, 0xf0)),
  1397. PADDR_B (msg_received),
  1398. /*
  1399. * We donnot handle 2 bytes messages from SCRIPTS.
  1400. * So, let the C code deal with these ones too.
  1401. */
  1402. SCR_JUMP ^ IFFALSE (MASK (0x20, 0xf0)),
  1403. PADDR_B (msg_weird_seen),
  1404. SCR_CLR (SCR_ACK),
  1405. 0,
  1406. SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
  1407. HADDR_1 (msgin[1]),
  1408. }/*-------------------------< MSG_RECEIVED >---------------------*/,{
  1409. SCR_COPY (4), /* DUMMY READ */
  1410. HADDR_1 (scratch),
  1411. RADDR_1 (scratcha),
  1412. SCR_INT,
  1413. SIR_MSG_RECEIVED,
  1414. }/*-------------------------< MSG_WEIRD_SEEN >-------------------*/,{
  1415. SCR_COPY (4), /* DUMMY READ */
  1416. HADDR_1 (scratch),
  1417. RADDR_1 (scratcha),
  1418. SCR_INT,
  1419. SIR_MSG_WEIRD,
  1420. }/*-------------------------< MSG_EXTENDED >---------------------*/,{
  1421. /*
  1422. * Clear ACK and get the next byte
  1423. * assumed to be the message length.
  1424. */
  1425. SCR_CLR (SCR_ACK),
  1426. 0,
  1427. SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
  1428. HADDR_1 (msgin[1]),
  1429. /*
  1430. * Try to catch some unlikely situations as 0 length
  1431. * or too large the length.
  1432. */
  1433. SCR_JUMP ^ IFTRUE (DATA (0)),
  1434. PADDR_B (msg_weird_seen),
  1435. SCR_TO_REG (scratcha),
  1436. 0,
  1437. SCR_REG_REG (sfbr, SCR_ADD, (256-8)),
  1438. 0,
  1439. SCR_JUMP ^ IFTRUE (CARRYSET),
  1440. PADDR_B (msg_weird_seen),
  1441. /*
  1442. * We donnot handle extended messages from SCRIPTS.
  1443. * Read the amount of data corresponding to the
  1444. * message length and call the C code.
  1445. */
  1446. SCR_COPY (1),
  1447. RADDR_1 (scratcha),
  1448. PADDR_B (_sms_b10),
  1449. SCR_CLR (SCR_ACK),
  1450. 0,
  1451. }/*-------------------------< _SMS_B10 >-------------------------*/,{
  1452. SCR_MOVE_ABS (0) ^ SCR_MSG_IN,
  1453. HADDR_1 (msgin[2]),
  1454. SCR_JUMP,
  1455. PADDR_B (msg_received),
  1456. }/*-------------------------< MSG_BAD >--------------------------*/,{
  1457. /*
  1458. * unimplemented message - reject it.
  1459. */
  1460. SCR_INT,
  1461. SIR_REJECT_TO_SEND,
  1462. SCR_SET (SCR_ATN),
  1463. 0,
  1464. SCR_JUMP,
  1465. PADDR_A (clrack),
  1466. }/*-------------------------< MSG_WEIRD >------------------------*/,{
  1467. /*
  1468. * weird message received
  1469. * ignore all MSG IN phases and reject it.
  1470. */
  1471. SCR_INT,
  1472. SIR_REJECT_TO_SEND,
  1473. SCR_SET (SCR_ATN),
  1474. 0,
  1475. }/*-------------------------< MSG_WEIRD1 >-----------------------*/,{
  1476. SCR_CLR (SCR_ACK),
  1477. 0,
  1478. SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
  1479. PADDR_A (dispatch),
  1480. SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
  1481. HADDR_1 (scratch),
  1482. SCR_JUMP,
  1483. PADDR_B (msg_weird1),
  1484. }/*-------------------------< WDTR_RESP >------------------------*/,{
  1485. /*
  1486. * let the target fetch our answer.
  1487. */
  1488. SCR_SET (SCR_ATN),
  1489. 0,
  1490. SCR_CLR (SCR_ACK),
  1491. 0,
  1492. SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_OUT)),
  1493. PADDR_B (nego_bad_phase),
  1494. }/*-------------------------< SEND_WDTR >------------------------*/,{
  1495. /*
  1496. * Send the M_X_WIDE_REQ
  1497. */
  1498. SCR_MOVE_ABS (4) ^ SCR_MSG_OUT,
  1499. HADDR_1 (msgout),
  1500. SCR_JUMP,
  1501. PADDR_B (msg_out_done),
  1502. }/*-------------------------< SDTR_RESP >------------------------*/,{
  1503. /*
  1504. * let the target fetch our answer.
  1505. */
  1506. SCR_SET (SCR_ATN),
  1507. 0,
  1508. SCR_CLR (SCR_ACK),
  1509. 0,
  1510. SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_OUT)),
  1511. PADDR_B (nego_bad_phase),
  1512. }/*-------------------------< SEND_SDTR >------------------------*/,{
  1513. /*
  1514. * Send the M_X_SYNC_REQ
  1515. */
  1516. SCR_MOVE_ABS (5) ^ SCR_MSG_OUT,
  1517. HADDR_1 (msgout),
  1518. SCR_JUMP,
  1519. PADDR_B (msg_out_done),
  1520. }/*-------------------------< PPR_RESP >-------------------------*/,{
  1521. /*
  1522. * let the target fetch our answer.
  1523. */
  1524. SCR_SET (SCR_ATN),
  1525. 0,
  1526. SCR_CLR (SCR_ACK),
  1527. 0,
  1528. SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_OUT)),
  1529. PADDR_B (nego_bad_phase),
  1530. }/*-------------------------< SEND_PPR >-------------------------*/,{
  1531. /*
  1532. * Send the M_X_PPR_REQ
  1533. */
  1534. SCR_MOVE_ABS (8) ^ SCR_MSG_OUT,
  1535. HADDR_1 (msgout),
  1536. SCR_JUMP,
  1537. PADDR_B (msg_out_done),
  1538. }/*-------------------------< NEGO_BAD_PHASE >-------------------*/,{
  1539. SCR_INT,
  1540. SIR_NEGO_PROTO,
  1541. SCR_JUMP,
  1542. PADDR_A (dispatch),
  1543. }/*-------------------------< MSG_OUT >--------------------------*/,{
  1544. /*
  1545. * The target requests a message.
  1546. * We donnot send messages that may
  1547. * require the device to go to bus free.
  1548. */
  1549. SCR_MOVE_ABS (1) ^ SCR_MSG_OUT,
  1550. HADDR_1 (msgout),
  1551. /*
  1552. * ... wait for the next phase
  1553. * if it's a message out, send it again, ...
  1554. */
  1555. SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_OUT)),
  1556. PADDR_B (msg_out),
  1557. }/*-------------------------< MSG_OUT_DONE >---------------------*/,{
  1558. /*
  1559. * Let the C code be aware of the
  1560. * sent message and clear the message.
  1561. */
  1562. SCR_INT,
  1563. SIR_MSG_OUT_DONE,
  1564. /*
  1565. * ... and process the next phase
  1566. */
  1567. SCR_JUMP,
  1568. PADDR_A (dispatch),
  1569. }/*-------------------------< DATA_OVRUN >-----------------------*/,{
  1570. /*
  1571. * Zero scratcha that will count the
  1572. * extras bytes.
  1573. */
  1574. SCR_COPY (4),
  1575. PADDR_B (zero),
  1576. RADDR_1 (scratcha),
  1577. }/*-------------------------< DATA_OVRUN1 >----------------------*/,{
  1578. /*
  1579. * The target may want to transfer too much data.
  1580. *
  1581. * If phase is DATA OUT write 1 byte and count it.
  1582. */
  1583. SCR_JUMPR ^ IFFALSE (WHEN (SCR_DATA_OUT)),
  1584. 16,
  1585. SCR_CHMOV_ABS (1) ^ SCR_DATA_OUT,
  1586. HADDR_1 (scratch),
  1587. SCR_JUMP,
  1588. PADDR_B (data_ovrun2),
  1589. /*
  1590. * If WSR is set, clear this condition, and
  1591. * count this byte.
  1592. */
  1593. SCR_FROM_REG (scntl2),
  1594. 0,
  1595. SCR_JUMPR ^ IFFALSE (MASK (WSR, WSR)),
  1596. 16,
  1597. SCR_REG_REG (scntl2, SCR_OR, WSR),
  1598. 0,
  1599. SCR_JUMP,
  1600. PADDR_B (data_ovrun2),
  1601. /*
  1602. * Finally check against DATA IN phase.
  1603. * Signal data overrun to the C code
  1604. * and jump to dispatcher if not so.
  1605. * Read 1 byte otherwise and count it.
  1606. */
  1607. SCR_JUMPR ^ IFTRUE (WHEN (SCR_DATA_IN)),
  1608. 16,
  1609. SCR_INT,
  1610. SIR_DATA_OVERRUN,
  1611. SCR_JUMP,
  1612. PADDR_A (dispatch),
  1613. SCR_CHMOV_ABS (1) ^ SCR_DATA_IN,
  1614. HADDR_1 (scratch),
  1615. }/*-------------------------< DATA_OVRUN2 >----------------------*/,{
  1616. /*
  1617. * Count this byte.
  1618. * This will allow to return a negative
  1619. * residual to user.
  1620. */
  1621. SCR_REG_REG (scratcha, SCR_ADD, 0x01),
  1622. 0,
  1623. SCR_REG_REG (scratcha1, SCR_ADDC, 0),
  1624. 0,
  1625. SCR_REG_REG (scratcha2, SCR_ADDC, 0),
  1626. 0,
  1627. /*
  1628. * .. and repeat as required.
  1629. */
  1630. SCR_JUMP,
  1631. PADDR_B (data_ovrun1),
  1632. }/*-------------------------< ABORT_RESEL >----------------------*/,{
  1633. SCR_SET (SCR_ATN),
  1634. 0,
  1635. SCR_CLR (SCR_ACK),
  1636. 0,
  1637. /*
  1638. * send the abort/abortag/reset message
  1639. * we expect an immediate disconnect
  1640. */
  1641. SCR_REG_REG (scntl2, SCR_AND, 0x7f),
  1642. 0,
  1643. SCR_MOVE_ABS (1) ^ SCR_MSG_OUT,
  1644. HADDR_1 (msgout),
  1645. SCR_CLR (SCR_ACK|SCR_ATN),
  1646. 0,
  1647. SCR_WAIT_DISC,
  1648. 0,
  1649. SCR_INT,
  1650. SIR_RESEL_ABORTED,
  1651. SCR_JUMP,
  1652. PADDR_A (start),
  1653. }/*-------------------------< RESEND_IDENT >---------------------*/,{
  1654. /*
  1655. * The target stays in MSG OUT phase after having acked
  1656. * Identify [+ Tag [+ Extended message ]]. Targets shall
  1657. * behave this way on parity error.
  1658. * We must send it again all the messages.
  1659. */
  1660. SCR_SET (SCR_ATN), /* Shall be asserted 2 deskew delays before the */
  1661. 0, /* 1rst ACK = 90 ns. Hope the chip isn't too fast */
  1662. SCR_JUMP,
  1663. PADDR_A (send_ident),
  1664. }/*-------------------------< IDENT_BREAK >----------------------*/,{
  1665. SCR_CLR (SCR_ATN),
  1666. 0,
  1667. SCR_JUMP,
  1668. PADDR_A (select2),
  1669. }/*-------------------------< IDENT_BREAK_ATN >------------------*/,{
  1670. SCR_SET (SCR_ATN),
  1671. 0,
  1672. SCR_JUMP,
  1673. PADDR_A (select2),
  1674. }/*-------------------------< SDATA_IN >-------------------------*/,{
  1675. SCR_CHMOV_TBL ^ SCR_DATA_IN,
  1676. offsetof (struct sym_dsb, sense),
  1677. SCR_CALL,
  1678. PADDR_A (datai_done),
  1679. SCR_JUMP,
  1680. PADDR_B (data_ovrun),
  1681. }/*-------------------------< RESEL_BAD_LUN >--------------------*/,{
  1682. /*
  1683. * Message is an IDENTIFY, but lun is unknown.
  1684. * Signal problem to C code for logging the event.
  1685. * Send a M_ABORT to clear all pending tasks.
  1686. */
  1687. SCR_INT,
  1688. SIR_RESEL_BAD_LUN,
  1689. SCR_JUMP,
  1690. PADDR_B (abort_resel),
  1691. }/*-------------------------< BAD_I_T_L >------------------------*/,{
  1692. /*
  1693. * We donnot have a task for that I_T_L.
  1694. * Signal problem to C code for logging the event.
  1695. * Send a M_ABORT message.
  1696. */
  1697. SCR_INT,
  1698. SIR_RESEL_BAD_I_T_L,
  1699. SCR_JUMP,
  1700. PADDR_B (abort_resel),
  1701. }/*-------------------------< BAD_I_T_L_Q >----------------------*/,{
  1702. /*
  1703. * We donnot have a task that matches the tag.
  1704. * Signal problem to C code for logging the event.
  1705. * Send a M_ABORTTAG message.
  1706. */
  1707. SCR_INT,
  1708. SIR_RESEL_BAD_I_T_L_Q,
  1709. SCR_JUMP,
  1710. PADDR_B (abort_resel),
  1711. }/*-------------------------< BAD_STATUS >-----------------------*/,{
  1712. /*
  1713. * Anything different from INTERMEDIATE
  1714. * CONDITION MET should be a bad SCSI status,
  1715. * given that GOOD status has already been tested.
  1716. * Call the C code.
  1717. */
  1718. SCR_COPY (4),
  1719. PADDR_B (startpos),
  1720. RADDR_1 (scratcha),
  1721. SCR_INT ^ IFFALSE (DATA (S_COND_MET)),
  1722. SIR_BAD_SCSI_STATUS,
  1723. SCR_RETURN,
  1724. 0,
  1725. }/*-------------------------< WSR_MA_HELPER >--------------------*/,{
  1726. /*
  1727. * Helper for the C code when WSR bit is set.
  1728. * Perform the move of the residual byte.
  1729. */
  1730. SCR_CHMOV_TBL ^ SCR_DATA_IN,
  1731. offsetof (struct sym_ccb, phys.wresid),
  1732. SCR_JUMP,
  1733. PADDR_A (dispatch),
  1734. }/*-------------------------< ZERO >-----------------------------*/,{
  1735. SCR_DATA_ZERO,
  1736. }/*-------------------------< SCRATCH >--------------------------*/,{
  1737. SCR_DATA_ZERO, /* MUST BE BEFORE SCRATCH1 */
  1738. }/*-------------------------< SCRATCH1 >-------------------------*/,{
  1739. SCR_DATA_ZERO,
  1740. }/*-------------------------< PREV_DONE >------------------------*/,{
  1741. SCR_DATA_ZERO, /* MUST BE BEFORE DONE_POS ! */
  1742. }/*-------------------------< DONE_POS >-------------------------*/,{
  1743. SCR_DATA_ZERO,
  1744. }/*-------------------------< NEXTJOB >--------------------------*/,{
  1745. SCR_DATA_ZERO, /* MUST BE BEFORE STARTPOS ! */
  1746. }/*-------------------------< STARTPOS >-------------------------*/,{
  1747. SCR_DATA_ZERO,
  1748. }/*-------------------------< TARGTBL >--------------------------*/,{
  1749. SCR_DATA_ZERO,
  1750. }/*--------------------------<>----------------------------------*/
  1751. };
  1752. static struct SYM_FWZ_SCR SYM_FWZ_SCR = {
  1753. /*-------------------------< SNOOPTEST >------------------------*/{
  1754. /*
  1755. * Read the variable.
  1756. */
  1757. SCR_COPY (4),
  1758. HADDR_1 (scratch),
  1759. RADDR_1 (scratcha),
  1760. /*
  1761. * Write the variable.
  1762. */
  1763. SCR_COPY (4),
  1764. RADDR_1 (temp),
  1765. HADDR_1 (scratch),
  1766. /*
  1767. * Read back the variable.
  1768. */
  1769. SCR_COPY (4),
  1770. HADDR_1 (scratch),
  1771. RADDR_1 (temp),
  1772. }/*-------------------------< SNOOPEND >-------------------------*/,{
  1773. /*
  1774. * And stop.
  1775. */
  1776. SCR_INT,
  1777. 99,
  1778. }/*--------------------------<>----------------------------------*/
  1779. };