master
h 116 lines 3.35 KB
Raw
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 #ifndef SCLP_H
12 #define SCLP_H
13
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
22
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
35
36 /* Service Call Control Block (SCCB) and its elements */
37
38 #define SCCB_SIZE 4096
39
40 #define SCLP_VARIABLE_LENGTH_RESPONSE 0x80
41 #define SCLP_EVENT_BUFFER_ACCEPTED 0x80
42
43 #define SCLP_FC_NORMAL_WRITE 0
44
45 typedef struct SCCBHeader {
46 uint16_t length;
47 uint8_t function_code;
48 uint8_t control_mask[3];
49 uint16_t response_code;
50 } __attribute__((packed)) SCCBHeader;
51
52 #define SCCB_DATA_LEN (SCCB_SIZE - sizeof(SCCBHeader))
53 #define SCCB_FAC134_DIAG320_BIT 0x4
54 #define SCCB_FAC_IPL_SIPL_BIT 0x4000
55 #define SCCB_FAC_IPL_SCLAF_BIT 0x1000
56
57 typedef struct ReadInfo {
58 SCCBHeader h;
59 uint16_t rnmax;
60 uint8_t rnsize;
61 uint8_t reserved[13];
62 uint8_t loadparm[LOADPARM_LEN];
63 uint8_t reserved1[102];
64 uint8_t fac134;
65 uint8_t reserved2;
66 uint16_t fac_ipl;
67 } __attribute__((packed)) ReadInfo;
68
69 typedef struct SCCB {
70 SCCBHeader h;
71 char data[SCCB_DATA_LEN];
72 } __attribute__((packed)) SCCB;
73
74 /* SCLP event types */
75 #define SCLP_EVENT_ASCII_CONSOLE_DATA 0x1a
76 #define SCLP_EVENT_SIGNAL_QUIESCE 0x1d
77
78 /* SCLP event masks */
79 #define SCLP_EVENT_MASK_SIGNAL_QUIESCE 0x00000008
80 #define SCLP_EVENT_MASK_MSG_ASCII 0x00000040
81
82 #define SCLP_UNCONDITIONAL_READ 0x00
83 #define SCLP_SELECTIVE_READ 0x01
84
85 typedef struct WriteEventMask {
86 SCCBHeader h;
87 uint16_t _reserved;
88 uint16_t mask_length;
89 uint32_t cp_receive_mask;
90 uint32_t cp_send_mask;
91 uint32_t send_mask;
92 uint32_t receive_mask;
93 } __attribute__((packed)) WriteEventMask;
94
95 typedef struct EventBufferHeader {
96 uint16_t length;
97 uint8_t type;
98 uint8_t flags;
99 uint16_t _reserved;
100 } __attribute__((packed)) EventBufferHeader;
101
102 typedef struct WriteEventData {
103 SCCBHeader h;
104 EventBufferHeader ebh;
105 char data[];
106 } __attribute__((packed)) WriteEventData;
107
108 typedef struct ReadEventData {
109 SCCBHeader h;
110 EventBufferHeader ebh;
111 uint32_t mask;
112 } __attribute__((packed)) ReadEventData;
113
114 #define __pa(x) (x)
115
116 #endif /* SCLP_H */