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
{
59 uint8_t loadparm
[LOADPARM_LEN
];
60 } __attribute__((packed
)) ReadInfo
;
64 char data
[SCCB_DATA_LEN
];
65 } __attribute__((packed
)) SCCB
;
67 /* SCLP event types */
68 #define SCLP_EVENT_ASCII_CONSOLE_DATA 0x1a
69 #define SCLP_EVENT_SIGNAL_QUIESCE 0x1d
71 /* SCLP event masks */
72 #define SCLP_EVENT_MASK_SIGNAL_QUIESCE 0x00000008
73 #define SCLP_EVENT_MASK_MSG_ASCII 0x00000040
75 #define SCLP_UNCONDITIONAL_READ 0x00
76 #define SCLP_SELECTIVE_READ 0x01
78 typedef struct WriteEventMask
{
82 uint32_t cp_receive_mask
;
83 uint32_t cp_send_mask
;
85 uint32_t receive_mask
;
86 } __attribute__((packed
)) WriteEventMask
;
88 typedef struct EventBufferHeader
{
93 } __attribute__((packed
)) EventBufferHeader
;
95 typedef struct WriteEventData
{
97 EventBufferHeader ebh
;
99 } __attribute__((packed
)) WriteEventData
;
101 typedef struct ReadEventData
{
103 EventBufferHeader ebh
;
105 } __attribute__((packed
)) ReadEventData
;