16 #include <linux/reboot.h>
23 #define sclp_console_major 4
24 #define sclp_console_minor 64
25 #define sclp_console_name "ttyS"
32 static struct list_head sclp_con_outqueue;
38 static int sclp_con_suspended;
40 static int sclp_con_queue_running;
43 static unsigned short sclp_con_columns;
44 static unsigned short sclp_con_width_htab;
62 if (!list_empty(&sclp_con_outqueue))
65 if (!buffer || sclp_con_suspended) {
66 sclp_con_queue_running = 0;
67 spin_unlock_irqrestore(&sclp_con_lock, flags);
70 spin_unlock_irqrestore(&sclp_con_lock, flags);
77 static void sclp_conbuf_emit(
void)
87 if (sclp_con_queue_running || sclp_con_suspended)
89 if (list_empty(&sclp_con_outqueue))
93 sclp_con_queue_running = 1;
94 spin_unlock_irqrestore(&sclp_con_lock, flags);
98 sclp_conbuf_callback(buffer, rc);
101 spin_unlock_irqrestore(&sclp_con_lock, flags);
107 static void sclp_console_sync_queue(
void)
112 if (timer_pending(&sclp_con_timer))
114 while (sclp_con_queue_running) {
115 spin_unlock_irqrestore(&sclp_con_lock, flags);
119 spin_unlock_irqrestore(&sclp_con_lock, flags);
127 sclp_console_timeout(
unsigned long data)
152 if (sclp_conbuf ==
NULL) {
153 while (list_empty(&sclp_con_pages)) {
154 if (sclp_con_suspended)
156 spin_unlock_irqrestore(&sclp_con_lock, flags);
160 page = sclp_con_pages.next;
163 sclp_con_width_htab);
166 written =
sclp_write(sclp_conbuf, (
const unsigned char *)
168 if (written == count)
175 spin_unlock_irqrestore(&sclp_con_lock, flags);
183 !timer_pending(&sclp_con_timer)) {
185 sclp_con_timer.function = sclp_console_timeout;
186 sclp_con_timer.data = 0
UL;
187 sclp_con_timer.expires =
jiffies +
HZ/10;
191 spin_unlock_irqrestore(&sclp_con_lock, flags);
195 sclp_console_device(
struct console *
c,
int *
index)
205 sclp_console_flush(
void)
208 sclp_console_sync_queue();
214 static void sclp_console_resume(
void)
219 sclp_con_suspended = 0;
220 spin_unlock_irqrestore(&sclp_con_lock, flags);
227 static void sclp_console_suspend(
void)
232 sclp_con_suspended = 1;
233 spin_unlock_irqrestore(&sclp_con_lock, flags);
234 sclp_console_flush();
240 sclp_console_flush();
245 .notifier_call = sclp_console_notify,
250 .notifier_call = sclp_console_notify,
258 static struct console sclp_console =
261 .write = sclp_console_write,
262 .device = sclp_console_device,
272 switch (sclp_pm_event) {
274 sclp_console_suspend();
278 sclp_console_resume();
287 sclp_console_init(
void)
299 INIT_LIST_HEAD(&sclp_con_pages);
304 INIT_LIST_HEAD(&sclp_con_outqueue);
315 sclp_con_columns = 76;
317 sclp_con_columns = 80;
318 sclp_con_width_htab = 8;