1 /* 2 * SCLP ASCII access driver 3 * 4 * Copyright (c) 2013 Alexander Graf <agraf@suse.de> 5 * 6 * This work is licensed under the terms of the GNU GPL, version 2 or (at 7 * your option) any later version. See the COPYING file in the top-level 8 * directory. 9 */ 10 11 #include <libcflat.h> 12 #include <string.h> 13 #include <asm/page.h> 14 #include "sclp.h" 15 16 static void sclp_set_write_mask(void) 17 { 18 WriteEventMask *sccb = (void *)_sccb; 19 20 sclp_mark_busy(); 21 sccb->h.length = sizeof(WriteEventMask); 22 sccb->mask_length = sizeof(unsigned int); 23 sccb->receive_mask = SCLP_EVENT_MASK_MSG_ASCII; 24 sccb->cp_receive_mask = SCLP_EVENT_MASK_MSG_ASCII; 25 sccb->send_mask = SCLP_EVENT_MASK_MSG_ASCII; 26 sccb->cp_send_mask = SCLP_EVENT_MASK_MSG_ASCII; 27 28 sclp_service_call(SCLP_CMD_WRITE_EVENT_MASK, sccb); 29 } 30 31 void sclp_console_setup(void) 32 { 33 sclp_set_write_mask(); 34 } 35 36 void sclp_print(const char *str) 37 { 38 int len = strlen(str); 39 WriteEventData *sccb = (void *)_sccb; 40 41 sclp_mark_busy(); 42 sccb->h.length = sizeof(WriteEventData) + len; 43 sccb->h.function_code = SCLP_FC_NORMAL_WRITE; 44 sccb->ebh.length = sizeof(EventBufferHeader) + len; 45 sccb->ebh.type = SCLP_EVENT_ASCII_CONSOLE_DATA; 46 sccb->ebh.flags = 0; 47 memcpy(sccb->data, str, len); 48 49 sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb); 50 } 51