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