blob: 6aa7a6948bc91a29a6047b7d6f808a064cd0fcc4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * drivers/s390/char/sclp_rw.h
3 * interface to the SCLP-read/write driver
4 *
5 * S390 version
6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Peschke <mpeschke@de.ibm.com>
8 * Martin Schwidefsky <schwidefsky@de.ibm.com>
9 */
10
11#ifndef __SCLP_RW_H__
12#define __SCLP_RW_H__
13
14#include <linux/list.h>
15
16struct mto {
17 u16 length;
18 u16 type;
19 u16 line_type_flags;
20 u8 alarm_control;
21 u8 _reserved[3];
22} __attribute__((packed));
23
24struct go {
25 u16 length;
26 u16 type;
27 u32 domid;
28 u8 hhmmss_time[8];
29 u8 th_time[3];
30 u8 reserved_0;
31 u8 dddyyyy_date[7];
32 u8 _reserved_1;
33 u16 general_msg_flags;
34 u8 _reserved_2[10];
35 u8 originating_system_name[8];
36 u8 job_guest_name[8];
37} __attribute__((packed));
38
39struct mdb_header {
40 u16 length;
41 u16 type;
42 u32 tag;
43 u32 revision_code;
44} __attribute__((packed));
45
46struct mdb {
47 struct mdb_header header;
48 struct go go;
49} __attribute__((packed));
50
51struct msg_buf {
52 struct evbuf_header header;
53 struct mdb mdb;
54} __attribute__((packed));
55
56struct write_sccb {
57 struct sccb_header header;
58 struct msg_buf msg_buf;
59} __attribute__((packed));
60
61/* The number of empty mto buffers that can be contained in a single sccb. */
62#define NR_EMPTY_MTO_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \
63 sizeof(struct write_sccb)) / sizeof(struct mto))
64
65/*
66 * data structure for information about list of SCCBs (only for writing),
67 * will be located at the end of a SCCBs page
68 */
69struct sclp_buffer {
70 struct list_head list; /* list_head for sccb_info chain */
71 struct sclp_req request;
72 struct write_sccb *sccb;
73 char *current_line;
74 int current_length;
75 int retry_count;
76 /* output format settings */
77 unsigned short columns;
78 unsigned short htab;
79 /* statistics about this buffer */
80 unsigned int mto_char_sum; /* # chars in sccb */
81 unsigned int mto_number; /* # mtos in sccb */
82 /* Callback that is called after reaching final status. */
83 void (*callback)(struct sclp_buffer *, int);
84};
85
86int sclp_rw_init(void);
87struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short);
88void *sclp_unmake_buffer(struct sclp_buffer *);
89int sclp_buffer_space(struct sclp_buffer *);
90int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
91int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
92void sclp_set_columns(struct sclp_buffer *, unsigned short);
93void sclp_set_htab(struct sclp_buffer *, unsigned short);
94int sclp_chars_in_buffer(struct sclp_buffer *);
95
96#endif /* __SCLP_RW_H__ */