aboutsummaryrefslogtreecommitdiff
path: root/pc-bios/s390-ccw/cio.c
diff options
context:
space:
mode:
authorJason J. Herne <jjherne@linux.ibm.com>2019-04-04 10:34:24 -0400
committerThomas Huth <thuth@redhat.com>2019-04-12 12:40:35 +0200
commit120d04103e3f870d0fcd2a23c2ada0a4a4f036cc (patch)
tree1283b5381bf4f745a2202e601e53cf9172f48e3e /pc-bios/s390-ccw/cio.c
parentd96c5db77f1058ee9509554f43b945c66b3aa7c9 (diff)
downloadqemu-120d04103e3f870d0fcd2a23c2ada0a4a4f036cc.zip
qemu-120d04103e3f870d0fcd2a23c2ada0a4a4f036cc.tar.gz
qemu-120d04103e3f870d0fcd2a23c2ada0a4a4f036cc.tar.bz2
s390-bios: Decouple channel i/o logic from virtio
Create a separate library for channel i/o related code. This decouples channel i/o operations from virtio and allows us to make use of them for the real dasd boot path. Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <1554388475-18329-6-git-send-email-jjherne@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'pc-bios/s390-ccw/cio.c')
-rw-r--r--pc-bios/s390-ccw/cio.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/pc-bios/s390-ccw/cio.c b/pc-bios/s390-ccw/cio.c
new file mode 100644
index 0000000..87c6b34
--- /dev/null
+++ b/pc-bios/s390-ccw/cio.c
@@ -0,0 +1,44 @@
+/*
+ * S390 Channel I/O
+ *
+ * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
+ * Copyright (c) 2019 IBM Corp.
+ *
+ * Author(s): Jason J. Herne <jjherne@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or (at
+ * your option) any later version. See the COPYING file in the top-level
+ * directory.
+ */
+
+#include "libc.h"
+#include "s390-ccw.h"
+#include "cio.h"
+
+static char chsc_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
+
+int enable_mss_facility(void)
+{
+ int ret;
+ ChscAreaSda *sda_area = (ChscAreaSda *) chsc_page;
+
+ memset(sda_area, 0, PAGE_SIZE);
+ sda_area->request.length = 0x0400;
+ sda_area->request.code = 0x0031;
+ sda_area->operation_code = 0x2;
+
+ ret = chsc(sda_area);
+ if ((ret == 0) && (sda_area->response.code == 0x0001)) {
+ return 0;
+ }
+ return -EIO;
+}
+
+void enable_subchannel(SubChannelId schid)
+{
+ Schib schib;
+
+ stsch_err(schid, &schib);
+ schib.pmcw.ena = 1;
+ msch(schid, &schib);
+}