summary refs log tree commit diff stats
path: root/include/hw/s390x/css.h
diff options
context:
space:
mode:
authorJing Liu <liujbjl@linux.vnet.ibm.com>2016-09-19 09:10:43 +0200
committerCornelia Huck <cornelia.huck@de.ibm.com>2017-05-04 10:34:37 +0200
commit6c15e9bfb687f40cc92759536ef2a918fb04349b (patch)
treed64cdf7abcede90f1a5709122e0886400a9c85ed /include/hw/s390x/css.h
parentae92cbd542086a508343dd88fd3b980f3be1b3af (diff)
downloadfocaccia-qemu-6c15e9bfb687f40cc92759536ef2a918fb04349b.tar.gz
focaccia-qemu-6c15e9bfb687f40cc92759536ef2a918fb04349b.zip
s390x/css: Add an algorithm to find a free chpid
This introduces a function named css_find_free_chpid() to find a
free channel path. Because virtio-ccw device used zero as its
channel path number, it would be sensible to skip the reserved one
and search upwards.

Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'include/hw/s390x/css.h')
-rw-r--r--include/hw/s390x/css.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h
index f1f0d7f07a..e61fa74d9b 100644
--- a/include/hw/s390x/css.h
+++ b/include/hw/s390x/css.h
@@ -28,6 +28,7 @@
 #define MAX_CIWS 62
 
 #define VIRTUAL_CSSID 0xfe
+#define VIRTIO_CCW_CHPID 0   /* used by convention */
 
 typedef struct CIW {
     uint8_t type;
@@ -115,6 +116,7 @@ bool css_devno_used(uint8_t cssid, uint8_t ssid, uint16_t devno);
 void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
                       uint16_t devno, SubchDev *sch);
 void css_sch_build_virtual_schib(SubchDev *sch, uint8_t chpid, uint8_t type);
+unsigned int css_find_free_chpid(uint8_t cssid);
 uint16_t css_build_subchannel_id(SubchDev *sch);
 void css_reset(void);
 void css_reset_sch(SubchDev *sch);