Skip to contentSkip to conversation

Enable magic SysRq key on SunZilog serial console

PATCH In review Martin Habets 2 participants 5 messages Aug 17, 2005 – Sep 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Enable magic SysRq key on SunZilog serial console

This patch against 2.6.10 enables the Magic SysRq commands on a SunZilog serial console.
SysRq is activated by sending a BREAK. Send a command within 5 seconds.

You may notice from the patch below that the code replaces the call to OpenBoot prompt. The 2nd part of this patch (send separately) resolves this issue.

It seems to me that all the BRK_ABRT handling in sunzilog_receive_chars() never gets executed, and could be cleaned up. Can anyone confirm/deny this?

Martin

drivers/serial/sunzilog.c renamed from drivers/serial/sunzilog.c.orig +6 -1
@@ -397,7 +397,7 @@
 			else if (r1 & CRC_ERR)
 				*tty->flip.flag_buf_ptr = TTY_FRAME;
 		}
-		if (uart_handle_sysrq_char(&up->port, ch, regs))
+		if (ch && uart_handle_sysrq_char(&up->port, ch, regs))
 			continue;
 
 		if (up->port.ignore_status_mask = 0xff ||
@@ -444,7 +444,12 @@
 				if (!(status & BRK_ABRT))
 					break;
 			}
+#ifdef SUPPORT_SYSRQ
+			up->port.icount.brk++;
+			uart_handle_break(&up->port);
+#else
 			sun_do_break();
+#endif
 			return;
 		}
 	}
#1 lore raw

From: Martin Habets <[email protected]>
Date: Wed, 17 Aug 2005 21:53:45 +0100

Quoted 3 lines

This patch against 2.6.10 enables the Magic SysRq commands on a SunZilog serial console.
SysRq is activated by sending a BREAK. Send a command within 5 seconds.

This patch had a problem.

drivers/serial/sunzilog.c line 400

Quoted 2 lines
drivers/serial/sunzilog.c renamed from drivers/serial/sunzilog.c.orig +1 -1
-		if (uart_handle_sysrq_char(&up->port, ch, regs))
+		if (ch && uart_handle_sysrq_char(&up->port, ch, regs))

uart_handle_sysrq_char() does the "if (ch)" check, you don't need to add it here, that's superfluous.

#2 lore raw
In reply to Martin Habets
Quoted 5 lines · David S. Miller

drivers/serial/sunzilog.c line 400

Quoted 2 lines
drivers/serial/sunzilog.c renamed from drivers/serial/sunzilog.c.orig +1 -1
-		if (uart_handle_sysrq_char(&up->port, ch, regs))
+		if (ch && uart_handle_sysrq_char(&up->port, ch, regs))

uart_handle_sysrq_char() does the "if (ch)" check, you don't need to add it here, that's superfluous.

Problem is, uart_handle_sysrq_char() still resets port->sysrq when called with a 0 character.
During my testing it always first got called with a 0 character value after I send a break. The actual command key I pressed always got ignored as a result (and just got displayed to the screen).

Could this be a bug in uart_handle_sysrq_char()? The impact of a fix there would be much wider and thus scares me. I do not know why I always see at least one 0 character after sending a break. Could be a sunzilog thing, could be a sparc thing, could be happening with all uart chips. I just don't know how widespread this behaviour is.

Thanks for the feedback,

Signature · 1 line
Martin
#3 lore raw
In reply to Martin Habets

From: Martin Habets <[email protected]>
Date: Wed, 17 Aug 2005 21:53:45 +0100

Quoted 3 lines

It seems to me that all the BRK_ABRT handling in sunzilog_receive_chars() never gets executed, and could be cleaned up. Can anyone confirm/deny this?

We run receive processing first, and OR in the BRK_ABRT bit to the "r1" variable from the control register.

Only later do we do status processing and actually clear the interrupt status in the control register.

So the break handling code in sunzilog_receive_chars() very much should be getting used.

#4 lore raw
In reply to Martin Habets
Quoted 7 lines · David S. Miller

From: Martin Habets <[email protected]>
Date: Wed, 17 Aug 2005 21:53:45 +0100

Quoted 3 lines

It seems to me that all the BRK_ABRT handling in sunzilog_receive_chars() never gets executed, and could be cleaned up. Can anyone confirm/deny this?

Quoted 5 lines

We run receive processing first, and OR in the BRK_ABRT bit to the "r1" variable from the control register.

Only later do we do status processing and actually clear the interrupt status in the control register.

On my SS20 the first interrupt received is CHAEXT, triggering the status processing. Only after that comes an interrupt with CHAxIP|CHAEXT set.

Quoted 2 lines

So the break handling code in sunzilog_receive_chars() very much should be getting used.

Not on my machine, but this could work different on other hardware. So best keep it.

Thanks,

Signature · 1 line
Martin