blob: e3b0290995ba67d8c3d5c5374ac2e12023dc6dec [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Michael Holzheu62b749422009-06-16 10:30:40 +02002 * interface to the SCLP-read/write driver
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
Michael Holzheu62b749422009-06-16 10:30:40 +02004 * Copyright IBM Corporation 1999, 2009
5 *
6 * Author(s): Martin Peschke <mpeschke@de.ibm.com>
7 * Martin Schwidefsky <schwidefsky@de.ibm.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
9
10#ifndef __SCLP_RW_H__
11#define __SCLP_RW_H__
12
13#include <linux/list.h>
14
15struct mto {
16 u16 length;
17 u16 type;
18 u16 line_type_flags;
19 u8 alarm_control;
20 u8 _reserved[3];
21} __attribute__((packed));
22
23struct go {
24 u16 length;
25 u16 type;
26 u32 domid;
27 u8 hhmmss_time[8];
28 u8 th_time[3];
29 u8 reserved_0;
30 u8 dddyyyy_date[7];
31 u8 _reserved_1;
32 u16 general_msg_flags;
33 u8 _reserved_2[10];
34 u8 originating_system_name[8];
35 u8 job_guest_name[8];
36} __attribute__((packed));
37
38struct mdb_header {
39 u16 length;
40 u16 type;
41 u32 tag;
42 u32 revision_code;
43} __attribute__((packed));
44
45struct mdb {
46 struct mdb_header header;
47 struct go go;
Martin Schwidefsky18d1a7f2015-10-01 14:11:35 +020048 struct mto mto;
Linus Torvalds1da177e2005-04-16 15:20:36 -070049} __attribute__((packed));
50
51struct msg_buf {
52 struct evbuf_header header;
53 struct mdb mdb;
54} __attribute__((packed));
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056/* The number of empty mto buffers that can be contained in a single sccb. */
Martin Schwidefsky18d1a7f2015-10-01 14:11:35 +020057#define NR_EMPTY_MSG_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \
58 sizeof(struct sccb_header)) / sizeof(struct msg_buf))
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60/*
61 * data structure for information about list of SCCBs (only for writing),
62 * will be located at the end of a SCCBs page
63 */
64struct sclp_buffer {
65 struct list_head list; /* list_head for sccb_info chain */
66 struct sclp_req request;
Martin Schwidefsky18d1a7f2015-10-01 14:11:35 +020067 void *sccb;
68 struct msg_buf *current_msg;
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 char *current_line;
70 int current_length;
71 int retry_count;
72 /* output format settings */
73 unsigned short columns;
74 unsigned short htab;
75 /* statistics about this buffer */
Martin Schwidefsky18d1a7f2015-10-01 14:11:35 +020076 unsigned int char_sum; /* # chars in sccb */
77 unsigned int messages; /* # messages in sccb */
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 /* Callback that is called after reaching final status. */
79 void (*callback)(struct sclp_buffer *, int);
80};
81
82int sclp_rw_init(void);
83struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short);
84void *sclp_unmake_buffer(struct sclp_buffer *);
85int sclp_buffer_space(struct sclp_buffer *);
86int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
87int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
88void sclp_set_columns(struct sclp_buffer *, unsigned short);
89void sclp_set_htab(struct sclp_buffer *, unsigned short);
90int sclp_chars_in_buffer(struct sclp_buffer *);
91
Heiko Carstensc9568fd2009-07-07 16:37:03 +020092#ifdef CONFIG_SCLP_CONSOLE
Michael Holzheu62b749422009-06-16 10:30:40 +020093void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event);
Heiko Carstensc9568fd2009-07-07 16:37:03 +020094#else
95static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { }
96#endif
97
Linus Torvalds1da177e2005-04-16 15:20:36 -070098#endif /* __SCLP_RW_H__ */