/*1* include/asm-s390/cio.h2* include/asm-s390x/cio.h3*4* Common interface for I/O on S/3905*/6#ifndef _ASM_S390_CIO_H_7#define _ASM_S390_CIO_H_89#include <linux/spinlock.h>10#include <asm/types.h>1112#ifdef __KERNEL__1314#define LPM_ANYPATH 0xff15#define __MAX_CSSID 01617#include <asm/scsw.h>1819/**20* struct ccw1 - channel command word21* @cmd_code: command code22* @flags: flags, like IDA addressing, etc.23* @count: byte count24* @cda: data address25*26* The ccw is the basic structure to build channel programs that perform27* operations with the device or the control unit. Only Format-1 channel28* command words are supported.29*/30struct ccw1 {31__u8 cmd_code;32__u8 flags;33__u16 count;34__u32 cda;35} __attribute__ ((packed,aligned(8)));3637#define CCW_FLAG_DC 0x8038#define CCW_FLAG_CC 0x4039#define CCW_FLAG_SLI 0x2040#define CCW_FLAG_SKIP 0x1041#define CCW_FLAG_PCI 0x0842#define CCW_FLAG_IDA 0x0443#define CCW_FLAG_SUSPEND 0x024445#define CCW_CMD_READ_IPL 0x0246#define CCW_CMD_NOOP 0x0347#define CCW_CMD_BASIC_SENSE 0x0448#define CCW_CMD_TIC 0x0849#define CCW_CMD_STLCK 0x1450#define CCW_CMD_SENSE_PGID 0x3451#define CCW_CMD_SUSPEND_RECONN 0x5B52#define CCW_CMD_RDC 0x6453#define CCW_CMD_RELEASE 0x9454#define CCW_CMD_SET_PGID 0xAF55#define CCW_CMD_SENSE_ID 0xE456#define CCW_CMD_DCTL 0xF35758#define SENSE_MAX_COUNT 0x205960/**61* struct erw - extended report word62* @res0: reserved63* @auth: authorization check64* @pvrf: path-verification-required flag65* @cpt: channel-path timeout66* @fsavf: failing storage address validity flag67* @cons: concurrent sense68* @scavf: secondary ccw address validity flag69* @fsaf: failing storage address format70* @scnt: sense count, if @cons == %171* @res16: reserved72*/73struct erw {74__u32 res0 : 3;75__u32 auth : 1;76__u32 pvrf : 1;77__u32 cpt : 1;78__u32 fsavf : 1;79__u32 cons : 1;80__u32 scavf : 1;81__u32 fsaf : 1;82__u32 scnt : 6;83__u32 res16 : 16;84} __attribute__ ((packed));8586/**87* struct sublog - subchannel logout area88* @res0: reserved89* @esf: extended status flags90* @lpum: last path used mask91* @arep: ancillary report92* @fvf: field-validity flags93* @sacc: storage access code94* @termc: termination code95* @devsc: device-status check96* @serr: secondary error97* @ioerr: i/o-error alert98* @seqc: sequence code99*/100struct sublog {101__u32 res0 : 1;102__u32 esf : 7;103__u32 lpum : 8;104__u32 arep : 1;105__u32 fvf : 5;106__u32 sacc : 2;107__u32 termc : 2;108__u32 devsc : 1;109__u32 serr : 1;110__u32 ioerr : 1;111__u32 seqc : 3;112} __attribute__ ((packed));113114/**115* struct esw0 - Format 0 Extended Status Word (ESW)116* @sublog: subchannel logout117* @erw: extended report word118* @faddr: failing storage address119* @saddr: secondary ccw address120*/121struct esw0 {122struct sublog sublog;123struct erw erw;124__u32 faddr[2];125__u32 saddr;126} __attribute__ ((packed));127128/**129* struct esw1 - Format 1 Extended Status Word (ESW)130* @zero0: reserved zeros131* @lpum: last path used mask132* @zero16: reserved zeros133* @erw: extended report word134* @zeros: three fullwords of zeros135*/136struct esw1 {137__u8 zero0;138__u8 lpum;139__u16 zero16;140struct erw erw;141__u32 zeros[3];142} __attribute__ ((packed));143144/**145* struct esw2 - Format 2 Extended Status Word (ESW)146* @zero0: reserved zeros147* @lpum: last path used mask148* @dcti: device-connect-time interval149* @erw: extended report word150* @zeros: three fullwords of zeros151*/152struct esw2 {153__u8 zero0;154__u8 lpum;155__u16 dcti;156struct erw erw;157__u32 zeros[3];158} __attribute__ ((packed));159160/**161* struct esw3 - Format 3 Extended Status Word (ESW)162* @zero0: reserved zeros163* @lpum: last path used mask164* @res: reserved165* @erw: extended report word166* @zeros: three fullwords of zeros167*/168struct esw3 {169__u8 zero0;170__u8 lpum;171__u16 res;172struct erw erw;173__u32 zeros[3];174} __attribute__ ((packed));175176/**177* struct irb - interruption response block178* @scsw: subchannel status word179* @esw: extened status word, 4 formats180* @ecw: extended control word181*182* The irb that is handed to the device driver when an interrupt occurs. For183* solicited interrupts, the common I/O layer already performs checks whether184* a field is valid; a field not being valid is always passed as %0.185* If a unit check occurred, @ecw may contain sense data; this is retrieved186* by the common I/O layer itself if the device doesn't support concurrent187* sense (so that the device driver never needs to perform basic sene itself).188* For unsolicited interrupts, the irb is passed as-is (expect for sense data,189* if applicable).190*/191struct irb {192union scsw scsw;193union {194struct esw0 esw0;195struct esw1 esw1;196struct esw2 esw2;197struct esw3 esw3;198} esw;199__u8 ecw[32];200} __attribute__ ((packed,aligned(4)));201202/**203* struct ciw - command information word (CIW) layout204* @et: entry type205* @reserved: reserved bits206* @ct: command type207* @cmd: command code208* @count: command count209*/210struct ciw {211__u32 et : 2;212__u32 reserved : 2;213__u32 ct : 4;214__u32 cmd : 8;215__u32 count : 16;216} __attribute__ ((packed));217218#define CIW_TYPE_RCD 0x0 /* read configuration data */219#define CIW_TYPE_SII 0x1 /* set interface identifier */220#define CIW_TYPE_RNI 0x2 /* read node identifier */221222/*223* Flags used as input parameters for do_IO()224*/225#define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */226#define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */227#define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */228/* ... for suspended CCWs */229/* Device or subchannel gone. */230#define CIO_GONE 0x0001231/* No path to device. */232#define CIO_NO_PATH 0x0002233/* Device has appeared. */234#define CIO_OPER 0x0004235/* Sick revalidation of device. */236#define CIO_REVALIDATE 0x0008237/* Device did not respond in time. */238#define CIO_BOXED 0x0010239240/**241* struct ccw_dev_id - unique identifier for ccw devices242* @ssid: subchannel set id243* @devno: device number244*245* This structure is not directly based on any hardware structure. The246* hardware identifies a device by its device number and its subchannel,247* which is in turn identified by its id. In order to get a unique identifier248* for ccw devices across subchannel sets, @struct ccw_dev_id has been249* introduced.250*/251struct ccw_dev_id {252u8 ssid;253u16 devno;254};255256/**257* ccw_device_id_is_equal() - compare two ccw_dev_ids258* @dev_id1: a ccw_dev_id259* @dev_id2: another ccw_dev_id260* Returns:261* %1 if the two structures are equal field-by-field,262* %0 if not.263* Context:264* any265*/266static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,267struct ccw_dev_id *dev_id2)268{269if ((dev_id1->ssid == dev_id2->ssid) &&270(dev_id1->devno == dev_id2->devno))271return 1;272return 0;273}274275extern void wait_cons_dev(void);276277extern void css_schedule_reprobe(void);278279extern void reipl_ccw_dev(struct ccw_dev_id *id);280281struct cio_iplinfo {282u16 devno;283int is_qdio;284};285286extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);287288/* Function from drivers/s390/cio/chsc.c */289int chsc_sstpc(void *page, unsigned int op, u16 ctrl);290int chsc_sstpi(void *page, void *result, size_t size);291292#endif293294#endif295296297