aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSascha Silbe <silbe@linux.vnet.ibm.com>2016-06-15 17:16:05 +0200
committerCornelia Huck <cornelia.huck@de.ibm.com>2016-07-11 09:48:05 +0200
commitcf2499350aa4f2b6bdd30792cdf0b7f264fbcb36 (patch)
tree6ec0ac8db8d6298389ad35af3cf354a40dc21c0d /include
parentbb0995468a39f14077ceaa8ed5afdca849f00c7c (diff)
downloadqemu-cf2499350aa4f2b6bdd30792cdf0b7f264fbcb36.zip
qemu-cf2499350aa4f2b6bdd30792cdf0b7f264fbcb36.tar.gz
qemu-cf2499350aa4f2b6bdd30792cdf0b7f264fbcb36.tar.bz2
s390x/css: factor out some generic code from virtio_ccw_device_realize()
A lot of what virtio_ccw_device_realize() does isn't specific to virtio; it would apply to emulated CCW as well. Factor it out to make it easier to implement emulated CCW devices later on. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/s390x/css.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h
index 38f4d77..1da63e3 100644
--- a/include/hw/s390x/css.h
+++ b/include/hw/s390x/css.h
@@ -17,6 +17,7 @@
#include "hw/s390x/ioinst.h"
/* Channel subsystem constants. */
+#define MAX_DEVNO 65535
#define MAX_SCHID 65535
#define MAX_SSID 3
#define MAX_CSSID 254 /* 255 is reserved */
@@ -24,6 +25,8 @@
#define MAX_CIWS 62
+#define VIRTUAL_CSSID 0xfe
+
typedef struct CIW {
uint8_t type;
uint8_t command;
@@ -169,4 +172,19 @@ extern PropertyInfo css_devid_propinfo;
#define DEFINE_PROP_CSS_DEV_ID(_n, _s, _f) \
DEFINE_PROP(_n, _s, _f, css_devid_propinfo, CssDevId)
+/**
+ * Create a subchannel for the given bus id.
+ *
+ * If @p bus_id is valid, verify that it uses the virtual channel
+ * subsystem id and is not already in use, and find a free subchannel
+ * id for it. If @p bus_id is not valid, find a free subchannel id and
+ * device number across all subchannel sets. If either of the former
+ * actions succeed, allocate a subchannel structure, initialise it
+ * with the bus id, subchannel id and device number, register it with
+ * the CSS and return it. Otherwise return NULL.
+ *
+ * The caller becomes owner of the returned subchannel structure and
+ * is responsible for unregistering and freeing it.
+ */
+SubchDev *css_create_virtual_sch(CssDevId bus_id, Error **errp);
#endif