2 * SCLP ASCII access driver
4 * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
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
14 /* SCLP command codes */
15 #define SCLP_CMDW_READ_SCP_INFO 0x00020001
16 #define SCLP_CMDW_READ_SCP_INFO_FORCED 0x00120001
17 #define SCLP_CMD_READ_EVENT_DATA 0x00770005
18 #define SCLP_CMD_WRITE_EVENT_DATA 0x00760005
19 #define SCLP_CMD_READ_EVENT_DATA 0x00770005
20 #define SCLP_CMD_WRITE_EVENT_DATA 0x00760005
21 #define SCLP_CMD_WRITE_EVENT_MASK 0x00780005
23 /* SCLP response codes */
24 #define SCLP_RC_NORMAL_READ_COMPLETION 0x0010
25 #define SCLP_RC_NORMAL_COMPLETION 0x0020
26 #define SCLP_RC_INVALID_SCLP_COMMAND 0x01f0
27 #define SCLP_RC_CONTAINED_EQUIPMENT_CHECK 0x0340
28 #define SCLP_RC_INSUFFICIENT_SCCB_LENGTH 0x0300
29 #define SCLP_RC_INVALID_FUNCTION 0x40f0
30 #define SCLP_RC_NO_EVENT_BUFFERS_STORED 0x60f0
31 #define SCLP_RC_INVALID_SELECTION_MASK 0x70f0
32 #define SCLP_RC_INCONSISTENT_LENGTHS 0x72f0
33 #define SCLP_RC_EVENT_BUFFER_SYNTAX_ERROR 0x73f0
34 #define SCLP_RC_INVALID_MASK_LENGTH 0x74f0
36 /* Service Call Control Block (SCCB) and its elements */
38 #define SCCB_SIZE 4096
40 #define SCLP_VARIABLE_LENGTH_RESPONSE 0x80
41 #define SCLP_EVENT_BUFFER_ACCEPTED 0x80
43 #define SCLP_FC_NORMAL_WRITE 0
45 typedef struct SCCBHeader
{
47 uint8_t function_code
;
48 uint8_t control_mask
[3];
49 uint16_t response_code
;
50 } __attribute__((packed
)) SCCBHeader
;
52 #define SCCB_DATA_LEN (SCCB_SIZE - sizeof(SCCBHeader))
54 typedef struct ReadInfo
{
58 } __attribute__((packed
)) ReadInfo
;
62 char data
[SCCB_DATA_LEN
];
63 } __attribute__((packed
)) SCCB
;
65 /* SCLP event types */
66 #define SCLP_EVENT_ASCII_CONSOLE_DATA 0x1a
67 #define SCLP_EVENT_SIGNAL_QUIESCE 0x1d
69 /* SCLP event masks */
70 #define SCLP_EVENT_MASK_SIGNAL_QUIESCE 0x00000008
71 #define SCLP_EVENT_MASK_MSG_ASCII 0x00000040
73 #define SCLP_UNCONDITIONAL_READ 0x00
74 #define SCLP_SELECTIVE_READ 0x01
76 typedef struct WriteEventMask
{
80 uint32_t cp_receive_mask
;
81 uint32_t cp_send_mask
;
83 uint32_t receive_mask
;
84 } __attribute__((packed
)) WriteEventMask
;
86 typedef struct EventBufferHeader
{
91 } __attribute__((packed
)) EventBufferHeader
;
93 typedef struct WriteEventData
{
95 EventBufferHeader ebh
;
97 } __attribute__((packed
)) WriteEventData
;
99 typedef struct ReadEventData
{
101 EventBufferHeader ebh
;
103 } __attribute__((packed
)) ReadEventData
;