Skip to content

Commit 47fbcb9

Browse files
Finn Thaingeertu
authored andcommitted
m68k: mac: Improve IOP debug messages
Always dump the full message and reply. Avoid printing partial lines as this output gets mixed up with the output from called functions. Don't output the state of idle channels. Signed-off-by: Finn Thain <[email protected]> Tested-by: Stan Johnson <[email protected]> Cc: Joshua Thompson <[email protected]> Link: https://lore.kernel.org/r/317909d69244f06581973c5839382f5516cd9a1c.1590880333.git.fthain@telegraphics.com.au Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent adc19b2 commit 47fbcb9

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

arch/m68k/mac/iop.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ void iop_complete_message(struct iop_msg *msg)
347347
int chan = msg->channel;
348348
int i,offset;
349349

350-
iop_pr_debug("msg %p iop_num %d channel %d\n", msg, msg->iop_num,
351-
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);
352352

353353
offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN);
354354

@@ -372,6 +372,9 @@ static void iop_do_send(struct iop_msg *msg)
372372
volatile struct mac_iop *iop = iop_base[msg->iop_num];
373373
int i,offset;
374374

375+
iop_pr_debug("iop_num %d chan %d message %*ph\n",
376+
msg->iop_num, msg->channel, IOP_MSG_LEN, msg->message);
377+
375378
offset = IOP_ADDR_SEND_MSG + (msg->channel * IOP_MSG_LEN);
376379

377380
for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) {
@@ -394,8 +397,6 @@ static void iop_handle_send(uint iop_num, uint chan)
394397
struct iop_msg *msg;
395398
int i,offset;
396399

397-
iop_pr_debug("iop_num %d chan %d\n", iop_num, chan);
398-
399400
iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE);
400401

401402
if (!(msg = iop_send_queue[iop_num][chan])) return;
@@ -405,6 +406,9 @@ static void iop_handle_send(uint iop_num, uint chan)
405406
for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) {
406407
msg->reply[i] = iop_readb(iop, offset);
407408
}
409+
iop_pr_debug("iop_num %d chan %d reply %*ph\n",
410+
iop_num, chan, IOP_MSG_LEN, msg->reply);
411+
408412
if (msg->handler) (*msg->handler)(msg);
409413
msg->status = IOP_MSGSTATUS_UNUSED;
410414
msg = msg->next;
@@ -424,8 +428,6 @@ static void iop_handle_recv(uint iop_num, uint chan)
424428
int i,offset;
425429
struct iop_msg *msg;
426430

427-
iop_pr_debug("iop_num %d chan %d\n", iop_num, chan);
428-
429431
msg = iop_get_unused_msg();
430432
msg->iop_num = iop_num;
431433
msg->channel = chan;
@@ -437,6 +439,8 @@ static void iop_handle_recv(uint iop_num, uint chan)
437439
for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) {
438440
msg->message[i] = iop_readb(iop, offset);
439441
}
442+
iop_pr_debug("iop_num %d chan %d message %*ph\n",
443+
iop_num, chan, IOP_MSG_LEN, msg->message);
440444

441445
iop_writeb(iop, IOP_ADDR_RECV_STATE + chan, IOP_MSG_RCVD);
442446

@@ -446,9 +450,6 @@ static void iop_handle_recv(uint iop_num, uint chan)
446450
if (msg->handler) {
447451
(*msg->handler)(msg);
448452
} else {
449-
iop_pr_debug("unclaimed message on iop_num %d chan %d\n",
450-
iop_num, chan);
451-
iop_pr_debug("%*ph\n", IOP_MSG_LEN, msg->message);
452453
memset(msg->reply, 0, IOP_MSG_LEN);
453454
iop_complete_message(msg);
454455
}
@@ -559,35 +560,34 @@ irqreturn_t iop_ism_irq(int irq, void *dev_id)
559560
int i,state;
560561
u8 events = iop->status_ctrl & (IOP_INT0 | IOP_INT1);
561562

562-
iop_pr_debug("status %02X\n", iop->status_ctrl);
563-
564563
do {
564+
iop_pr_debug("iop_num %d status %02X\n", iop_num,
565+
iop->status_ctrl);
566+
565567
/* INT0 indicates state change on an outgoing message channel */
566568
if (events & IOP_INT0) {
567569
iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC;
568-
iop_pr_debug("new status %02X, send states",
569-
iop->status_ctrl);
570570
for (i = 0; i < NUM_IOP_CHAN; i++) {
571571
state = iop_readb(iop, IOP_ADDR_SEND_STATE + i);
572-
iop_pr_cont(" %02X", state);
573572
if (state == IOP_MSG_COMPLETE)
574573
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);
575577
}
576-
iop_pr_cont("\n");
577578
}
578579

579580
/* INT1 for incoming messages */
580581
if (events & IOP_INT1) {
581582
iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC;
582-
iop_pr_debug("new status %02X, recv states",
583-
iop->status_ctrl);
584583
for (i = 0; i < NUM_IOP_CHAN; i++) {
585584
state = iop_readb(iop, IOP_ADDR_RECV_STATE + i);
586-
iop_pr_cont(" %02X", state);
587585
if (state == IOP_MSG_NEW)
588586
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);
589590
}
590-
iop_pr_cont("\n");
591591
}
592592

593593
events = iop->status_ctrl & (IOP_INT0 | IOP_INT1);

0 commit comments

Comments
 (0)