sym_fw1.h 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791
  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. };