2 * drivers/s390/char/sclp_vt220.c
3 * SCLP VT220 terminal driver.
6 * Copyright IBM Corp. 2003,2008
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/tty.h>
17 #include <linux/tty_driver.h>
18 #include <linux/tty_flip.h>
19 #include <linux/errno.h>
21 #include <linux/major.h>
22 #include <linux/console.h>
23 #include <linux/kdev_t.h>
24 #include <linux/bootmem.h>
25 #include <linux/interrupt.h>
26 #include <linux/init.h>
27 #include <asm/uaccess.h>
30 #define SCLP_VT220_PRINT_HEADER "sclp vt220 tty driver: "
31 #define SCLP_VT220_MAJOR TTY_MAJOR
32 #define SCLP_VT220_MINOR 65
33 #define SCLP_VT220_DRIVER_NAME "sclp_vt220"
34 #define SCLP_VT220_DEVICE_NAME "ttysclp"
35 #define SCLP_VT220_CONSOLE_NAME "ttyS"
36 #define SCLP_VT220_CONSOLE_INDEX 1 /* console=ttyS1 */
37 #define SCLP_VT220_BUF_SIZE 80
39 /* Representation of a single write request */
40 struct sclp_vt220_request
{
41 struct list_head list
;
42 struct sclp_req sclp_req
;
47 struct sclp_vt220_sccb
{
48 struct sccb_header header
;
49 struct evbuf_header evbuf
;
52 #define SCLP_VT220_MAX_CHARS_PER_BUFFER (PAGE_SIZE - \
53 sizeof(struct sclp_vt220_request) - \
54 sizeof(struct sclp_vt220_sccb))
56 /* Structures and data needed to register tty driver */
57 static struct tty_driver
*sclp_vt220_driver
;
59 /* The tty_struct that the kernel associated with us */
60 static struct tty_struct
*sclp_vt220_tty
;
62 /* Lock to protect internal data from concurrent access */
63 static spinlock_t sclp_vt220_lock
;
65 /* List of empty pages to be used as write request buffers */
66 static struct list_head sclp_vt220_empty
;
68 /* List of pending requests */
69 static struct list_head sclp_vt220_outqueue
;
71 /* Number of requests in outqueue */
72 static int sclp_vt220_outqueue_count
;
74 /* Wait queue used to delay write requests while we've run out of buffers */
75 static wait_queue_head_t sclp_vt220_waitq
;
77 /* Timer used for delaying write requests to merge subsequent messages into
79 static struct timer_list sclp_vt220_timer
;
81 /* Pointer to current request buffer which has been partially filled but not
83 static struct sclp_vt220_request
*sclp_vt220_current_request
;
85 /* Number of characters in current request buffer */
86 static int sclp_vt220_buffered_chars
;
88 /* Flag indicating whether this driver has already been initialized */
89 static int sclp_vt220_initialized
= 0;
91 /* Flag indicating that sclp_vt220_current_request should really
92 * have been already queued but wasn't because the SCLP was processing
94 static int sclp_vt220_flush_later
;
96 static void sclp_vt220_receiver_fn(struct evbuf_header
*evbuf
);
97 static int __sclp_vt220_emit(struct sclp_vt220_request
*request
);
98 static void sclp_vt220_emit_current(void);
100 /* Registration structure for our interest in SCLP event buffers */
101 static struct sclp_register sclp_vt220_register
= {
102 .send_mask
= EVTYP_VT220MSG_MASK
,
103 .receive_mask
= EVTYP_VT220MSG_MASK
,
104 .state_change_fn
= NULL
,
105 .receiver_fn
= sclp_vt220_receiver_fn
110 * Put provided request buffer back into queue and check emit pending
111 * buffers if necessary.
114 sclp_vt220_process_queue(struct sclp_vt220_request
*request
)
120 /* Put buffer back to list of empty buffers */
121 page
= request
->sclp_req
.sccb
;
122 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
123 /* Move request from outqueue to empty queue */
124 list_del(&request
->list
);
125 sclp_vt220_outqueue_count
--;
126 list_add_tail((struct list_head
*) page
, &sclp_vt220_empty
);
127 /* Check if there is a pending buffer on the out queue. */
129 if (!list_empty(&sclp_vt220_outqueue
))
130 request
= list_entry(sclp_vt220_outqueue
.next
,
131 struct sclp_vt220_request
, list
);
132 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
133 } while (request
&& __sclp_vt220_emit(request
));
134 if (request
== NULL
&& sclp_vt220_flush_later
)
135 sclp_vt220_emit_current();
136 wake_up(&sclp_vt220_waitq
);
137 /* Check if the tty needs a wake up call */
138 if (sclp_vt220_tty
!= NULL
) {
139 tty_wakeup(sclp_vt220_tty
);
143 #define SCLP_BUFFER_MAX_RETRY 1
146 * Callback through which the result of a write request is reported by the
150 sclp_vt220_callback(struct sclp_req
*request
, void *data
)
152 struct sclp_vt220_request
*vt220_request
;
153 struct sclp_vt220_sccb
*sccb
;
155 vt220_request
= (struct sclp_vt220_request
*) data
;
156 if (request
->status
== SCLP_REQ_FAILED
) {
157 sclp_vt220_process_queue(vt220_request
);
160 sccb
= (struct sclp_vt220_sccb
*) vt220_request
->sclp_req
.sccb
;
162 /* Check SCLP response code and choose suitable action */
163 switch (sccb
->header
.response_code
) {
167 case 0x05f0: /* Target resource in improper state */
170 case 0x0340: /* Contained SCLP equipment check */
171 if (++vt220_request
->retry_count
> SCLP_BUFFER_MAX_RETRY
)
173 /* Remove processed buffers and requeue rest */
174 if (sclp_remove_processed((struct sccb_header
*) sccb
) > 0) {
175 /* Not all buffers were processed */
176 sccb
->header
.response_code
= 0x0000;
177 vt220_request
->sclp_req
.status
= SCLP_REQ_FILLED
;
178 if (sclp_add_request(request
) == 0)
183 case 0x0040: /* SCLP equipment check */
184 if (++vt220_request
->retry_count
> SCLP_BUFFER_MAX_RETRY
)
186 sccb
->header
.response_code
= 0x0000;
187 vt220_request
->sclp_req
.status
= SCLP_REQ_FILLED
;
188 if (sclp_add_request(request
) == 0)
195 sclp_vt220_process_queue(vt220_request
);
199 * Emit vt220 request buffer to SCLP. Return zero on success, non-zero
203 __sclp_vt220_emit(struct sclp_vt220_request
*request
)
205 <<<<<<< HEAD
:drivers
/s390
/char/sclp_vt220
.c
206 if (!(sclp_vt220_register
.sclp_send_mask
& EVTYP_VT220MSG_MASK
)) {
208 if (!(sclp_vt220_register
.sclp_receive_mask
& EVTYP_VT220MSG_MASK
)) {
209 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/s390
/char/sclp_vt220
.c
210 request
->sclp_req
.status
= SCLP_REQ_FAILED
;
213 request
->sclp_req
.command
= SCLP_CMDW_WRITE_EVENT_DATA
;
214 request
->sclp_req
.status
= SCLP_REQ_FILLED
;
215 request
->sclp_req
.callback
= sclp_vt220_callback
;
216 request
->sclp_req
.callback_data
= (void *) request
;
218 return sclp_add_request(&request
->sclp_req
);
222 * Queue and emit given request.
225 sclp_vt220_emit(struct sclp_vt220_request
*request
)
230 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
231 list_add_tail(&request
->list
, &sclp_vt220_outqueue
);
232 count
= sclp_vt220_outqueue_count
++;
233 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
234 /* Emit only the first buffer immediately - callback takes care of
236 if (count
== 0 && __sclp_vt220_emit(request
))
237 sclp_vt220_process_queue(request
);
241 * Queue and emit current request. Return zero on success, non-zero otherwise.
244 sclp_vt220_emit_current(void)
247 struct sclp_vt220_request
*request
;
248 struct sclp_vt220_sccb
*sccb
;
250 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
252 if (sclp_vt220_current_request
!= NULL
) {
253 sccb
= (struct sclp_vt220_sccb
*)
254 sclp_vt220_current_request
->sclp_req
.sccb
;
255 /* Only emit buffers with content */
256 if (sccb
->header
.length
!= sizeof(struct sclp_vt220_sccb
)) {
257 request
= sclp_vt220_current_request
;
258 sclp_vt220_current_request
= NULL
;
259 if (timer_pending(&sclp_vt220_timer
))
260 del_timer(&sclp_vt220_timer
);
262 sclp_vt220_flush_later
= 0;
264 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
266 sclp_vt220_emit(request
);
269 #define SCLP_NORMAL_WRITE 0x00
272 * Helper function to initialize a page with the sclp request structure.
274 static struct sclp_vt220_request
*
275 sclp_vt220_initialize_page(void *page
)
277 struct sclp_vt220_request
*request
;
278 struct sclp_vt220_sccb
*sccb
;
280 /* Place request structure at end of page */
281 request
= ((struct sclp_vt220_request
*)
282 ((addr_t
) page
+ PAGE_SIZE
)) - 1;
283 request
->retry_count
= 0;
284 request
->sclp_req
.sccb
= page
;
285 /* SCCB goes at start of page */
286 sccb
= (struct sclp_vt220_sccb
*) page
;
287 memset((void *) sccb
, 0, sizeof(struct sclp_vt220_sccb
));
288 sccb
->header
.length
= sizeof(struct sclp_vt220_sccb
);
289 sccb
->header
.function_code
= SCLP_NORMAL_WRITE
;
290 sccb
->header
.response_code
= 0x0000;
291 sccb
->evbuf
.type
= EVTYP_VT220MSG
;
292 sccb
->evbuf
.length
= sizeof(struct evbuf_header
);
297 static inline unsigned int
298 sclp_vt220_space_left(struct sclp_vt220_request
*request
)
300 struct sclp_vt220_sccb
*sccb
;
301 sccb
= (struct sclp_vt220_sccb
*) request
->sclp_req
.sccb
;
302 return PAGE_SIZE
- sizeof(struct sclp_vt220_request
) -
306 static inline unsigned int
307 sclp_vt220_chars_stored(struct sclp_vt220_request
*request
)
309 struct sclp_vt220_sccb
*sccb
;
310 sccb
= (struct sclp_vt220_sccb
*) request
->sclp_req
.sccb
;
311 return sccb
->evbuf
.length
- sizeof(struct evbuf_header
);
315 * Add msg to buffer associated with request. Return the number of characters
319 sclp_vt220_add_msg(struct sclp_vt220_request
*request
,
320 const unsigned char *msg
, int count
, int convertlf
)
322 struct sclp_vt220_sccb
*sccb
;
328 if (count
> sclp_vt220_space_left(request
))
329 count
= sclp_vt220_space_left(request
);
333 sccb
= (struct sclp_vt220_sccb
*) request
->sclp_req
.sccb
;
334 buffer
= (void *) ((addr_t
) sccb
+ sccb
->header
.length
);
337 /* Perform Linefeed conversion (0x0a -> 0x0a 0x0d)*/
339 (from
< count
) && (to
< sclp_vt220_space_left(request
));
341 /* Retrieve character */
343 /* Perform conversion */
345 if (to
+ 1 < sclp_vt220_space_left(request
)) {
346 ((unsigned char *) buffer
)[to
++] = c
;
347 ((unsigned char *) buffer
)[to
++] = 0x0d;
352 ((unsigned char *) buffer
)[to
++] = c
;
354 sccb
->header
.length
+= to
;
355 sccb
->evbuf
.length
+= to
;
358 memcpy(buffer
, (const void *) msg
, count
);
359 sccb
->header
.length
+= count
;
360 sccb
->evbuf
.length
+= count
;
366 * Emit buffer after having waited long enough for more data to arrive.
369 sclp_vt220_timeout(unsigned long data
)
371 sclp_vt220_emit_current();
374 <<<<<<< HEAD
:drivers
/s390
/char/sclp_vt220
.c
375 #define BUFFER_MAX_DELAY HZ/2
377 #define BUFFER_MAX_DELAY HZ/20
378 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/s390
/char/sclp_vt220
.c
381 * Internal implementation of the write function. Write COUNT bytes of data
383 * to the SCLP interface. In case that the data does not fit into the current
384 * write buffer, emit the current one and allocate a new one. If there are no
385 * more empty buffers available, wait until one gets emptied. If DO_SCHEDULE
386 * is non-zero, the buffer will be scheduled for emitting after a timeout -
387 * otherwise the user has to explicitly call the flush function.
388 * A non-zero CONVERTLF parameter indicates that 0x0a characters in the message
389 * buffer should be converted to 0x0a 0x0d. After completion, return the number
393 __sclp_vt220_write(const unsigned char *buf
, int count
, int do_schedule
,
404 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
406 /* Create a sclp output buffer if none exists yet */
407 if (sclp_vt220_current_request
== NULL
) {
408 while (list_empty(&sclp_vt220_empty
)) {
409 spin_unlock_irqrestore(&sclp_vt220_lock
,
414 wait_event(sclp_vt220_waitq
,
415 !list_empty(&sclp_vt220_empty
));
416 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
418 page
= (void *) sclp_vt220_empty
.next
;
419 list_del((struct list_head
*) page
);
420 sclp_vt220_current_request
=
421 sclp_vt220_initialize_page(page
);
423 /* Try to write the string to the current request buffer */
424 written
= sclp_vt220_add_msg(sclp_vt220_current_request
,
425 buf
, count
, convertlf
);
426 overall_written
+= written
;
427 if (written
== count
)
430 * Not all characters could be written to the current
431 * output buffer. Emit the buffer, create a new buffer
432 * and then output the rest of the string.
434 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
435 sclp_vt220_emit_current();
436 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
440 /* Setup timer to output current console buffer after some time */
441 if (sclp_vt220_current_request
!= NULL
&&
442 !timer_pending(&sclp_vt220_timer
) && do_schedule
) {
443 sclp_vt220_timer
.function
= sclp_vt220_timeout
;
444 sclp_vt220_timer
.data
= 0UL;
445 sclp_vt220_timer
.expires
= jiffies
+ BUFFER_MAX_DELAY
;
446 add_timer(&sclp_vt220_timer
);
448 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
449 return overall_written
;
453 * This routine is called by the kernel to write a series of
454 * characters to the tty device. The characters may come from
455 * user space or kernel space. This routine will return the
456 * number of characters actually accepted for writing.
459 sclp_vt220_write(struct tty_struct
*tty
, const unsigned char *buf
, int count
)
461 return __sclp_vt220_write(buf
, count
, 1, 0);
464 #define SCLP_VT220_SESSION_ENDED 0x01
465 #define SCLP_VT220_SESSION_STARTED 0x80
466 #define SCLP_VT220_SESSION_DATA 0x00
469 * Called by the SCLP to report incoming event buffers.
472 sclp_vt220_receiver_fn(struct evbuf_header
*evbuf
)
477 /* Ignore input if device is not open */
478 if (sclp_vt220_tty
== NULL
)
481 buffer
= (char *) ((addr_t
) evbuf
+ sizeof(struct evbuf_header
));
482 count
= evbuf
->length
- sizeof(struct evbuf_header
);
485 case SCLP_VT220_SESSION_ENDED
:
486 case SCLP_VT220_SESSION_STARTED
:
488 case SCLP_VT220_SESSION_DATA
:
489 /* Send input to line discipline */
492 tty_insert_flip_string(sclp_vt220_tty
, buffer
, count
);
493 tty_flip_buffer_push(sclp_vt220_tty
);
499 * This routine is called when a particular tty device is opened.
502 sclp_vt220_open(struct tty_struct
*tty
, struct file
*filp
)
504 if (tty
->count
== 1) {
505 sclp_vt220_tty
= tty
;
506 tty
->driver_data
= kmalloc(SCLP_VT220_BUF_SIZE
, GFP_KERNEL
);
507 if (tty
->driver_data
== NULL
)
509 tty
->low_latency
= 0;
515 * This routine is called when a particular tty device is closed.
518 sclp_vt220_close(struct tty_struct
*tty
, struct file
*filp
)
520 if (tty
->count
== 1) {
521 sclp_vt220_tty
= NULL
;
522 kfree(tty
->driver_data
);
523 tty
->driver_data
= NULL
;
528 * This routine is called by the kernel to write a single
529 * character to the tty device. If the kernel uses this routine,
530 * it must call the flush_chars() routine (if defined) when it is
531 * done stuffing characters into the driver.
533 * NOTE: include/linux/tty_driver.h specifies that a character should be
534 * ignored if there is no room in the queue. This driver implements a different
535 * semantic in that it will block when there is no more room left.
538 sclp_vt220_put_char(struct tty_struct
*tty
, unsigned char ch
)
540 __sclp_vt220_write(&ch
, 1, 0, 0);
544 * This routine is called by the kernel after it has written a
545 * series of characters to the tty device using put_char().
548 sclp_vt220_flush_chars(struct tty_struct
*tty
)
550 if (sclp_vt220_outqueue_count
== 0)
551 sclp_vt220_emit_current();
553 sclp_vt220_flush_later
= 1;
557 * This routine returns the numbers of characters the tty driver
558 * will accept for queuing to be written. This number is subject
559 * to change as output buffers get emptied, or if the output flow
563 sclp_vt220_write_room(struct tty_struct
*tty
)
569 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
571 if (sclp_vt220_current_request
!= NULL
)
572 count
= sclp_vt220_space_left(sclp_vt220_current_request
);
573 list_for_each(l
, &sclp_vt220_empty
)
574 count
+= SCLP_VT220_MAX_CHARS_PER_BUFFER
;
575 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
580 * Return number of buffered chars.
583 sclp_vt220_chars_in_buffer(struct tty_struct
*tty
)
587 struct sclp_vt220_request
*r
;
590 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
592 if (sclp_vt220_current_request
!= NULL
)
593 count
= sclp_vt220_chars_stored(sclp_vt220_current_request
);
594 list_for_each(l
, &sclp_vt220_outqueue
) {
595 r
= list_entry(l
, struct sclp_vt220_request
, list
);
596 count
+= sclp_vt220_chars_stored(r
);
598 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
603 __sclp_vt220_flush_buffer(void)
607 sclp_vt220_emit_current();
608 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
609 if (timer_pending(&sclp_vt220_timer
))
610 del_timer(&sclp_vt220_timer
);
611 while (sclp_vt220_outqueue_count
> 0) {
612 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
614 spin_lock_irqsave(&sclp_vt220_lock
, flags
);
616 spin_unlock_irqrestore(&sclp_vt220_lock
, flags
);
620 * Pass on all buffers to the hardware. Return only when there are no more
624 sclp_vt220_flush_buffer(struct tty_struct
*tty
)
626 sclp_vt220_emit_current();
630 * Initialize all relevant components and register driver with system.
632 static void __init
__sclp_vt220_cleanup(void)
634 struct list_head
*page
, *p
;
636 list_for_each_safe(page
, p
, &sclp_vt220_empty
) {
638 if (slab_is_available())
639 free_page((unsigned long) page
);
641 free_bootmem((unsigned long) page
, PAGE_SIZE
);
643 if (!list_empty(&sclp_vt220_register
.list
))
644 sclp_unregister(&sclp_vt220_register
);
645 sclp_vt220_initialized
= 0;
648 static int __init
__sclp_vt220_init(void)
655 if (sclp_vt220_initialized
)
657 sclp_vt220_initialized
= 1;
658 spin_lock_init(&sclp_vt220_lock
);
659 INIT_LIST_HEAD(&sclp_vt220_empty
);
660 INIT_LIST_HEAD(&sclp_vt220_outqueue
);
661 init_waitqueue_head(&sclp_vt220_waitq
);
662 init_timer(&sclp_vt220_timer
);
663 sclp_vt220_current_request
= NULL
;
664 sclp_vt220_buffered_chars
= 0;
665 sclp_vt220_outqueue_count
= 0;
666 sclp_vt220_tty
= NULL
;
667 sclp_vt220_flush_later
= 0;
669 /* Allocate pages for output buffering */
670 num_pages
= slab_is_available() ? MAX_KMEM_PAGES
: MAX_CONSOLE_PAGES
;
671 for (i
= 0; i
< num_pages
; i
++) {
672 if (slab_is_available())
673 page
= (void *) get_zeroed_page(GFP_KERNEL
| GFP_DMA
);
675 page
= alloc_bootmem_low_pages(PAGE_SIZE
);
677 __sclp_vt220_cleanup();
680 list_add_tail((struct list_head
*) page
, &sclp_vt220_empty
);
682 rc
= sclp_register(&sclp_vt220_register
);
684 printk(KERN_ERR SCLP_VT220_PRINT_HEADER
685 "could not register vt220 - "
686 "sclp_register returned %d\n", rc
);
687 __sclp_vt220_cleanup();
692 static const struct tty_operations sclp_vt220_ops
= {
693 .open
= sclp_vt220_open
,
694 .close
= sclp_vt220_close
,
695 .write
= sclp_vt220_write
,
696 .put_char
= sclp_vt220_put_char
,
697 .flush_chars
= sclp_vt220_flush_chars
,
698 .write_room
= sclp_vt220_write_room
,
699 .chars_in_buffer
= sclp_vt220_chars_in_buffer
,
700 .flush_buffer
= sclp_vt220_flush_buffer
,
704 * Register driver with SCLP and Linux and initialize internal tty structures.
706 static int __init
sclp_vt220_tty_init(void)
708 struct tty_driver
*driver
;
712 /* Note: we're not testing for CONSOLE_IS_SCLP here to preserve
713 * symmetry between VM and LPAR systems regarding ttyS1. */
714 driver
= alloc_tty_driver(1);
717 cleanup
= !sclp_vt220_initialized
;
718 rc
= __sclp_vt220_init();
722 driver
->owner
= THIS_MODULE
;
723 driver
->driver_name
= SCLP_VT220_DRIVER_NAME
;
724 driver
->name
= SCLP_VT220_DEVICE_NAME
;
725 driver
->major
= SCLP_VT220_MAJOR
;
726 driver
->minor_start
= SCLP_VT220_MINOR
;
727 driver
->type
= TTY_DRIVER_TYPE_SYSTEM
;
728 driver
->subtype
= SYSTEM_TYPE_TTY
;
729 driver
->init_termios
= tty_std_termios
;
730 driver
->flags
= TTY_DRIVER_REAL_RAW
;
731 tty_set_operations(driver
, &sclp_vt220_ops
);
733 rc
= tty_register_driver(driver
);
735 printk(KERN_ERR SCLP_VT220_PRINT_HEADER
736 "could not register tty - "
737 "tty_register_driver returned %d\n", rc
);
740 sclp_vt220_driver
= driver
;
745 __sclp_vt220_cleanup();
747 put_tty_driver(driver
);
750 __initcall(sclp_vt220_tty_init
);
752 #ifdef CONFIG_SCLP_VT220_CONSOLE
755 sclp_vt220_con_write(struct console
*con
, const char *buf
, unsigned int count
)
757 __sclp_vt220_write((const unsigned char *) buf
, count
, 1, 1);
760 static struct tty_driver
*
761 sclp_vt220_con_device(struct console
*c
, int *index
)
764 return sclp_vt220_driver
;
768 * This routine is called from panic when the kernel is going to give up.
769 * We have to make sure that all buffers will be flushed to the SCLP.
770 * Note that this function may be called from within an interrupt context.
773 sclp_vt220_con_unblank(void)
775 __sclp_vt220_flush_buffer();
778 /* Structure needed to register with printk */
779 static struct console sclp_vt220_console
=
781 .name
= SCLP_VT220_CONSOLE_NAME
,
782 .write
= sclp_vt220_con_write
,
783 .device
= sclp_vt220_con_device
,
784 .unblank
= sclp_vt220_con_unblank
,
785 .flags
= CON_PRINTBUFFER
,
786 .index
= SCLP_VT220_CONSOLE_INDEX
790 sclp_vt220_con_init(void)
794 if (!CONSOLE_IS_SCLP
)
796 rc
= __sclp_vt220_init();
799 /* Attach linux console */
800 register_console(&sclp_vt220_console
);
804 console_initcall(sclp_vt220_con_init
);
805 #endif /* CONFIG_SCLP_VT220_CONSOLE */