]> git.proxmox.com Git - qemu.git/blob - target-s390x/ioinst.c
s390: Channel I/O basic definitions.
[qemu.git] / target-s390x / ioinst.c
1 /*
2 * I/O instructions for S/390
3 *
4 * Copyright 2012 IBM Corp.
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 *
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.
10 */
11
12 #include <sys/types.h>
13
14 #include "cpu.h"
15 #include "ioinst.h"
16
17 int ioinst_disassemble_sch_ident(uint32_t value, int *m, int *cssid, int *ssid,
18 int *schid)
19 {
20 if (!IOINST_SCHID_ONE(value)) {
21 return -EINVAL;
22 }
23 if (!IOINST_SCHID_M(value)) {
24 if (IOINST_SCHID_CSSID(value)) {
25 return -EINVAL;
26 }
27 *cssid = 0;
28 *m = 0;
29 } else {
30 *cssid = IOINST_SCHID_CSSID(value);
31 *m = 1;
32 }
33 *ssid = IOINST_SCHID_SSID(value);
34 *schid = IOINST_SCHID_NR(value);
35 return 0;
36 }