Lines Matching +full:background +full:- +full:layer

3  *    Operations Command - Line Mode input
4 * Message - Line Mode output
12 * option) any later version. See the COPYING file in the top-level directory.
18 #include "qemu/error-report.h"
20 #include "chardev/char-fe.h"
24 #include "hw/s390x/event-facility.h"
25 #include "hw/qdev-properties.h"
26 #include "hw/qdev-properties-system.h"
39 /* max size for line-mode data in 4K SCCB page */
40 #define SIZE_CONSOLE_BUFFER (SCCB_DATA_LEN - sizeof(OprtnsCommand))
46 uint32_t write_errors; /* errors writing to char layer */
57 * Character layer call-back functions in DECLARE_INSTANCE_CHECKER()
61 * Accumulate bytes from character layer in console buffer, in DECLARE_INSTANCE_CHECKER()
73 if (scon->event.event_pending) { in DECLARE_INSTANCE_CHECKER()
86 scon->event.event_pending = true; in chr_read()
90 if (scon->length == SIZE_CONSOLE_BUFFER) { in chr_read()
94 scon->buf[scon->length] = *buf; in chr_read()
95 scon->length += 1; in chr_read()
96 if (scon->echo) { in chr_read()
98 * qemu_chr_fe_write and background I/O callbacks */ in chr_read()
99 qemu_chr_fe_write_all(&scon->chr, buf, size); in chr_read()
122 * - convert ASCII byte stream to EBCDIC and
123 * - copy converted data into provided (SCLP) buffer
132 len = cons->length; in get_console_data()
138 ebcdic_put(buf, (char *)&cons->buf, len); in get_console_data()
140 cons->length = 0; in get_console_data()
142 event->event_pending = false; in get_console_data()
155 if (!event->event_pending) { in read_event_data()
160 to = (uint8_t *)&oc->data; in read_event_data()
161 avail = *slen - sizeof(OprtnsCommand); in read_event_data()
168 oc->message_unit.mdmsu.gds_id = GDS_ID_MDSMU; in read_event_data()
169 oc->message_unit.mdmsu.length = cpu_to_be16(sizeof(struct MDMSU)); in read_event_data()
171 oc->message_unit.cpmsu.gds_id = GDS_ID_CPMSU; in read_event_data()
172 oc->message_unit.cpmsu.length = in read_event_data()
173 cpu_to_be16(sizeof(struct MDMSU) - sizeof(GdsVector)); in read_event_data()
175 oc->message_unit.text_command.gds_id = GDS_ID_TEXTCMD; in read_event_data()
176 oc->message_unit.text_command.length = in read_event_data()
177 cpu_to_be16(sizeof(struct MDMSU) - (2 * sizeof(GdsVector))); in read_event_data()
179 oc->message_unit.self_def_text_message.key = GDS_KEY_SELFDEFTEXTMSG; in read_event_data()
180 oc->message_unit.self_def_text_message.length = in read_event_data()
181 cpu_to_be16(sizeof(struct MDMSU) - (3 * sizeof(GdsVector))); in read_event_data()
183 oc->message_unit.text_message.key = GDS_KEY_TEXTMSG; in read_event_data()
184 oc->message_unit.text_message.length = in read_event_data()
187 oc->header.length = cpu_to_be16(sizeof(OprtnsCommand) + src_len); in read_event_data()
188 oc->header.type = SCLP_EVENT_OPRTNS_COMMAND; in read_event_data()
189 *slen = avail - src_len; in read_event_data()
196 * - write console data to character layer
203 if (!qemu_chr_fe_backend_connected(&scon->chr)) { in write_console_data()
209 * qemu_chr_fe_write and background I/O callbacks */ in write_console_data()
210 return qemu_chr_fe_write_all(&scon->chr, buf, len); in write_console_data()
219 len = be16_to_cpu(mdbo->length); in process_mdb()
220 len -= sizeof(mdbo->length) + sizeof(mdbo->type) in process_mdb()
221 + sizeof(mdbo->mto.line_type_flags) in process_mdb()
222 + sizeof(mdbo->mto.alarm_control) in process_mdb()
223 + sizeof(mdbo->mto._reserved); in process_mdb()
228 ascii_put(buffer, mdbo->mto.message, len); in process_mdb()
245 len = be16_to_cpu(data->mdb.header.length); in write_event_data()
246 if (len < sizeof(data->mdb.header)) { in write_event_data()
249 len -= sizeof(data->mdb.header); in write_event_data()
252 mdbo = data->mdb.mdbo; in write_event_data()
254 if (be16_to_cpu(mdbo->length) > len in write_event_data()
255 || be16_to_cpu(mdbo->length) == 0) { in write_event_data()
258 len -= be16_to_cpu(mdbo->length); in write_event_data()
259 mdbo = (void *) mdbo + be16_to_cpu(mdbo->length); in write_event_data()
263 len = be16_to_cpu(data->mdb.header.length) - sizeof(data->mdb.header); in write_event_data()
264 mdbo = data->mdb.mdbo; in write_event_data()
266 switch (be16_to_cpu(mdbo->type)) { in write_event_data()
271 /* character layer error */ in write_event_data()
278 len -= be16_to_cpu(mdbo->length); in write_event_data()
279 mdbo = (void *) mdbo + be16_to_cpu(mdbo->length); in write_event_data()
282 scon->write_errors += errors; in write_event_data()
284 data->header.flags = SCLP_EVENT_BUFFER_ACCEPTED; in write_event_data()
306 /* tell character layer our call-back functions */
315 error_report("Multiple line-mode operator consoles are not supported"); in console_init()
316 return -1; in console_init()
320 qemu_chr_fe_set_handlers(&scon->chr, chr_can_read, in console_init()
331 event->event_pending = false; in console_reset()
332 scon->length = 0; in console_reset()
333 scon->write_errors = 0; in console_reset()
350 dc->vmsd = &vmstate_sclplmconsole; in console_class_init()
351 ec->init = console_init; in console_class_init()
352 ec->get_send_mask = send_mask; in console_class_init()
353 ec->get_receive_mask = receive_mask; in console_class_init()
354 ec->can_handle_event = can_handle_event; in console_class_init()
355 ec->read_event_data = read_event_data; in console_class_init()
356 ec->write_event_data = write_event_data; in console_class_init()
357 set_bit(DEVICE_CATEGORY_INPUT, dc->categories); in console_class_init()