18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *   Data definitions for channel report processing
48c2ecf20Sopenharmony_ci *    Copyright IBM Corp. 2000, 2009
58c2ecf20Sopenharmony_ci *    Author(s): Ingo Adlung <adlung@de.ibm.com>,
68c2ecf20Sopenharmony_ci *		 Martin Schwidefsky <schwidefsky@de.ibm.com>,
78c2ecf20Sopenharmony_ci *		 Cornelia Huck <cornelia.huck@de.ibm.com>,
88c2ecf20Sopenharmony_ci *		 Heiko Carstens <heiko.carstens@de.ibm.com>,
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef _ASM_S390_CRW_H
128c2ecf20Sopenharmony_ci#define _ASM_S390_CRW_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/types.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * Channel Report Word
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_cistruct crw {
208c2ecf20Sopenharmony_ci	__u32 res1 :  1;   /* reserved zero */
218c2ecf20Sopenharmony_ci	__u32 slct :  1;   /* solicited */
228c2ecf20Sopenharmony_ci	__u32 oflw :  1;   /* overflow */
238c2ecf20Sopenharmony_ci	__u32 chn  :  1;   /* chained */
248c2ecf20Sopenharmony_ci	__u32 rsc  :  4;   /* reporting source code */
258c2ecf20Sopenharmony_ci	__u32 anc  :  1;   /* ancillary report */
268c2ecf20Sopenharmony_ci	__u32 res2 :  1;   /* reserved zero */
278c2ecf20Sopenharmony_ci	__u32 erc  :  6;   /* error-recovery code */
288c2ecf20Sopenharmony_ci	__u32 rsid : 16;   /* reporting-source ID */
298c2ecf20Sopenharmony_ci} __attribute__ ((packed));
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_citypedef void (*crw_handler_t)(struct crw *, struct crw *, int);
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciextern int crw_register_handler(int rsc, crw_handler_t handler);
348c2ecf20Sopenharmony_ciextern void crw_unregister_handler(int rsc);
358c2ecf20Sopenharmony_ciextern void crw_handle_channel_report(void);
368c2ecf20Sopenharmony_civoid crw_wait_for_channel_report(void);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define NR_RSCS 16
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define CRW_RSC_MONITOR  0x2  /* monitoring facility */
418c2ecf20Sopenharmony_ci#define CRW_RSC_SCH	 0x3  /* subchannel */
428c2ecf20Sopenharmony_ci#define CRW_RSC_CPATH	 0x4  /* channel path */
438c2ecf20Sopenharmony_ci#define CRW_RSC_CONFIG	 0x9  /* configuration-alert facility */
448c2ecf20Sopenharmony_ci#define CRW_RSC_CSS	 0xB  /* channel subsystem */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define CRW_ERC_EVENT	 0x00 /* event information pending */
478c2ecf20Sopenharmony_ci#define CRW_ERC_AVAIL	 0x01 /* available */
488c2ecf20Sopenharmony_ci#define CRW_ERC_INIT	 0x02 /* initialized */
498c2ecf20Sopenharmony_ci#define CRW_ERC_TERROR	 0x03 /* temporary error */
508c2ecf20Sopenharmony_ci#define CRW_ERC_IPARM	 0x04 /* installed parm initialized */
518c2ecf20Sopenharmony_ci#define CRW_ERC_TERM	 0x05 /* terminal */
528c2ecf20Sopenharmony_ci#define CRW_ERC_PERRN	 0x06 /* perm. error, fac. not init */
538c2ecf20Sopenharmony_ci#define CRW_ERC_PERRI	 0x07 /* perm. error, facility init */
548c2ecf20Sopenharmony_ci#define CRW_ERC_PMOD	 0x08 /* installed parameters modified */
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif /* _ASM_S390_CRW_H */
57