1
2
3
4
5
6
7
8
9
10
11
12#ifndef CSS_H
13#define CSS_H
14
15#include "ioinst.h"
16
17
18#define MAX_SCHID 65535
19#define MAX_SSID 3
20#define MAX_CSSID 254
21#define MAX_CHPID 255
22
23#define MAX_CIWS 62
24
25typedef struct CIW {
26 uint8_t type;
27 uint8_t command;
28 uint16_t count;
29} QEMU_PACKED CIW;
30
31typedef struct SenseId {
32
33 uint8_t reserved;
34 uint16_t cu_type;
35 uint8_t cu_model;
36 uint16_t dev_type;
37 uint8_t dev_model;
38 uint8_t unused;
39
40 CIW ciw[MAX_CIWS];
41} QEMU_PACKED SenseId;
42
43
44typedef struct CMB {
45 uint16_t ssch_rsch_count;
46 uint16_t sample_count;
47 uint32_t device_connect_time;
48 uint32_t function_pending_time;
49 uint32_t device_disconnect_time;
50 uint32_t control_unit_queuing_time;
51 uint32_t device_active_only_time;
52 uint32_t reserved[2];
53} QEMU_PACKED CMB;
54
55typedef struct CMBE {
56 uint32_t ssch_rsch_count;
57 uint32_t sample_count;
58 uint32_t device_connect_time;
59 uint32_t function_pending_time;
60 uint32_t device_disconnect_time;
61 uint32_t control_unit_queuing_time;
62 uint32_t device_active_only_time;
63 uint32_t device_busy_time;
64 uint32_t initial_command_response_time;
65 uint32_t reserved[7];
66} QEMU_PACKED CMBE;
67
68struct SubchDev {
69
70 uint8_t cssid;
71 uint8_t ssid;
72 uint16_t schid;
73 uint16_t devno;
74 SCHIB curr_status;
75 uint8_t sense_data[32];
76 hwaddr channel_prog;
77 CCW1 last_cmd;
78 bool last_cmd_valid;
79 ORB *orb;
80
81 int (*ccw_cb) (SubchDev *, CCW1);
82 SenseId id;
83 void *driver_data;
84};
85
86typedef SubchDev *(*css_subch_cb_func)(uint8_t m, uint8_t cssid, uint8_t ssid,
87 uint16_t schid);
88int css_create_css_image(uint8_t cssid, bool default_image);
89bool css_devno_used(uint8_t cssid, uint8_t ssid, uint16_t devno);
90void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
91 uint16_t devno, SubchDev *sch);
92void css_sch_build_virtual_schib(SubchDev *sch, uint8_t chpid, uint8_t type);
93void css_reset(void);
94void css_reset_sch(SubchDev *sch);
95void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid);
96void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
97 int hotplugged, int add);
98void css_generate_chp_crws(uint8_t cssid, uint8_t chpid);
99#endif
100