18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Interfaces for vfio-ccw
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2017
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef _VFIO_CCW_H_
118c2ecf20Sopenharmony_ci#define _VFIO_CCW_H_
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/types.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/* used for START SUBCHANNEL, always present */
168c2ecf20Sopenharmony_cistruct ccw_io_region {
178c2ecf20Sopenharmony_ci#define ORB_AREA_SIZE 12
188c2ecf20Sopenharmony_ci	__u8	orb_area[ORB_AREA_SIZE];
198c2ecf20Sopenharmony_ci#define SCSW_AREA_SIZE 12
208c2ecf20Sopenharmony_ci	__u8	scsw_area[SCSW_AREA_SIZE];
218c2ecf20Sopenharmony_ci#define IRB_AREA_SIZE 96
228c2ecf20Sopenharmony_ci	__u8	irb_area[IRB_AREA_SIZE];
238c2ecf20Sopenharmony_ci	__u32	ret_code;
248c2ecf20Sopenharmony_ci} __packed;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/*
278c2ecf20Sopenharmony_ci * used for processing commands that trigger asynchronous actions
288c2ecf20Sopenharmony_ci * Note: this is controlled by a capability
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_ci#define VFIO_CCW_ASYNC_CMD_HSCH (1 << 0)
318c2ecf20Sopenharmony_ci#define VFIO_CCW_ASYNC_CMD_CSCH (1 << 1)
328c2ecf20Sopenharmony_cistruct ccw_cmd_region {
338c2ecf20Sopenharmony_ci	__u32 command;
348c2ecf20Sopenharmony_ci	__u32 ret_code;
358c2ecf20Sopenharmony_ci} __packed;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/*
388c2ecf20Sopenharmony_ci * Used for processing commands that read the subchannel-information block
398c2ecf20Sopenharmony_ci * Reading this region triggers a stsch() to hardware
408c2ecf20Sopenharmony_ci * Note: this is controlled by a capability
418c2ecf20Sopenharmony_ci */
428c2ecf20Sopenharmony_cistruct ccw_schib_region {
438c2ecf20Sopenharmony_ci#define SCHIB_AREA_SIZE 52
448c2ecf20Sopenharmony_ci	__u8 schib_area[SCHIB_AREA_SIZE];
458c2ecf20Sopenharmony_ci} __packed;
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/*
488c2ecf20Sopenharmony_ci * Used for returning a Channel Report Word to userspace.
498c2ecf20Sopenharmony_ci * Note: this is controlled by a capability
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_cistruct ccw_crw_region {
528c2ecf20Sopenharmony_ci	__u32 crw;
538c2ecf20Sopenharmony_ci	__u32 pad;
548c2ecf20Sopenharmony_ci} __packed;
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif
57