iotests: Add tests for the x-blockdev-del command
[qemu/cris-port.git] / hw / s390x / css.h
bloba09bb1f87c180da61166f53324ff1090ed405656
1 /*
2 * Channel subsystem structures and definitions.
4 * Copyright 2012 IBM Corp.
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
7 * This work is licensed under the terms of the GNU GPL, version 2 or (at
8 * your option) any later version. See the COPYING file in the top-level
9 * directory.
12 #ifndef CSS_H
13 #define CSS_H
15 #include "ioinst.h"
17 /* Channel subsystem constants. */
18 #define MAX_SCHID 65535
19 #define MAX_SSID 3
20 #define MAX_CSSID 254 /* 255 is reserved */
21 #define MAX_CHPID 255
23 #define MAX_CIWS 62
25 typedef struct CIW {
26 uint8_t type;
27 uint8_t command;
28 uint16_t count;
29 } QEMU_PACKED CIW;
31 typedef struct SenseId {
32 /* common part */
33 uint8_t reserved; /* always 0x'FF' */
34 uint16_t cu_type; /* control unit type */
35 uint8_t cu_model; /* control unit model */
36 uint16_t dev_type; /* device type */
37 uint8_t dev_model; /* device model */
38 uint8_t unused; /* padding byte */
39 /* extended part */
40 CIW ciw[MAX_CIWS]; /* variable # of CIWs */
41 } QEMU_PACKED SenseId;
43 /* Channel measurements, from linux/drivers/s390/cio/cmf.c. */
44 typedef 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;
55 typedef 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;
68 struct SubchDev {
69 /* channel-subsystem related things: */
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 bool ccw_fmt_1;
80 bool thinint_active;
81 uint8_t ccw_no_data_cnt;
82 /* transport-provided data: */
83 int (*ccw_cb) (SubchDev *, CCW1);
84 void (*disable_cb)(SubchDev *);
85 SenseId id;
86 void *driver_data;
89 typedef SubchDev *(*css_subch_cb_func)(uint8_t m, uint8_t cssid, uint8_t ssid,
90 uint16_t schid);
91 void subch_device_save(SubchDev *s, QEMUFile *f);
92 int subch_device_load(SubchDev *s, QEMUFile *f);
93 int css_create_css_image(uint8_t cssid, bool default_image);
94 bool css_devno_used(uint8_t cssid, uint8_t ssid, uint16_t devno);
95 void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
96 uint16_t devno, SubchDev *sch);
97 void css_sch_build_virtual_schib(SubchDev *sch, uint8_t chpid, uint8_t type);
98 uint16_t css_build_subchannel_id(SubchDev *sch);
99 void css_reset(void);
100 void css_reset_sch(SubchDev *sch);
101 void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid);
102 void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
103 int hotplugged, int add);
104 void css_generate_chp_crws(uint8_t cssid, uint8_t chpid);
105 void css_generate_css_crws(uint8_t cssid);
106 void css_adapter_interrupt(uint8_t isc);
108 #define CSS_IO_ADAPTER_VIRTIO 1
109 int css_register_io_adapter(uint8_t type, uint8_t isc, bool swap,
110 bool maskable, uint32_t *id);
111 #endif