Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 | 2 | /* |
62b74942 | 3 | * interface to the SCLP-read/write driver |
1da177e4 | 4 | * |
62b74942 MH |
5 | * Copyright IBM Corporation 1999, 2009 |
6 | * | |
7 | * Author(s): Martin Peschke <mpeschke@de.ibm.com> | |
8 | * Martin Schwidefsky <schwidefsky@de.ibm.com> | |
1da177e4 LT |
9 | */ |
10 | ||
11 | #ifndef __SCLP_RW_H__ | |
12 | #define __SCLP_RW_H__ | |
13 | ||
14 | #include <linux/list.h> | |
15 | ||
16 | struct mto { | |
17 | u16 length; | |
18 | u16 type; | |
19 | u16 line_type_flags; | |
20 | u8 alarm_control; | |
21 | u8 _reserved[3]; | |
22 | } __attribute__((packed)); | |
23 | ||
24 | struct 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 | ||
39 | struct mdb_header { | |
40 | u16 length; | |
41 | u16 type; | |
42 | u32 tag; | |
43 | u32 revision_code; | |
44 | } __attribute__((packed)); | |
45 | ||
46 | struct mdb { | |
47 | struct mdb_header header; | |
48 | struct go go; | |
18d1a7f6 | 49 | struct mto mto; |
1da177e4 LT |
50 | } __attribute__((packed)); |
51 | ||
52 | struct msg_buf { | |
53 | struct evbuf_header header; | |
54 | struct mdb mdb; | |
55 | } __attribute__((packed)); | |
56 | ||
1da177e4 | 57 | /* The number of empty mto buffers that can be contained in a single sccb. */ |
18d1a7f6 MS |
58 | #define NR_EMPTY_MSG_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \ |
59 | sizeof(struct sccb_header)) / sizeof(struct msg_buf)) | |
1da177e4 LT |
60 | |
61 | /* | |
62 | * data structure for information about list of SCCBs (only for writing), | |
63 | * will be located at the end of a SCCBs page | |
64 | */ | |
65 | struct sclp_buffer { | |
66 | struct list_head list; /* list_head for sccb_info chain */ | |
67 | struct sclp_req request; | |
18d1a7f6 MS |
68 | void *sccb; |
69 | struct msg_buf *current_msg; | |
1da177e4 LT |
70 | char *current_line; |
71 | int current_length; | |
72 | int retry_count; | |
73 | /* output format settings */ | |
74 | unsigned short columns; | |
75 | unsigned short htab; | |
76 | /* statistics about this buffer */ | |
18d1a7f6 MS |
77 | unsigned int char_sum; /* # chars in sccb */ |
78 | unsigned int messages; /* # messages in sccb */ | |
1da177e4 LT |
79 | /* Callback that is called after reaching final status. */ |
80 | void (*callback)(struct sclp_buffer *, int); | |
81 | }; | |
82 | ||
83 | int sclp_rw_init(void); | |
84 | struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short); | |
85 | void *sclp_unmake_buffer(struct sclp_buffer *); | |
86 | int sclp_buffer_space(struct sclp_buffer *); | |
87 | int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int); | |
88 | int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int)); | |
89 | void sclp_set_columns(struct sclp_buffer *, unsigned short); | |
90 | void sclp_set_htab(struct sclp_buffer *, unsigned short); | |
91 | int sclp_chars_in_buffer(struct sclp_buffer *); | |
92 | ||
c9568fdd | 93 | #ifdef CONFIG_SCLP_CONSOLE |
62b74942 | 94 | void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); |
c9568fdd HC |
95 | #else |
96 | static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { } | |
97 | #endif | |
98 | ||
1da177e4 | 99 | #endif /* __SCLP_RW_H__ */ |