iop.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /*
  2. * I/O Processor (IOP) management
  3. * Written and (C) 1999 by Joshua M. Thompson (funaho@jurai.org)
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice and this list of conditions.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice and this list of conditions in the documentation and/or other
  12. * materials provided with the distribution.
  13. */
  14. /*
  15. * The IOP chips are used in the IIfx and some Quadras (900, 950) to manage
  16. * serial and ADB. They are actually a 6502 processor and some glue logic.
  17. *
  18. * 990429 (jmt) - Initial implementation, just enough to knock the SCC IOP
  19. * into compatible mode so nobody has to fiddle with the
  20. * Serial Switch control panel anymore.
  21. * 990603 (jmt) - Added code to grab the correct ISM IOP interrupt for OSS
  22. * and non-OSS machines (at least I hope it's correct on a
  23. * non-OSS machine -- someone with a Q900 or Q950 needs to
  24. * check this.)
  25. * 990605 (jmt) - Rearranged things a bit wrt IOP detection; iop_present is
  26. * gone, IOP base addresses are now in an array and the
  27. * globally-visible functions take an IOP number instead of an
  28. * an actual base address.
  29. * 990610 (jmt) - Finished the message passing framework and it seems to work.
  30. * Sending _definitely_ works; my adb-bus.c mods can send
  31. * messages and receive the MSG_COMPLETED status back from the
  32. * IOP. The trick now is figuring out the message formats.
  33. * 990611 (jmt) - More cleanups. Fixed problem where unclaimed messages on a
  34. * receive channel were never properly acknowledged. Bracketed
  35. * the remaining debug printk's with #ifdef's and disabled
  36. * debugging. I can now type on the console.
  37. * 990612 (jmt) - Copyright notice added. Reworked the way replies are handled.
  38. * It turns out that replies are placed back in the send buffer
  39. * for that channel; messages on the receive channels are always
  40. * unsolicited messages from the IOP (and our replies to them
  41. * should go back in the receive channel.) Also added tracking
  42. * of device names to the listener functions ala the interrupt
  43. * handlers.
  44. * 990729 (jmt) - Added passing of pt_regs structure to IOP handlers. This is
  45. * used by the new unified ADB driver.
  46. *
  47. * TODO:
  48. *
  49. * o Something should be periodically checking iop_alive() to make sure the
  50. * IOP hasn't died.
  51. * o Some of the IOP manager routines need better error checking and
  52. * return codes. Nothing major, just prettying up.
  53. */
  54. /*
  55. * -----------------------
  56. * IOP Message Passing 101
  57. * -----------------------
  58. *
  59. * The host talks to the IOPs using a rather simple message-passing scheme via
  60. * a shared memory area in the IOP RAM. Each IOP has seven "channels"; each
  61. * channel is connected to a specific software driver on the IOP. For example
  62. * on the SCC IOP there is one channel for each serial port. Each channel has
  63. * an incoming and and outgoing message queue with a depth of one.
  64. *
  65. * A message is 32 bytes plus a state byte for the channel (MSG_IDLE, MSG_NEW,
  66. * MSG_RCVD, MSG_COMPLETE). To send a message you copy the message into the
  67. * buffer, set the state to MSG_NEW and signal the IOP by setting the IRQ flag
  68. * in the IOP control to 1. The IOP will move the state to MSG_RCVD when it
  69. * receives the message and then to MSG_COMPLETE when the message processing
  70. * has completed. It is the host's responsibility at that point to read the
  71. * reply back out of the send channel buffer and reset the channel state back
  72. * to MSG_IDLE.
  73. *
  74. * To receive message from the IOP the same procedure is used except the roles
  75. * are reversed. That is, the IOP puts message in the channel with a state of
  76. * MSG_NEW, and the host receives the message and move its state to MSG_RCVD
  77. * and then to MSG_COMPLETE when processing is completed and the reply (if any)
  78. * has been placed back in the receive channel. The IOP will then reset the
  79. * channel state to MSG_IDLE.
  80. *
  81. * Two sets of host interrupts are provided, INT0 and INT1. Both appear on one
  82. * interrupt level; they are distinguished by a pair of bits in the IOP status
  83. * register. The IOP will raise INT0 when one or more messages in the send
  84. * channels have gone to the MSG_COMPLETE state and it will raise INT1 when one
  85. * or more messages on the receive channels have gone to the MSG_NEW state.
  86. *
  87. * Since each channel handles only one message we have to implement a small
  88. * interrupt-driven queue on our end. Messages to be sent are placed on the
  89. * queue for sending and contain a pointer to an optional callback function.
  90. * The handler for a message is called when the message state goes to
  91. * MSG_COMPLETE.
  92. *
  93. * For receiving message we maintain a list of handler functions to call when
  94. * a message is received on that IOP/channel combination. The handlers are
  95. * called much like an interrupt handler and are passed a copy of the message
  96. * from the IOP. The message state will be in MSG_RCVD while the handler runs;
  97. * it is the handler's responsibility to call iop_complete_message() when
  98. * finished; this function moves the message state to MSG_COMPLETE and signals
  99. * the IOP. This two-step process is provided to allow the handler to defer
  100. * message processing to a bottom-half handler if the processing will take
  101. * a significant amount of time (handlers are called at interrupt time so they
  102. * should execute quickly.)
  103. */
  104. #include <linux/types.h>
  105. #include <linux/kernel.h>
  106. #include <linux/mm.h>
  107. #include <linux/delay.h>
  108. #include <linux/init.h>
  109. #include <linux/interrupt.h>
  110. #include <asm/macintosh.h>
  111. #include <asm/macints.h>
  112. #include <asm/mac_iop.h>
  113. #ifdef DEBUG
  114. #define iop_pr_debug(fmt, ...) \
  115. printk(KERN_DEBUG "%s: " fmt, __func__, ##__VA_ARGS__)
  116. #define iop_pr_cont(fmt, ...) \
  117. printk(KERN_CONT fmt, ##__VA_ARGS__)
  118. #else
  119. #define iop_pr_debug(fmt, ...) \
  120. no_printk(KERN_DEBUG "%s: " fmt, __func__, ##__VA_ARGS__)
  121. #define iop_pr_cont(fmt, ...) \
  122. no_printk(KERN_CONT fmt, ##__VA_ARGS__)
  123. #endif
  124. /* Non-zero if the IOPs are present */
  125. int iop_scc_present, iop_ism_present;
  126. /* structure for tracking channel listeners */
  127. struct listener {
  128. const char *devname;
  129. void (*handler)(struct iop_msg *);
  130. };
  131. /*
  132. * IOP structures for the two IOPs
  133. *
  134. * The SCC IOP controls both serial ports (A and B) as its two functions.
  135. * The ISM IOP controls the SWIM (floppy drive) and ADB.
  136. */
  137. static volatile struct mac_iop *iop_base[NUM_IOPS];
  138. /*
  139. * IOP message queues
  140. */
  141. static struct iop_msg iop_msg_pool[NUM_IOP_MSGS];
  142. static struct iop_msg *iop_send_queue[NUM_IOPS][NUM_IOP_CHAN];
  143. static struct listener iop_listeners[NUM_IOPS][NUM_IOP_CHAN];
  144. irqreturn_t iop_ism_irq(int, void *);
  145. /*
  146. * Private access functions
  147. */
  148. static __inline__ void iop_loadaddr(volatile struct mac_iop *iop, __u16 addr)
  149. {
  150. iop->ram_addr_lo = addr;
  151. iop->ram_addr_hi = addr >> 8;
  152. }
  153. static __inline__ __u8 iop_readb(volatile struct mac_iop *iop, __u16 addr)
  154. {
  155. iop->ram_addr_lo = addr;
  156. iop->ram_addr_hi = addr >> 8;
  157. return iop->ram_data;
  158. }
  159. static __inline__ void iop_writeb(volatile struct mac_iop *iop, __u16 addr, __u8 data)
  160. {
  161. iop->ram_addr_lo = addr;
  162. iop->ram_addr_hi = addr >> 8;
  163. iop->ram_data = data;
  164. }
  165. static __inline__ void iop_stop(volatile struct mac_iop *iop)
  166. {
  167. iop->status_ctrl &= ~IOP_RUN;
  168. }
  169. static __inline__ void iop_start(volatile struct mac_iop *iop)
  170. {
  171. iop->status_ctrl = IOP_RUN | IOP_AUTOINC;
  172. }
  173. static __inline__ void iop_bypass(volatile struct mac_iop *iop)
  174. {
  175. iop->status_ctrl |= IOP_BYPASS;
  176. }
  177. static __inline__ void iop_interrupt(volatile struct mac_iop *iop)
  178. {
  179. iop->status_ctrl |= IOP_IRQ;
  180. }
  181. static int iop_alive(volatile struct mac_iop *iop)
  182. {
  183. int retval;
  184. retval = (iop_readb(iop, IOP_ADDR_ALIVE) == 0xFF);
  185. iop_writeb(iop, IOP_ADDR_ALIVE, 0);
  186. return retval;
  187. }
  188. static struct iop_msg *iop_get_unused_msg(void)
  189. {
  190. int i;
  191. unsigned long flags;
  192. local_irq_save(flags);
  193. for (i = 0 ; i < NUM_IOP_MSGS ; i++) {
  194. if (iop_msg_pool[i].status == IOP_MSGSTATUS_UNUSED) {
  195. iop_msg_pool[i].status = IOP_MSGSTATUS_WAITING;
  196. local_irq_restore(flags);
  197. return &iop_msg_pool[i];
  198. }
  199. }
  200. local_irq_restore(flags);
  201. return NULL;
  202. }
  203. /*
  204. * This is called by the startup code before anything else. Its purpose
  205. * is to find and initialize the IOPs early in the boot sequence, so that
  206. * the serial IOP can be placed into bypass mode _before_ we try to
  207. * initialize the serial console.
  208. */
  209. void __init iop_preinit(void)
  210. {
  211. if (macintosh_config->scc_type == MAC_SCC_IOP) {
  212. if (macintosh_config->ident == MAC_MODEL_IIFX) {
  213. iop_base[IOP_NUM_SCC] = (struct mac_iop *) SCC_IOP_BASE_IIFX;
  214. } else {
  215. iop_base[IOP_NUM_SCC] = (struct mac_iop *) SCC_IOP_BASE_QUADRA;
  216. }
  217. iop_base[IOP_NUM_SCC]->status_ctrl = 0x87;
  218. iop_scc_present = 1;
  219. } else {
  220. iop_base[IOP_NUM_SCC] = NULL;
  221. iop_scc_present = 0;
  222. }
  223. if (macintosh_config->adb_type == MAC_ADB_IOP) {
  224. if (macintosh_config->ident == MAC_MODEL_IIFX) {
  225. iop_base[IOP_NUM_ISM] = (struct mac_iop *) ISM_IOP_BASE_IIFX;
  226. } else {
  227. iop_base[IOP_NUM_ISM] = (struct mac_iop *) ISM_IOP_BASE_QUADRA;
  228. }
  229. iop_base[IOP_NUM_ISM]->status_ctrl = 0;
  230. iop_ism_present = 1;
  231. } else {
  232. iop_base[IOP_NUM_ISM] = NULL;
  233. iop_ism_present = 0;
  234. }
  235. }
  236. /*
  237. * Initialize the IOPs, if present.
  238. */
  239. void __init iop_init(void)
  240. {
  241. int i;
  242. if (iop_scc_present) {
  243. pr_debug("SCC IOP detected at %p\n", iop_base[IOP_NUM_SCC]);
  244. }
  245. if (iop_ism_present) {
  246. pr_debug("ISM IOP detected at %p\n", iop_base[IOP_NUM_ISM]);
  247. iop_start(iop_base[IOP_NUM_ISM]);
  248. iop_alive(iop_base[IOP_NUM_ISM]); /* clears the alive flag */
  249. }
  250. /* Make the whole pool available and empty the queues */
  251. for (i = 0 ; i < NUM_IOP_MSGS ; i++) {
  252. iop_msg_pool[i].status = IOP_MSGSTATUS_UNUSED;
  253. }
  254. for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
  255. iop_send_queue[IOP_NUM_SCC][i] = NULL;
  256. iop_send_queue[IOP_NUM_ISM][i] = NULL;
  257. iop_listeners[IOP_NUM_SCC][i].devname = NULL;
  258. iop_listeners[IOP_NUM_SCC][i].handler = NULL;
  259. iop_listeners[IOP_NUM_ISM][i].devname = NULL;
  260. iop_listeners[IOP_NUM_ISM][i].handler = NULL;
  261. }
  262. }
  263. /*
  264. * Register the interrupt handler for the IOPs.
  265. * TODO: might be wrong for non-OSS machines. Anyone?
  266. */
  267. void __init iop_register_interrupts(void)
  268. {
  269. if (iop_ism_present) {
  270. if (macintosh_config->ident == MAC_MODEL_IIFX) {
  271. if (request_irq(IRQ_MAC_ADB, iop_ism_irq, 0,
  272. "ISM IOP", (void *)IOP_NUM_ISM))
  273. pr_err("Couldn't register ISM IOP interrupt\n");
  274. } else {
  275. if (request_irq(IRQ_VIA2_0, iop_ism_irq, 0, "ISM IOP",
  276. (void *)IOP_NUM_ISM))
  277. pr_err("Couldn't register ISM IOP interrupt\n");
  278. }
  279. if (!iop_alive(iop_base[IOP_NUM_ISM])) {
  280. pr_warn("IOP: oh my god, they killed the ISM IOP!\n");
  281. } else {
  282. pr_warn("IOP: the ISM IOP seems to be alive.\n");
  283. }
  284. }
  285. }
  286. /*
  287. * Register or unregister a listener for a specific IOP and channel
  288. *
  289. * If the handler pointer is NULL the current listener (if any) is
  290. * unregistered. Otherwise the new listener is registered provided
  291. * there is no existing listener registered.
  292. */
  293. int iop_listen(uint iop_num, uint chan,
  294. void (*handler)(struct iop_msg *),
  295. const char *devname)
  296. {
  297. if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return -EINVAL;
  298. if (chan >= NUM_IOP_CHAN) return -EINVAL;
  299. if (iop_listeners[iop_num][chan].handler && handler) return -EINVAL;
  300. iop_listeners[iop_num][chan].devname = devname;
  301. iop_listeners[iop_num][chan].handler = handler;
  302. return 0;
  303. }
  304. /*
  305. * Complete reception of a message, which just means copying the reply
  306. * into the buffer, setting the channel state to MSG_COMPLETE and
  307. * notifying the IOP.
  308. */
  309. void iop_complete_message(struct iop_msg *msg)
  310. {
  311. int iop_num = msg->iop_num;
  312. int chan = msg->channel;
  313. int i,offset;
  314. iop_pr_debug("msg %p iop_num %d channel %d\n", msg, msg->iop_num,
  315. msg->channel);
  316. offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN);
  317. for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) {
  318. iop_writeb(iop_base[iop_num], offset, msg->reply[i]);
  319. }
  320. iop_writeb(iop_base[iop_num],
  321. IOP_ADDR_RECV_STATE + chan, IOP_MSG_COMPLETE);
  322. iop_interrupt(iop_base[msg->iop_num]);
  323. msg->status = IOP_MSGSTATUS_UNUSED;
  324. }
  325. /*
  326. * Actually put a message into a send channel buffer
  327. */
  328. static void iop_do_send(struct iop_msg *msg)
  329. {
  330. volatile struct mac_iop *iop = iop_base[msg->iop_num];
  331. int i,offset;
  332. offset = IOP_ADDR_SEND_MSG + (msg->channel * IOP_MSG_LEN);
  333. for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) {
  334. iop_writeb(iop, offset, msg->message[i]);
  335. }
  336. iop_writeb(iop, IOP_ADDR_SEND_STATE + msg->channel, IOP_MSG_NEW);
  337. iop_interrupt(iop);
  338. }
  339. /*
  340. * Handle sending a message on a channel that
  341. * has gone into the IOP_MSG_COMPLETE state.
  342. */
  343. static void iop_handle_send(uint iop_num, uint chan)
  344. {
  345. volatile struct mac_iop *iop = iop_base[iop_num];
  346. struct iop_msg *msg;
  347. int i,offset;
  348. iop_pr_debug("iop_num %d chan %d\n", iop_num, chan);
  349. iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE);
  350. if (!(msg = iop_send_queue[iop_num][chan])) return;
  351. msg->status = IOP_MSGSTATUS_COMPLETE;
  352. offset = IOP_ADDR_SEND_MSG + (chan * IOP_MSG_LEN);
  353. for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) {
  354. msg->reply[i] = iop_readb(iop, offset);
  355. }
  356. if (msg->handler) (*msg->handler)(msg);
  357. msg->status = IOP_MSGSTATUS_UNUSED;
  358. msg = msg->next;
  359. iop_send_queue[iop_num][chan] = msg;
  360. if (msg) iop_do_send(msg);
  361. }
  362. /*
  363. * Handle reception of a message on a channel that has
  364. * gone into the IOP_MSG_NEW state.
  365. */
  366. static void iop_handle_recv(uint iop_num, uint chan)
  367. {
  368. volatile struct mac_iop *iop = iop_base[iop_num];
  369. int i,offset;
  370. struct iop_msg *msg;
  371. iop_pr_debug("iop_num %d chan %d\n", iop_num, chan);
  372. msg = iop_get_unused_msg();
  373. msg->iop_num = iop_num;
  374. msg->channel = chan;
  375. msg->status = IOP_MSGSTATUS_UNSOL;
  376. msg->handler = iop_listeners[iop_num][chan].handler;
  377. offset = IOP_ADDR_RECV_MSG + (chan * IOP_MSG_LEN);
  378. for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) {
  379. msg->message[i] = iop_readb(iop, offset);
  380. }
  381. iop_writeb(iop, IOP_ADDR_RECV_STATE + chan, IOP_MSG_RCVD);
  382. /* If there is a listener, call it now. Otherwise complete */
  383. /* the message ourselves to avoid possible stalls. */
  384. if (msg->handler) {
  385. (*msg->handler)(msg);
  386. } else {
  387. iop_pr_debug("unclaimed message on iop_num %d chan %d\n",
  388. iop_num, chan);
  389. iop_pr_debug("%*ph\n", IOP_MSG_LEN, msg->message);
  390. iop_complete_message(msg);
  391. }
  392. }
  393. /*
  394. * Send a message
  395. *
  396. * The message is placed at the end of the send queue. Afterwards if the
  397. * channel is idle we force an immediate send of the next message in the
  398. * queue.
  399. */
  400. int iop_send_message(uint iop_num, uint chan, void *privdata,
  401. uint msg_len, __u8 *msg_data,
  402. void (*handler)(struct iop_msg *))
  403. {
  404. struct iop_msg *msg, *q;
  405. if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return -EINVAL;
  406. if (chan >= NUM_IOP_CHAN) return -EINVAL;
  407. if (msg_len > IOP_MSG_LEN) return -EINVAL;
  408. msg = iop_get_unused_msg();
  409. if (!msg) return -ENOMEM;
  410. msg->next = NULL;
  411. msg->status = IOP_MSGSTATUS_WAITING;
  412. msg->iop_num = iop_num;
  413. msg->channel = chan;
  414. msg->caller_priv = privdata;
  415. memcpy(msg->message, msg_data, msg_len);
  416. msg->handler = handler;
  417. if (!(q = iop_send_queue[iop_num][chan])) {
  418. iop_send_queue[iop_num][chan] = msg;
  419. } else {
  420. while (q->next) q = q->next;
  421. q->next = msg;
  422. }
  423. if (iop_readb(iop_base[iop_num],
  424. IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) {
  425. iop_do_send(msg);
  426. }
  427. return 0;
  428. }
  429. /*
  430. * Upload code to the shared RAM of an IOP.
  431. */
  432. void iop_upload_code(uint iop_num, __u8 *code_start,
  433. uint code_len, __u16 shared_ram_start)
  434. {
  435. if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return;
  436. iop_loadaddr(iop_base[iop_num], shared_ram_start);
  437. while (code_len--) {
  438. iop_base[iop_num]->ram_data = *code_start++;
  439. }
  440. }
  441. /*
  442. * Download code from the shared RAM of an IOP.
  443. */
  444. void iop_download_code(uint iop_num, __u8 *code_start,
  445. uint code_len, __u16 shared_ram_start)
  446. {
  447. if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return;
  448. iop_loadaddr(iop_base[iop_num], shared_ram_start);
  449. while (code_len--) {
  450. *code_start++ = iop_base[iop_num]->ram_data;
  451. }
  452. }
  453. /*
  454. * Compare the code in the shared RAM of an IOP with a copy in system memory
  455. * and return 0 on match or the first nonmatching system memory address on
  456. * failure.
  457. */
  458. __u8 *iop_compare_code(uint iop_num, __u8 *code_start,
  459. uint code_len, __u16 shared_ram_start)
  460. {
  461. if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return code_start;
  462. iop_loadaddr(iop_base[iop_num], shared_ram_start);
  463. while (code_len--) {
  464. if (*code_start != iop_base[iop_num]->ram_data) {
  465. return code_start;
  466. }
  467. code_start++;
  468. }
  469. return (__u8 *) 0;
  470. }
  471. /*
  472. * Handle an ISM IOP interrupt
  473. */
  474. irqreturn_t iop_ism_irq(int irq, void *dev_id)
  475. {
  476. uint iop_num = (uint) dev_id;
  477. volatile struct mac_iop *iop = iop_base[iop_num];
  478. int i,state;
  479. iop_pr_debug("status %02X\n", iop->status_ctrl);
  480. /* INT0 indicates a state change on an outgoing message channel */
  481. if (iop->status_ctrl & IOP_INT0) {
  482. iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC;
  483. iop_pr_debug("new status %02X, send states", iop->status_ctrl);
  484. for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
  485. state = iop_readb(iop, IOP_ADDR_SEND_STATE + i);
  486. iop_pr_cont(" %02X", state);
  487. if (state == IOP_MSG_COMPLETE) {
  488. iop_handle_send(iop_num, i);
  489. }
  490. }
  491. iop_pr_cont("\n");
  492. }
  493. if (iop->status_ctrl & IOP_INT1) { /* INT1 for incoming msgs */
  494. iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC;
  495. iop_pr_debug("new status %02X, recv states", iop->status_ctrl);
  496. for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
  497. state = iop_readb(iop, IOP_ADDR_RECV_STATE + i);
  498. iop_pr_cont(" %02X", state);
  499. if (state == IOP_MSG_NEW) {
  500. iop_handle_recv(iop_num, i);
  501. }
  502. }
  503. iop_pr_cont("\n");
  504. }
  505. return IRQ_HANDLED;
  506. }
  507. void iop_ism_irq_poll(uint iop_num)
  508. {
  509. unsigned long flags;
  510. local_irq_save(flags);
  511. iop_ism_irq(0, (void *)iop_num);
  512. local_irq_restore(flags);
  513. }