Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Common interface for I/O on S/390
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #ifndef _ASM_S390_CIO_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #define _ASM_S390_CIO_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/bitops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/genalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <asm/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define LPM_ANYPATH 0xff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define __MAX_CSSID 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define __MAX_SUBCHANNEL 65535
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define __MAX_SSID 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <asm/scsw.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * struct ccw1 - channel command word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * @cmd_code: command code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * @flags: flags, like IDA addressing, etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * @count: byte count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * @cda: data address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * The ccw is the basic structure to build channel programs that perform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * operations with the device or the control unit. Only Format-1 channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * command words are supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) struct ccw1 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	__u8  cmd_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	__u8  flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	__u16 count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	__u32 cda;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) } __attribute__ ((packed,aligned(8)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * struct ccw0 - channel command word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * @cmd_code: command code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * @cda: data address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * @flags: flags, like IDA addressing, etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * @reserved: will be ignored
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * @count: byte count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * The format-0 ccw structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) struct ccw0 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	__u8 cmd_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	__u32 cda : 24;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	__u8  flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	__u8  reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	__u16 count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) } __packed __aligned(8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define CCW_FLAG_DC		0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define CCW_FLAG_CC		0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define CCW_FLAG_SLI		0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #define CCW_FLAG_SKIP		0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define CCW_FLAG_PCI		0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define CCW_FLAG_IDA		0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define CCW_FLAG_SUSPEND	0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define CCW_CMD_READ_IPL	0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define CCW_CMD_NOOP		0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #define CCW_CMD_BASIC_SENSE	0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define CCW_CMD_TIC		0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #define CCW_CMD_STLCK           0x14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define CCW_CMD_SENSE_PGID	0x34
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #define CCW_CMD_SUSPEND_RECONN	0x5B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #define CCW_CMD_RDC		0x64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) #define CCW_CMD_RELEASE		0x94
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #define CCW_CMD_SET_PGID	0xAF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) #define CCW_CMD_SENSE_ID	0xE4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #define CCW_CMD_DCTL		0xF3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #define SENSE_MAX_COUNT		0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * struct erw - extended report word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * @res0: reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * @auth: authorization check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  * @pvrf: path-verification-required flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * @cpt: channel-path timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * @fsavf: failing storage address validity flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * @cons: concurrent sense
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * @scavf: secondary ccw address validity flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * @fsaf: failing storage address format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * @scnt: sense count, if @cons == %1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * @res16: reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) struct erw {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	__u32 res0  : 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	__u32 auth  : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	__u32 pvrf  : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	__u32 cpt   : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	__u32 fsavf : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	__u32 cons  : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	__u32 scavf : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	__u32 fsaf  : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	__u32 scnt  : 6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	__u32 res16 : 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  * struct erw_eadm - EADM Subchannel extended report word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * @b: aob error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * @r: arsb error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct erw_eadm {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	__u32 : 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	__u32 b : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	__u32 r : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	__u32  : 14;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  * struct sublog - subchannel logout area
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  * @res0: reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  * @esf: extended status flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * @lpum: last path used mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * @arep: ancillary report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * @fvf: field-validity flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * @sacc: storage access code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  * @termc: termination code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * @devsc: device-status check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  * @serr: secondary error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  * @ioerr: i/o-error alert
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)  * @seqc: sequence code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) struct sublog {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	__u32 res0  : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	__u32 esf   : 7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	__u32 lpum  : 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	__u32 arep  : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	__u32 fvf   : 5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	__u32 sacc  : 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	__u32 termc : 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	__u32 devsc : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	__u32 serr  : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	__u32 ioerr : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	__u32 seqc  : 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * struct esw0 - Format 0 Extended Status Word (ESW)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  * @sublog: subchannel logout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * @erw: extended report word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  * @faddr: failing storage address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  * @saddr: secondary ccw address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct esw0 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	struct sublog sublog;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	struct erw erw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	__u32  faddr[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	__u32  saddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  * struct esw1 - Format 1 Extended Status Word (ESW)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * @zero0: reserved zeros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * @lpum: last path used mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  * @zero16: reserved zeros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  * @erw: extended report word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * @zeros: three fullwords of zeros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct esw1 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	__u8  zero0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	__u8  lpum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	__u16 zero16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	struct erw erw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	__u32 zeros[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  * struct esw2 - Format 2 Extended Status Word (ESW)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)  * @zero0: reserved zeros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  * @lpum: last path used mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  * @dcti: device-connect-time interval
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  * @erw: extended report word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * @zeros: three fullwords of zeros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) struct esw2 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	__u8  zero0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	__u8  lpum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	__u16 dcti;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	struct erw erw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	__u32 zeros[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  * struct esw3 - Format 3 Extended Status Word (ESW)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * @zero0: reserved zeros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  * @lpum: last path used mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  * @res: reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)  * @erw: extended report word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  * @zeros: three fullwords of zeros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) struct esw3 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	__u8  zero0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	__u8  lpum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	__u16 res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	struct erw erw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	__u32 zeros[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * struct esw_eadm - EADM Subchannel Extended Status Word (ESW)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * @sublog: subchannel logout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * @erw: extended report word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) struct esw_eadm {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	__u32 sublog;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	struct erw_eadm erw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	__u32 : 32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	__u32 : 32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	__u32 : 32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  * struct irb - interruption response block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  * @scsw: subchannel status word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)  * @esw: extended status word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * @ecw: extended control word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  * The irb that is handed to the device driver when an interrupt occurs. For
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  * solicited interrupts, the common I/O layer already performs checks whether
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  * a field is valid; a field not being valid is always passed as %0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)  * If a unit check occurred, @ecw may contain sense data; this is retrieved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  * by the common I/O layer itself if the device doesn't support concurrent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  * sense (so that the device driver never needs to perform basic sense itself).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  * if applicable).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct irb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	union scsw scsw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 		struct esw0 esw0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		struct esw1 esw1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		struct esw2 esw2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		struct esw3 esw3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		struct esw_eadm eadm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	} esw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	__u8   ecw[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) } __attribute__ ((packed,aligned(4)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  * struct ciw - command information word  (CIW) layout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)  * @et: entry type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)  * @reserved: reserved bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)  * @ct: command type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)  * @cmd: command code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)  * @count: command count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) struct ciw {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	__u32 et       :  2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	__u32 reserved :  2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	__u32 ct       :  4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	__u32 cmd      :  8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	__u32 count    : 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) #define CIW_TYPE_RCD	0x0    	/* read configuration data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) #define CIW_TYPE_SII	0x1    	/* set interface identifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) #define CIW_TYPE_RNI	0x2    	/* read node identifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  * Node Descriptor as defined in SA22-7204, "Common I/O-Device Commands"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #define ND_VALIDITY_VALID	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) #define ND_VALIDITY_OUTDATED	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #define ND_VALIDITY_INVALID	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) struct node_descriptor {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	/* Flags. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 			u32 validity:3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 			u32 reserved:5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 		} __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 		u8 byte0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	} __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	/* Node parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	u32 params:24;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	/* Node ID. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	char type[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	char model[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	char manufacturer[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	char plant[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	char seq[12];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	u16 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  * Flags used as input parameters for do_IO()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) #define DOIO_ALLOW_SUSPEND	 0x0001 /* allow for channel prog. suspend */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) #define DOIO_DENY_PREFETCH	 0x0002 /* don't allow for CCW prefetch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) #define DOIO_SUPPRESS_INTER	 0x0004 /* suppress intermediate inter. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 					/* ... for suspended CCWs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) /* Device or subchannel gone. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) #define CIO_GONE       0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) /* No path to device. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) #define CIO_NO_PATH    0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) /* Device has appeared. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) #define CIO_OPER       0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) /* Sick revalidation of device. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) #define CIO_REVALIDATE 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) /* Device did not respond in time. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) #define CIO_BOXED      0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)  * struct ccw_dev_id - unique identifier for ccw devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)  * @ssid: subchannel set id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)  * @devno: device number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  * This structure is not directly based on any hardware structure. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)  * hardware identifies a device by its device number and its subchannel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  * which is in turn identified by its id. In order to get a unique identifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  * for ccw devices across subchannel sets, @struct ccw_dev_id has been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  * introduced.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) struct ccw_dev_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	u8 ssid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	u16 devno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)  * ccw_device_id_is_equal() - compare two ccw_dev_ids
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)  * @dev_id1: a ccw_dev_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)  * @dev_id2: another ccw_dev_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)  * Returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)  *  %1 if the two structures are equal field-by-field,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)  *  %0 if not.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  * Context:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)  *  any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 				      struct ccw_dev_id *dev_id2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	if ((dev_id1->ssid == dev_id2->ssid) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	    (dev_id1->devno == dev_id2->devno))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)  * pathmask_to_pos() - find the position of the left-most bit in a pathmask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)  * @mask: pathmask with at least one bit set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) static inline u8 pathmask_to_pos(u8 mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	return 8 - ffs(mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) extern void css_schedule_reprobe(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) extern void *cio_dma_zalloc(size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) extern void cio_dma_free(void *cpu_addr, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) extern struct device *cio_get_dma_css_dev(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) void *cio_gp_dma_zalloc(struct gen_pool *gp_dma, struct device *dma_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 			size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) void cio_gp_dma_free(struct gen_pool *gp_dma, void *cpu_addr, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) void cio_gp_dma_destroy(struct gen_pool *gp_dma, struct device *dma_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) struct gen_pool *cio_gp_dma_create(struct device *dma_dev, int nr_pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) /* Function from drivers/s390/cio/chsc.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) int chsc_sstpc(void *page, unsigned int op, u16 ctrl, u64 *clock_delta);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) int chsc_sstpi(void *page, void *result, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) int chsc_stzi(void *page, void *result, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) int chsc_sgib(u32 origin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) #endif