1 // SPDX-License-Identifier: GPL-2.0
3 * SCLP VT220 terminal driver.
5 * Copyright IBM Corp. 2003, 2009
7 * Author(s): Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
10 #include <linux/module.h>
11 #include <linux/spinlock.h>
12 #include <linux/list.h>
13 #include <linux/wait.h>
14 #include <linux/timer.h>
15 #include <linux/kernel.h>
16 #include <linux/sysrq.h>
17 #include <linux/tty.h>
18 #include <linux/tty_driver.h>
19 #include <linux/tty_flip.h>
20 #include <linux/errno.h>
22 #include <linux/major.h>
23 #include <linux/console.h>
24 #include <linux/kdev_t.h>
25 #include <linux/interrupt.h>
26 #include <linux/init.h>
27 #include <linux/reboot.h>
28 #include <linux/slab.h>
30 #include <linux/uaccess.h>
34 #define SCLP_VT220_MAJOR TTY_MAJOR
35 #define SCLP_VT220_MINOR 65
36 #define SCLP_VT220_DRIVER_NAME "sclp_vt220"
37 #define SCLP_VT220_DEVICE_NAME "ttysclp"
38 #define SCLP_VT220_CONSOLE_NAME "ttysclp"
39 #define SCLP_VT220_CONSOLE_INDEX 0 /* console=ttysclp0 */
41 /* Representation of a single write request */
42 struct sclp_vt220_request {
43 struct list_head list;
44 struct sclp_req sclp_req;
49 struct sclp_vt220_sccb {
50 struct sccb_header header;
51 struct evbuf_header evbuf;
54 #define SCLP_VT220_MAX_CHARS_PER_BUFFER (PAGE_SIZE - \
55 sizeof(struct sclp_vt220_request) - \
56 sizeof(struct sclp_vt220_sccb))
58 /* Structures and data needed to register tty driver */
59 static struct tty_driver *sclp_vt220_driver;
61 static struct tty_port sclp_vt220_port;
63 /* Lock to protect internal data from concurrent access */
64 static DEFINE_SPINLOCK(sclp_vt220_lock);
66 /* List of empty pages to be used as write request buffers */
67 static LIST_HEAD(sclp_vt220_empty);
69 /* List of pending requests */
70 static LIST_HEAD(sclp_vt220_outqueue);
72 /* Suspend mode flag */
73 static int sclp_vt220_suspended;
75 /* Flag that output queue is currently running */
76 static int sclp_vt220_queue_running;
78 /* Timer used for delaying write requests to merge subsequent messages into
80 static struct timer_list sclp_vt220_timer;
82 /* Pointer to current request buffer which has been partially filled but not
84 static struct sclp_vt220_request *sclp_vt220_current_request;
86 /* Number of characters in current request buffer */
87 static int sclp_vt220_buffered_chars;
89 /* Counter controlling core driver initialization. */
90 static int __initdata sclp_vt220_init_count;
92 /* Flag indicating that sclp_vt220_current_request should really
93 * have been already queued but wasn't because the SCLP was processing
95 static int sclp_vt220_flush_later;
97 static void sclp_vt220_receiver_fn(struct evbuf_header *evbuf);
98 static void sclp_vt220_pm_event_fn(struct sclp_register *reg,
99 enum sclp_pm_event sclp_pm_event);
100 static int __sclp_vt220_emit(struct sclp_vt220_request *request);
101 static void sclp_vt220_emit_current(void);
103 /* Registration structure for SCLP output event buffers */
104 static struct sclp_register sclp_vt220_register = {
105 .send_mask = EVTYP_VT220MSG_MASK,
106 .pm_event_fn = sclp_vt220_pm_event_fn,
109 /* Registration structure for SCLP input event buffers */
110 static struct sclp_register sclp_vt220_register_input = {
111 .receive_mask = EVTYP_VT220MSG_MASK,
112 .receiver_fn = sclp_vt220_receiver_fn,
117 * Put provided request buffer back into queue and check emit pending
118 * buffers if necessary.
121 sclp_vt220_process_queue(struct sclp_vt220_request *request)
127 /* Put buffer back to list of empty buffers */
128 page = request->sclp_req.sccb;
129 spin_lock_irqsave(&sclp_vt220_lock, flags);
130 /* Move request from outqueue to empty queue */
131 list_del(&request->list);
132 list_add_tail((struct list_head *) page, &sclp_vt220_empty);
133 /* Check if there is a pending buffer on the out queue. */
135 if (!list_empty(&sclp_vt220_outqueue))
136 request = list_entry(sclp_vt220_outqueue.next,
137 struct sclp_vt220_request, list);
138 if (!request || sclp_vt220_suspended) {
139 sclp_vt220_queue_running = 0;
140 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
143 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
144 } while (__sclp_vt220_emit(request));
145 if (request == NULL && sclp_vt220_flush_later)
146 sclp_vt220_emit_current();
147 tty_port_tty_wakeup(&sclp_vt220_port);
150 #define SCLP_BUFFER_MAX_RETRY 1
153 * Callback through which the result of a write request is reported by the
157 sclp_vt220_callback(struct sclp_req *request, void *data)
159 struct sclp_vt220_request *vt220_request;
160 struct sclp_vt220_sccb *sccb;
162 vt220_request = (struct sclp_vt220_request *) data;
163 if (request->status == SCLP_REQ_FAILED) {
164 sclp_vt220_process_queue(vt220_request);
167 sccb = (struct sclp_vt220_sccb *) vt220_request->sclp_req.sccb;
169 /* Check SCLP response code and choose suitable action */
170 switch (sccb->header.response_code) {
174 case 0x05f0: /* Target resource in improper state */
177 case 0x0340: /* Contained SCLP equipment check */
178 if (++vt220_request->retry_count > SCLP_BUFFER_MAX_RETRY)
180 /* Remove processed buffers and requeue rest */
181 if (sclp_remove_processed((struct sccb_header *) sccb) > 0) {
182 /* Not all buffers were processed */
183 sccb->header.response_code = 0x0000;
184 vt220_request->sclp_req.status = SCLP_REQ_FILLED;
185 if (sclp_add_request(request) == 0)
190 case 0x0040: /* SCLP equipment check */
191 if (++vt220_request->retry_count > SCLP_BUFFER_MAX_RETRY)
193 sccb->header.response_code = 0x0000;
194 vt220_request->sclp_req.status = SCLP_REQ_FILLED;
195 if (sclp_add_request(request) == 0)
202 sclp_vt220_process_queue(vt220_request);
206 * Emit vt220 request buffer to SCLP. Return zero on success, non-zero
210 __sclp_vt220_emit(struct sclp_vt220_request *request)
212 request->sclp_req.command = SCLP_CMDW_WRITE_EVENT_DATA;
213 request->sclp_req.status = SCLP_REQ_FILLED;
214 request->sclp_req.callback = sclp_vt220_callback;
215 request->sclp_req.callback_data = (void *) request;
217 return sclp_add_request(&request->sclp_req);
221 * Queue and emit current request.
224 sclp_vt220_emit_current(void)
227 struct sclp_vt220_request *request;
228 struct sclp_vt220_sccb *sccb;
230 spin_lock_irqsave(&sclp_vt220_lock, flags);
231 if (sclp_vt220_current_request) {
232 sccb = (struct sclp_vt220_sccb *)
233 sclp_vt220_current_request->sclp_req.sccb;
234 /* Only emit buffers with content */
235 if (sccb->header.length != sizeof(struct sclp_vt220_sccb)) {
236 list_add_tail(&sclp_vt220_current_request->list,
237 &sclp_vt220_outqueue);
238 sclp_vt220_current_request = NULL;
239 if (timer_pending(&sclp_vt220_timer))
240 del_timer(&sclp_vt220_timer);
242 sclp_vt220_flush_later = 0;
244 if (sclp_vt220_queue_running || sclp_vt220_suspended)
246 if (list_empty(&sclp_vt220_outqueue))
248 request = list_first_entry(&sclp_vt220_outqueue,
249 struct sclp_vt220_request, list);
250 sclp_vt220_queue_running = 1;
251 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
253 if (__sclp_vt220_emit(request))
254 sclp_vt220_process_queue(request);
257 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
260 #define SCLP_NORMAL_WRITE 0x00
263 * Helper function to initialize a page with the sclp request structure.
265 static struct sclp_vt220_request *
266 sclp_vt220_initialize_page(void *page)
268 struct sclp_vt220_request *request;
269 struct sclp_vt220_sccb *sccb;
271 /* Place request structure at end of page */
272 request = ((struct sclp_vt220_request *)
273 ((addr_t) page + PAGE_SIZE)) - 1;
274 request->retry_count = 0;
275 request->sclp_req.sccb = page;
276 /* SCCB goes at start of page */
277 sccb = (struct sclp_vt220_sccb *) page;
278 memset((void *) sccb, 0, sizeof(struct sclp_vt220_sccb));
279 sccb->header.length = sizeof(struct sclp_vt220_sccb);
280 sccb->header.function_code = SCLP_NORMAL_WRITE;
281 sccb->header.response_code = 0x0000;
282 sccb->evbuf.type = EVTYP_VT220MSG;
283 sccb->evbuf.length = sizeof(struct evbuf_header);
288 static inline unsigned int
289 sclp_vt220_space_left(struct sclp_vt220_request *request)
291 struct sclp_vt220_sccb *sccb;
292 sccb = (struct sclp_vt220_sccb *) request->sclp_req.sccb;
293 return PAGE_SIZE - sizeof(struct sclp_vt220_request) -
297 static inline unsigned int
298 sclp_vt220_chars_stored(struct sclp_vt220_request *request)
300 struct sclp_vt220_sccb *sccb;
301 sccb = (struct sclp_vt220_sccb *) request->sclp_req.sccb;
302 return sccb->evbuf.length - sizeof(struct evbuf_header);
306 * Add msg to buffer associated with request. Return the number of characters
310 sclp_vt220_add_msg(struct sclp_vt220_request *request,
311 const unsigned char *msg, int count, int convertlf)
313 struct sclp_vt220_sccb *sccb;
319 if (count > sclp_vt220_space_left(request))
320 count = sclp_vt220_space_left(request);
324 sccb = (struct sclp_vt220_sccb *) request->sclp_req.sccb;
325 buffer = (void *) ((addr_t) sccb + sccb->header.length);
328 /* Perform Linefeed conversion (0x0a -> 0x0a 0x0d)*/
330 (from < count) && (to < sclp_vt220_space_left(request));
332 /* Retrieve character */
334 /* Perform conversion */
336 if (to + 1 < sclp_vt220_space_left(request)) {
337 ((unsigned char *) buffer)[to++] = c;
338 ((unsigned char *) buffer)[to++] = 0x0d;
343 ((unsigned char *) buffer)[to++] = c;
345 sccb->header.length += to;
346 sccb->evbuf.length += to;
349 memcpy(buffer, (const void *) msg, count);
350 sccb->header.length += count;
351 sccb->evbuf.length += count;
357 * Emit buffer after having waited long enough for more data to arrive.
360 sclp_vt220_timeout(struct timer_list *unused)
362 sclp_vt220_emit_current();
365 #define BUFFER_MAX_DELAY HZ/20
368 * Drop oldest console buffer if sclp_con_drop is set
371 sclp_vt220_drop_buffer(void)
373 struct list_head *list;
374 struct sclp_vt220_request *request;
377 if (!sclp_console_drop)
379 list = sclp_vt220_outqueue.next;
380 if (sclp_vt220_queue_running)
381 /* The first element is in I/O */
383 if (list == &sclp_vt220_outqueue)
386 request = list_entry(list, struct sclp_vt220_request, list);
387 page = request->sclp_req.sccb;
388 list_add_tail((struct list_head *) page, &sclp_vt220_empty);
393 * Internal implementation of the write function. Write COUNT bytes of data
395 * to the SCLP interface. In case that the data does not fit into the current
396 * write buffer, emit the current one and allocate a new one. If there are no
397 * more empty buffers available, wait until one gets emptied. If DO_SCHEDULE
398 * is non-zero, the buffer will be scheduled for emitting after a timeout -
399 * otherwise the user has to explicitly call the flush function.
400 * A non-zero CONVERTLF parameter indicates that 0x0a characters in the message
401 * buffer should be converted to 0x0a 0x0d. After completion, return the number
405 __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule,
406 int convertlf, int may_fail)
416 spin_lock_irqsave(&sclp_vt220_lock, flags);
418 /* Create an sclp output buffer if none exists yet */
419 if (sclp_vt220_current_request == NULL) {
420 if (list_empty(&sclp_vt220_empty))
422 while (list_empty(&sclp_vt220_empty)) {
423 if (may_fail || sclp_vt220_suspended)
425 if (sclp_vt220_drop_buffer())
427 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
430 spin_lock_irqsave(&sclp_vt220_lock, flags);
432 page = (void *) sclp_vt220_empty.next;
433 list_del((struct list_head *) page);
434 sclp_vt220_current_request =
435 sclp_vt220_initialize_page(page);
437 /* Try to write the string to the current request buffer */
438 written = sclp_vt220_add_msg(sclp_vt220_current_request,
439 buf, count, convertlf);
440 overall_written += written;
441 if (written == count)
444 * Not all characters could be written to the current
445 * output buffer. Emit the buffer, create a new buffer
446 * and then output the rest of the string.
448 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
449 sclp_vt220_emit_current();
450 spin_lock_irqsave(&sclp_vt220_lock, flags);
454 /* Setup timer to output current console buffer after some time */
455 if (sclp_vt220_current_request != NULL &&
456 !timer_pending(&sclp_vt220_timer) && do_schedule) {
457 sclp_vt220_timer.expires = jiffies + BUFFER_MAX_DELAY;
458 add_timer(&sclp_vt220_timer);
461 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
462 return overall_written;
466 * This routine is called by the kernel to write a series of
467 * characters to the tty device. The characters may come from
468 * user space or kernel space. This routine will return the
469 * number of characters actually accepted for writing.
472 sclp_vt220_write(struct tty_struct *tty, const unsigned char *buf, int count)
474 return __sclp_vt220_write(buf, count, 1, 0, 1);
477 #define SCLP_VT220_SESSION_ENDED 0x01
478 #define SCLP_VT220_SESSION_STARTED 0x80
479 #define SCLP_VT220_SESSION_DATA 0x00
481 #ifdef CONFIG_MAGIC_SYSRQ
483 static int sysrq_pressed;
484 static struct sysrq_work sysrq;
486 static void sclp_vt220_reset_session(void)
491 static void sclp_vt220_handle_input(const char *buffer, unsigned int count)
495 for (i = 0; i < count; i++) {
496 /* Handle magic sys request */
497 if (buffer[i] == ('O' ^ 0100)) { /* CTRL-O */
499 * If pressed again, reset sysrq_pressed
500 * and flip CTRL-O character
502 sysrq_pressed = !sysrq_pressed;
505 } else if (sysrq_pressed) {
506 sysrq.key = buffer[i];
507 schedule_sysrq_work(&sysrq);
511 tty_insert_flip_char(&sclp_vt220_port, buffer[i], 0);
517 static void sclp_vt220_reset_session(void)
521 static void sclp_vt220_handle_input(const char *buffer, unsigned int count)
523 tty_insert_flip_string(&sclp_vt220_port, buffer, count);
529 * Called by the SCLP to report incoming event buffers.
532 sclp_vt220_receiver_fn(struct evbuf_header *evbuf)
537 buffer = (char *) ((addr_t) evbuf + sizeof(struct evbuf_header));
538 count = evbuf->length - sizeof(struct evbuf_header);
541 case SCLP_VT220_SESSION_ENDED:
542 case SCLP_VT220_SESSION_STARTED:
543 sclp_vt220_reset_session();
545 case SCLP_VT220_SESSION_DATA:
546 /* Send input to line discipline */
549 sclp_vt220_handle_input(buffer, count);
550 tty_flip_buffer_push(&sclp_vt220_port);
556 * This routine is called when a particular tty device is opened.
559 sclp_vt220_open(struct tty_struct *tty, struct file *filp)
561 if (tty->count == 1) {
562 tty_port_tty_set(&sclp_vt220_port, tty);
563 if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
564 tty->winsize.ws_row = 24;
565 tty->winsize.ws_col = 80;
572 * This routine is called when a particular tty device is closed.
575 sclp_vt220_close(struct tty_struct *tty, struct file *filp)
578 tty_port_tty_set(&sclp_vt220_port, NULL);
582 * This routine is called by the kernel to write a single
583 * character to the tty device. If the kernel uses this routine,
584 * it must call the flush_chars() routine (if defined) when it is
585 * done stuffing characters into the driver.
588 sclp_vt220_put_char(struct tty_struct *tty, unsigned char ch)
590 return __sclp_vt220_write(&ch, 1, 0, 0, 1);
594 * This routine is called by the kernel after it has written a
595 * series of characters to the tty device using put_char().
598 sclp_vt220_flush_chars(struct tty_struct *tty)
600 if (!sclp_vt220_queue_running)
601 sclp_vt220_emit_current();
603 sclp_vt220_flush_later = 1;
607 * This routine returns the numbers of characters the tty driver
608 * will accept for queuing to be written. This number is subject
609 * to change as output buffers get emptied, or if the output flow
613 sclp_vt220_write_room(struct tty_struct *tty)
619 spin_lock_irqsave(&sclp_vt220_lock, flags);
621 if (sclp_vt220_current_request != NULL)
622 count = sclp_vt220_space_left(sclp_vt220_current_request);
623 list_for_each(l, &sclp_vt220_empty)
624 count += SCLP_VT220_MAX_CHARS_PER_BUFFER;
625 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
630 * Return number of buffered chars.
633 sclp_vt220_chars_in_buffer(struct tty_struct *tty)
637 struct sclp_vt220_request *r;
640 spin_lock_irqsave(&sclp_vt220_lock, flags);
642 if (sclp_vt220_current_request != NULL)
643 count = sclp_vt220_chars_stored(sclp_vt220_current_request);
644 list_for_each(l, &sclp_vt220_outqueue) {
645 r = list_entry(l, struct sclp_vt220_request, list);
646 count += sclp_vt220_chars_stored(r);
648 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
653 * Pass on all buffers to the hardware. Return only when there are no more
657 sclp_vt220_flush_buffer(struct tty_struct *tty)
659 sclp_vt220_emit_current();
662 /* Release allocated pages. */
663 static void __init __sclp_vt220_free_pages(void)
665 struct list_head *page, *p;
667 list_for_each_safe(page, p, &sclp_vt220_empty) {
669 free_page((unsigned long) page);
673 /* Release memory and unregister from sclp core. Controlled by init counting -
674 * only the last invoker will actually perform these actions. */
675 static void __init __sclp_vt220_cleanup(void)
677 sclp_vt220_init_count--;
678 if (sclp_vt220_init_count != 0)
680 sclp_unregister(&sclp_vt220_register);
681 __sclp_vt220_free_pages();
682 tty_port_destroy(&sclp_vt220_port);
685 /* Allocate buffer pages and register with sclp core. Controlled by init
686 * counting - only the first invoker will actually perform these actions. */
687 static int __init __sclp_vt220_init(int num_pages)
693 sclp_vt220_init_count++;
694 if (sclp_vt220_init_count != 1)
696 timer_setup(&sclp_vt220_timer, sclp_vt220_timeout, 0);
697 tty_port_init(&sclp_vt220_port);
698 sclp_vt220_current_request = NULL;
699 sclp_vt220_buffered_chars = 0;
700 sclp_vt220_flush_later = 0;
702 /* Allocate pages for output buffering */
704 for (i = 0; i < num_pages; i++) {
705 page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
708 list_add_tail(page, &sclp_vt220_empty);
710 rc = sclp_register(&sclp_vt220_register);
713 __sclp_vt220_free_pages();
714 sclp_vt220_init_count--;
715 tty_port_destroy(&sclp_vt220_port);
720 static const struct tty_operations sclp_vt220_ops = {
721 .open = sclp_vt220_open,
722 .close = sclp_vt220_close,
723 .write = sclp_vt220_write,
724 .put_char = sclp_vt220_put_char,
725 .flush_chars = sclp_vt220_flush_chars,
726 .write_room = sclp_vt220_write_room,
727 .chars_in_buffer = sclp_vt220_chars_in_buffer,
728 .flush_buffer = sclp_vt220_flush_buffer,
732 * Register driver with SCLP and Linux and initialize internal tty structures.
734 static int __init sclp_vt220_tty_init(void)
736 struct tty_driver *driver;
739 /* Note: we're not testing for CONSOLE_IS_SCLP here to preserve
740 * symmetry between VM and LPAR systems regarding ttyS1. */
741 driver = alloc_tty_driver(1);
744 rc = __sclp_vt220_init(MAX_KMEM_PAGES);
748 driver->driver_name = SCLP_VT220_DRIVER_NAME;
749 driver->name = SCLP_VT220_DEVICE_NAME;
750 driver->major = SCLP_VT220_MAJOR;
751 driver->minor_start = SCLP_VT220_MINOR;
752 driver->type = TTY_DRIVER_TYPE_SYSTEM;
753 driver->subtype = SYSTEM_TYPE_TTY;
754 driver->init_termios = tty_std_termios;
755 driver->flags = TTY_DRIVER_REAL_RAW;
756 tty_set_operations(driver, &sclp_vt220_ops);
757 tty_port_link_device(&sclp_vt220_port, driver, 0);
759 rc = tty_register_driver(driver);
762 rc = sclp_register(&sclp_vt220_register_input);
765 sclp_vt220_driver = driver;
769 tty_unregister_driver(driver);
771 __sclp_vt220_cleanup();
773 put_tty_driver(driver);
776 __initcall(sclp_vt220_tty_init);
778 static void __sclp_vt220_flush_buffer(void)
782 sclp_vt220_emit_current();
783 spin_lock_irqsave(&sclp_vt220_lock, flags);
784 if (timer_pending(&sclp_vt220_timer))
785 del_timer(&sclp_vt220_timer);
786 while (sclp_vt220_queue_running) {
787 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
789 spin_lock_irqsave(&sclp_vt220_lock, flags);
791 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
795 * Resume console: If there are cached messages, emit them.
797 static void sclp_vt220_resume(void)
801 spin_lock_irqsave(&sclp_vt220_lock, flags);
802 sclp_vt220_suspended = 0;
803 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
804 sclp_vt220_emit_current();
808 * Suspend console: Set suspend flag and flush console
810 static void sclp_vt220_suspend(void)
814 spin_lock_irqsave(&sclp_vt220_lock, flags);
815 sclp_vt220_suspended = 1;
816 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
817 __sclp_vt220_flush_buffer();
820 static void sclp_vt220_pm_event_fn(struct sclp_register *reg,
821 enum sclp_pm_event sclp_pm_event)
823 switch (sclp_pm_event) {
824 case SCLP_PM_EVENT_FREEZE:
825 sclp_vt220_suspend();
827 case SCLP_PM_EVENT_RESTORE:
828 case SCLP_PM_EVENT_THAW:
834 #ifdef CONFIG_SCLP_VT220_CONSOLE
837 sclp_vt220_con_write(struct console *con, const char *buf, unsigned int count)
839 __sclp_vt220_write((const unsigned char *) buf, count, 1, 1, 0);
842 static struct tty_driver *
843 sclp_vt220_con_device(struct console *c, int *index)
846 return sclp_vt220_driver;
850 sclp_vt220_notify(struct notifier_block *self,
851 unsigned long event, void *data)
853 __sclp_vt220_flush_buffer();
857 static struct notifier_block on_panic_nb = {
858 .notifier_call = sclp_vt220_notify,
862 static struct notifier_block on_reboot_nb = {
863 .notifier_call = sclp_vt220_notify,
867 /* Structure needed to register with printk */
868 static struct console sclp_vt220_console =
870 .name = SCLP_VT220_CONSOLE_NAME,
871 .write = sclp_vt220_con_write,
872 .device = sclp_vt220_con_device,
873 .flags = CON_PRINTBUFFER,
874 .index = SCLP_VT220_CONSOLE_INDEX
878 sclp_vt220_con_init(void)
882 rc = __sclp_vt220_init(sclp_console_pages);
885 /* Attach linux console */
886 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
887 register_reboot_notifier(&on_reboot_nb);
888 register_console(&sclp_vt220_console);
892 console_initcall(sclp_vt220_con_init);
893 #endif /* CONFIG_SCLP_VT220_CONSOLE */