]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.suse/8250-sysrq-ctrl_o.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.suse / 8250-sysrq-ctrl_o.patch
1 Subject: no sysrq on Cell QS21/QS22 serial console
2 From: olh@suse.de
3 References: 422987 - LTC47675, 96313 - LTC16841
4
5
6 a POWER4 system in 'full-system-partition' mode has the console device
7 on ttyS0. But the user interface to the Linux system console may still
8 be on the hardware management console (HMC). If this is the case, there
9 is no way to send a break to trigger a sysrq.
10 Other setups do already use 'ctrl o' to trigger sysrq. This includes iSeries
11 virtual console on tty1 or hvc0, and pSeries LPAR console on hvc0 or hvsi0.
12
13 This affects also Cell Blades QS2x.
14
15 To limit the 'ctrl o' only to the affected systems, query the model property
16 in the device-tree. The patch makes the serial console not-eight-bit-clean.
17 Booting with 'console=ttyS0' will disable 'ctrl o', it is only enabled
18 with console autodetection.
19
20 'ctrl o' is currently mapped to 'flush output', see 'stty -a'
21
22 Signed-off-by: Olaf Hering <olh@suse.de>
23 ---
24 arch/powerpc/include/asm/serial.h | 6 ++++
25 arch/powerpc/kernel/legacy_serial.c | 52 ++++++++++++++++++++++++++++++++++++
26 drivers/serial/8250.c | 6 ++++
27 3 files changed, 64 insertions(+)
28
29 --- a/arch/powerpc/include/asm/serial.h
30 +++ b/arch/powerpc/include/asm/serial.h
31 @@ -15,6 +15,12 @@
32 /* Default baud base if not found in device-tree */
33 #define BASE_BAUD ( 1843200 / 16 )
34
35 +#if defined(SUPPORT_SYSRQ) && defined(CONFIG_PPC_PSERIES)
36 +#undef arch_8250_sysrq_via_ctrl_o
37 +extern int do_sysrq_via_ctrl_o;
38 +#define arch_8250_sysrq_via_ctrl_o(ch, port) ((ch) == '\x0f' && do_sysrq_via_ctrl_o && uart_handle_break((port)))
39 +#endif
40 +
41 #ifdef CONFIG_PPC_UDBG_16550
42 extern void find_legacy_serial_ports(void);
43 #else
44 --- a/arch/powerpc/kernel/legacy_serial.c
45 +++ b/arch/powerpc/kernel/legacy_serial.c
46 @@ -494,6 +494,55 @@ device_initcall(serial_dev_init);
47
48
49 #ifdef CONFIG_SERIAL_8250_CONSOLE
50 +#if defined(CONFIG_PPC_PSERIES) && defined(CONFIG_SERIAL_8250_CONSOLE)
51 +/*
52 + * Handle the SysRq ^O Hack also via ttyS0 on POWER4 systems
53 + * but only on the system console, see asm/serial.h
54 + * If they run in FullSystemPartition mode, the firmware console comes in via ttyS0
55 + * But BREAK does not work via the HMC, to trigger sysrq.
56 + * The same is required for Cell blades
57 + */
58 +int do_sysrq_via_ctrl_o;
59 +static const char __initdata *need_ctrl_o[] = {
60 + "IBM,079", /* QS2x */
61 + "IBM,0792-32G", /* QS21 */
62 + "IBM,0793-2RZ", /* QS22 */
63 + "IBM,7040-681", /* p690 */
64 + "IBM,7040-671", /* p670 */
65 + "IBM,7039-651", /* p655 */
66 + "IBM,7038-6M2", /* p650 */
67 + "IBM,7028-6E4", /* p630 tower */
68 + "IBM,7028-6C4", /* p630 rack */
69 + "IBM,7029-6E3", /* p615 tower */
70 + "IBM,7029-6C3", /* p615 rack */
71 + NULL
72 +};
73 +static void __init detect_need_for_ctrl_o(void)
74 +{
75 + struct device_node *root;
76 + const char *model, *p;
77 + int i;
78 +
79 + root = of_find_node_by_path("/");
80 + if (!root)
81 + return;
82 + model = of_get_property(root, "model", NULL);
83 + if (model) {
84 + i = 0;
85 + while (need_ctrl_o[i]) {
86 + p = need_ctrl_o[i];
87 + if (strncmp(p, model, strlen(p)) == 0) {
88 + do_sysrq_via_ctrl_o = 1;
89 + DBG("Enable sysrq via CTRL o on model %s\n", model);
90 + break;
91 + }
92 + i++;
93 + }
94 + }
95 + of_node_put(root);
96 +}
97 +#endif
98 +
99 /*
100 * This is called very early, as part of console_init() (typically just after
101 * time_init()). This function is respondible for trying to find a good
102 @@ -562,6 +611,9 @@ static int __init check_legacy_serial_co
103 if (i >= legacy_serial_count)
104 goto not_found;
105
106 +#if defined(CONFIG_PPC_PSERIES) && defined(CONFIG_SERIAL_8250_CONSOLE)
107 + detect_need_for_ctrl_o();
108 +#endif
109 of_node_put(prom_stdout);
110
111 DBG("Found serial console at ttyS%d\n", offset);
112 --- a/drivers/serial/8250.c
113 +++ b/drivers/serial/8250.c
114 @@ -84,6 +84,8 @@ static unsigned int nr_uarts = CONFIG_SE
115 #define CONFIG_SERIAL_MANY_PORTS 1
116 #endif
117
118 +#define arch_8250_sysrq_via_ctrl_o(a,b) 0
119 +
120 /*
121 * HUB6 is always on. This will be removed once the header
122 * files have been cleaned.
123 @@ -1294,7 +1296,11 @@ receive_chars(struct uart_8250_port *up,
124
125 do {
126 if (likely(lsr & UART_LSR_DR))
127 + {
128 ch = serial_inp(up, UART_RX);
129 + if (arch_8250_sysrq_via_ctrl_o(ch, &up->port))
130 + goto ignore_char;
131 + }
132 else
133 /*
134 * Intel 82571 has a Serial Over Lan device that will