107 #include <linux/types.h>
108 #include <linux/kernel.h>
114 #include <asm/bootinfo.h>
195 static int iop_alive(
volatile struct mac_iop *iop)
204 static struct iop_msg *iop_alloc_msg(
void)
215 return &iop_msg_pool[
i];
276 iop_start(iop_base[IOP_NUM_ISM]);
277 iop_alive(iop_base[IOP_NUM_ISM]);
307 pr_err(
"Couldn't register ISM IOP interrupt\n");
311 pr_err(
"Couldn't register ISM IOP interrupt\n");
314 printk(
"IOP: oh my god, they killed the ISM IOP!\n");
316 printk(
"IOP: the ISM IOP seems to be alive.\n");
330 void (*handler)(
struct iop_msg *),
336 iop_listeners[iop_num][chan].devname = devname;
337 iop_listeners[iop_num][chan].handler =
handler;
360 iop_writeb(iop_base[iop_num], offset, msg->
reply[i]);
363 iop_writeb(iop_base[iop_num],
365 iop_interrupt(iop_base[msg->
iop_num]);
382 iop_writeb(iop, offset, msg->
message[i]);
395 static void iop_handle_send(
uint iop_num,
uint chan)
397 volatile struct mac_iop *iop = iop_base[iop_num];
402 printk(
"iop_handle_send: iop %d channel %d\n", iop_num, chan);
407 if (!(msg = iop_send_queue[iop_num][chan]))
return;
412 msg->
reply[
i] = iop_readb(iop, offset);
420 if (msg) iop_do_send(msg);
428 static void iop_handle_recv(
uint iop_num,
uint chan)
430 volatile struct mac_iop *iop = iop_base[iop_num];
435 printk(
"iop_handle_recv: iop %d channel %d\n", iop_num, chan);
438 msg = iop_alloc_msg();
447 msg->
message[
i] = iop_readb(iop, offset);
459 printk(
"iop_handle_recv: unclaimed message on iop %d channel %d\n", iop_num, chan);
460 printk(
"iop_handle_recv:");
486 if (msg_len > IOP_MSG_LEN)
return -
EINVAL;
488 msg = iop_alloc_msg();
499 if (!(q = iop_send_queue[iop_num][chan])) {
506 if (iop_readb(iop_base[iop_num],
521 if ((iop_num >=
NUM_IOPS) || !iop_base[iop_num])
return;
523 iop_loadaddr(iop_base[iop_num], shared_ram_start);
537 if ((iop_num >=
NUM_IOPS) || !iop_base[iop_num])
return;
539 iop_loadaddr(iop_base[iop_num], shared_ram_start);
555 if ((iop_num >=
NUM_IOPS) || !iop_base[iop_num])
return code_start;
557 iop_loadaddr(iop_base[iop_num], shared_ram_start);
560 if (*code_start != iop_base[iop_num]->ram_data) {
575 volatile struct mac_iop *iop = iop_base[iop_num];
587 printk(
"iop_ism_irq: new status = %02X, send states",
596 iop_handle_send(iop_num, i);
607 printk(
"iop_ism_irq: new status = %02X, recv states",
616 iop_handle_recv(iop_num, i);