| .. | .. |
|---|
| 293 | 293 | |
|---|
| 294 | 294 | /* |
|---|
| 295 | 295 | * Register the interrupt handler for the IOPs. |
|---|
| 296 | | - * TODO: might be wrong for non-OSS machines. Anyone? |
|---|
| 297 | 296 | */ |
|---|
| 298 | 297 | |
|---|
| 299 | 298 | void __init iop_register_interrupts(void) |
|---|
| .. | .. |
|---|
| 348 | 347 | int chan = msg->channel; |
|---|
| 349 | 348 | int i,offset; |
|---|
| 350 | 349 | |
|---|
| 351 | | - iop_pr_debug("msg %p iop_num %d channel %d\n", msg, msg->iop_num, |
|---|
| 352 | | - msg->channel); |
|---|
| 350 | + iop_pr_debug("iop_num %d chan %d reply %*ph\n", |
|---|
| 351 | + msg->iop_num, msg->channel, IOP_MSG_LEN, msg->reply); |
|---|
| 353 | 352 | |
|---|
| 354 | 353 | offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN); |
|---|
| 355 | 354 | |
|---|
| .. | .. |
|---|
| 373 | 372 | volatile struct mac_iop *iop = iop_base[msg->iop_num]; |
|---|
| 374 | 373 | int i,offset; |
|---|
| 375 | 374 | |
|---|
| 375 | + iop_pr_debug("iop_num %d chan %d message %*ph\n", |
|---|
| 376 | + msg->iop_num, msg->channel, IOP_MSG_LEN, msg->message); |
|---|
| 377 | + |
|---|
| 376 | 378 | offset = IOP_ADDR_SEND_MSG + (msg->channel * IOP_MSG_LEN); |
|---|
| 377 | 379 | |
|---|
| 378 | 380 | for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) { |
|---|
| .. | .. |
|---|
| 395 | 397 | struct iop_msg *msg; |
|---|
| 396 | 398 | int i,offset; |
|---|
| 397 | 399 | |
|---|
| 398 | | - iop_pr_debug("iop_num %d chan %d\n", iop_num, chan); |
|---|
| 399 | | - |
|---|
| 400 | 400 | iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE); |
|---|
| 401 | 401 | |
|---|
| 402 | 402 | if (!(msg = iop_send_queue[iop_num][chan])) return; |
|---|
| .. | .. |
|---|
| 406 | 406 | for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) { |
|---|
| 407 | 407 | msg->reply[i] = iop_readb(iop, offset); |
|---|
| 408 | 408 | } |
|---|
| 409 | + iop_pr_debug("iop_num %d chan %d reply %*ph\n", |
|---|
| 410 | + iop_num, chan, IOP_MSG_LEN, msg->reply); |
|---|
| 411 | + |
|---|
| 409 | 412 | if (msg->handler) (*msg->handler)(msg); |
|---|
| 410 | 413 | msg->status = IOP_MSGSTATUS_UNUSED; |
|---|
| 411 | 414 | msg = msg->next; |
|---|
| .. | .. |
|---|
| 425 | 428 | int i,offset; |
|---|
| 426 | 429 | struct iop_msg *msg; |
|---|
| 427 | 430 | |
|---|
| 428 | | - iop_pr_debug("iop_num %d chan %d\n", iop_num, chan); |
|---|
| 429 | | - |
|---|
| 430 | 431 | msg = iop_get_unused_msg(); |
|---|
| 431 | 432 | msg->iop_num = iop_num; |
|---|
| 432 | 433 | msg->channel = chan; |
|---|
| .. | .. |
|---|
| 438 | 439 | for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) { |
|---|
| 439 | 440 | msg->message[i] = iop_readb(iop, offset); |
|---|
| 440 | 441 | } |
|---|
| 442 | + iop_pr_debug("iop_num %d chan %d message %*ph\n", |
|---|
| 443 | + iop_num, chan, IOP_MSG_LEN, msg->message); |
|---|
| 441 | 444 | |
|---|
| 442 | 445 | iop_writeb(iop, IOP_ADDR_RECV_STATE + chan, IOP_MSG_RCVD); |
|---|
| 443 | 446 | |
|---|
| .. | .. |
|---|
| 447 | 450 | if (msg->handler) { |
|---|
| 448 | 451 | (*msg->handler)(msg); |
|---|
| 449 | 452 | } else { |
|---|
| 450 | | - iop_pr_debug("unclaimed message on iop_num %d chan %d\n", |
|---|
| 451 | | - iop_num, chan); |
|---|
| 452 | | - iop_pr_debug("%*ph\n", IOP_MSG_LEN, msg->message); |
|---|
| 453 | + memset(msg->reply, 0, IOP_MSG_LEN); |
|---|
| 453 | 454 | iop_complete_message(msg); |
|---|
| 454 | 455 | } |
|---|
| 455 | 456 | } |
|---|
| .. | .. |
|---|
| 557 | 558 | uint iop_num = (uint) dev_id; |
|---|
| 558 | 559 | volatile struct mac_iop *iop = iop_base[iop_num]; |
|---|
| 559 | 560 | int i,state; |
|---|
| 561 | + u8 events = iop->status_ctrl & (IOP_INT0 | IOP_INT1); |
|---|
| 560 | 562 | |
|---|
| 561 | | - iop_pr_debug("status %02X\n", iop->status_ctrl); |
|---|
| 563 | + do { |
|---|
| 564 | + iop_pr_debug("iop_num %d status %02X\n", iop_num, |
|---|
| 565 | + iop->status_ctrl); |
|---|
| 562 | 566 | |
|---|
| 563 | | - /* INT0 indicates a state change on an outgoing message channel */ |
|---|
| 564 | | - |
|---|
| 565 | | - if (iop->status_ctrl & IOP_INT0) { |
|---|
| 566 | | - iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC; |
|---|
| 567 | | - iop_pr_debug("new status %02X, send states", iop->status_ctrl); |
|---|
| 568 | | - for (i = 0 ; i < NUM_IOP_CHAN ; i++) { |
|---|
| 569 | | - state = iop_readb(iop, IOP_ADDR_SEND_STATE + i); |
|---|
| 570 | | - iop_pr_cont(" %02X", state); |
|---|
| 571 | | - if (state == IOP_MSG_COMPLETE) { |
|---|
| 572 | | - iop_handle_send(iop_num, i); |
|---|
| 567 | + /* INT0 indicates state change on an outgoing message channel */ |
|---|
| 568 | + if (events & IOP_INT0) { |
|---|
| 569 | + iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC; |
|---|
| 570 | + for (i = 0; i < NUM_IOP_CHAN; i++) { |
|---|
| 571 | + state = iop_readb(iop, IOP_ADDR_SEND_STATE + i); |
|---|
| 572 | + if (state == IOP_MSG_COMPLETE) |
|---|
| 573 | + iop_handle_send(iop_num, i); |
|---|
| 574 | + else if (state != IOP_MSG_IDLE) |
|---|
| 575 | + iop_pr_debug("chan %d send state %02X\n", |
|---|
| 576 | + i, state); |
|---|
| 573 | 577 | } |
|---|
| 574 | 578 | } |
|---|
| 575 | | - iop_pr_cont("\n"); |
|---|
| 576 | | - } |
|---|
| 577 | 579 | |
|---|
| 578 | | - if (iop->status_ctrl & IOP_INT1) { /* INT1 for incoming msgs */ |
|---|
| 579 | | - iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC; |
|---|
| 580 | | - iop_pr_debug("new status %02X, recv states", iop->status_ctrl); |
|---|
| 581 | | - for (i = 0 ; i < NUM_IOP_CHAN ; i++) { |
|---|
| 582 | | - state = iop_readb(iop, IOP_ADDR_RECV_STATE + i); |
|---|
| 583 | | - iop_pr_cont(" %02X", state); |
|---|
| 584 | | - if (state == IOP_MSG_NEW) { |
|---|
| 585 | | - iop_handle_recv(iop_num, i); |
|---|
| 580 | + /* INT1 for incoming messages */ |
|---|
| 581 | + if (events & IOP_INT1) { |
|---|
| 582 | + iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC; |
|---|
| 583 | + for (i = 0; i < NUM_IOP_CHAN; i++) { |
|---|
| 584 | + state = iop_readb(iop, IOP_ADDR_RECV_STATE + i); |
|---|
| 585 | + if (state == IOP_MSG_NEW) |
|---|
| 586 | + iop_handle_recv(iop_num, i); |
|---|
| 587 | + else if (state != IOP_MSG_IDLE) |
|---|
| 588 | + iop_pr_debug("chan %d recv state %02X\n", |
|---|
| 589 | + i, state); |
|---|
| 586 | 590 | } |
|---|
| 587 | 591 | } |
|---|
| 588 | | - iop_pr_cont("\n"); |
|---|
| 589 | | - } |
|---|
| 592 | + |
|---|
| 593 | + events = iop->status_ctrl & (IOP_INT0 | IOP_INT1); |
|---|
| 594 | + } while (events); |
|---|
| 595 | + |
|---|
| 590 | 596 | return IRQ_HANDLED; |
|---|
| 591 | 597 | } |
|---|
| 592 | 598 | |
|---|