pc-bios/s390-ccw: build for z900
[qemu/ar7.git] / pc-bios / s390-ccw / sclp.h
blob3cbfb789307698a72c26c2fd2c410044e2e10c94
1 /*
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
8 * directory.
9 */
11 #ifndef SCLP_H
12 #define SCLP_H
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 {
46 uint16_t length;
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 {
55 SCCBHeader h;
56 uint16_t rnmax;
57 uint8_t rnsize;
58 } __attribute__((packed)) ReadInfo;
60 typedef struct SCCB {
61 SCCBHeader h;
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 {
77 SCCBHeader h;
78 uint16_t _reserved;
79 uint16_t mask_length;
80 uint32_t cp_receive_mask;
81 uint32_t cp_send_mask;
82 uint32_t send_mask;
83 uint32_t receive_mask;
84 } __attribute__((packed)) WriteEventMask;
86 typedef struct EventBufferHeader {
87 uint16_t length;
88 uint8_t type;
89 uint8_t flags;
90 uint16_t _reserved;
91 } __attribute__((packed)) EventBufferHeader;
93 typedef struct WriteEventData {
94 SCCBHeader h;
95 EventBufferHeader ebh;
96 char data[0];
97 } __attribute__((packed)) WriteEventData;
99 typedef struct ReadEventData {
100 SCCBHeader h;
101 EventBufferHeader ebh;
102 uint32_t mask;
103 } __attribute__((packed)) ReadEventData;
105 #define __pa(x) (x)
107 #endif /* SCLP_H */