Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef S390_CIO_H
0003 #define S390_CIO_H
0004 
0005 #include <linux/mutex.h>
0006 #include <linux/device.h>
0007 #include <linux/mod_devicetable.h>
0008 #include <asm/chpid.h>
0009 #include <asm/cio.h>
0010 #include <asm/fcx.h>
0011 #include <asm/schid.h>
0012 #include <asm/tpi.h>
0013 #include "chsc.h"
0014 
0015 /*
0016  * path management control word
0017  */
0018 struct pmcw {
0019     u32 intparm;        /* interruption parameter */
0020     u32 qf   : 1;       /* qdio facility */
0021     u32 w    : 1;
0022     u32 isc  : 3;       /* interruption sublass */
0023     u32 res5 : 3;       /* reserved zeros */
0024     u32 ena  : 1;       /* enabled */
0025     u32 lm   : 2;       /* limit mode */
0026     u32 mme  : 2;       /* measurement-mode enable */
0027     u32 mp   : 1;       /* multipath mode */
0028     u32 tf   : 1;       /* timing facility */
0029     u32 dnv  : 1;       /* device number valid */
0030     u32 dev  : 16;      /* device number */
0031     u8  lpm;        /* logical path mask */
0032     u8  pnom;       /* path not operational mask */
0033     u8  lpum;       /* last path used mask */
0034     u8  pim;        /* path installed mask */
0035     u16 mbi;        /* measurement-block index */
0036     u8  pom;        /* path operational mask */
0037     u8  pam;        /* path available mask */
0038     u8  chpid[8];       /* CHPID 0-7 (if available) */
0039     u32 unused1 : 8;    /* reserved zeros */
0040     u32 st      : 3;    /* subchannel type */
0041     u32 unused2 : 18;   /* reserved zeros */
0042     u32 mbfc    : 1;    /* measurement block format control */
0043     u32 xmwme   : 1;    /* extended measurement word mode enable */
0044     u32 csense  : 1;    /* concurrent sense; can be enabled ...*/
0045                 /*  ... per MSCH, however, if facility */
0046                 /*  ... is not installed, this results */
0047                 /*  ... in an operand exception.       */
0048 } __attribute__ ((packed));
0049 
0050 /* Target SCHIB configuration. */
0051 struct schib_config {
0052     u64 mba;
0053     u32 intparm;
0054     u16 mbi;
0055     u32 isc:3;
0056     u32 ena:1;
0057     u32 mme:2;
0058     u32 mp:1;
0059     u32 csense:1;
0060     u32 mbfc:1;
0061 } __attribute__ ((packed));
0062 
0063 /*
0064  * subchannel information block
0065  */
0066 struct schib {
0067     struct pmcw pmcw;    /* path management control word */
0068     union scsw scsw;     /* subchannel status word */
0069     __u64 mba;               /* measurement block address */
0070     __u8 mda[4];         /* model dependent area */
0071 } __attribute__ ((packed,aligned(4)));
0072 
0073 /*
0074  * When rescheduled, todo's with higher values will overwrite those
0075  * with lower values.
0076  */
0077 enum sch_todo {
0078     SCH_TODO_NOTHING,
0079     SCH_TODO_EVAL,
0080     SCH_TODO_UNREG,
0081 };
0082 
0083 /* subchannel data structure used by I/O subroutines */
0084 struct subchannel {
0085     struct subchannel_id schid;
0086     spinlock_t *lock;   /* subchannel lock */
0087     struct mutex reg_mutex;
0088     enum {
0089         SUBCHANNEL_TYPE_IO = 0,
0090         SUBCHANNEL_TYPE_CHSC = 1,
0091         SUBCHANNEL_TYPE_MSG = 2,
0092         SUBCHANNEL_TYPE_ADM = 3,
0093     } st;           /* subchannel type */
0094     __u8 vpm;       /* verified path mask */
0095     __u8 lpm;       /* logical path mask */
0096     __u8 opm;               /* operational path mask */
0097     struct schib schib; /* subchannel information block */
0098     int isc; /* desired interruption subclass */
0099     struct chsc_ssd_info ssd_info;  /* subchannel description */
0100     struct device dev;  /* entry in device tree */
0101     struct css_driver *driver;
0102     enum sch_todo todo;
0103     struct work_struct todo_work;
0104     struct schib_config config;
0105     u64 dma_mask;
0106     /*
0107      * Driver name to force a match.  Do not set directly, because core
0108      * frees it.  Use driver_set_override() to set or clear it.
0109      */
0110     const char *driver_override;
0111 } __attribute__ ((aligned(8)));
0112 
0113 DECLARE_PER_CPU_ALIGNED(struct irb, cio_irb);
0114 
0115 #define to_subchannel(n) container_of(n, struct subchannel, dev)
0116 
0117 extern int cio_enable_subchannel(struct subchannel *, u32);
0118 extern int cio_disable_subchannel (struct subchannel *);
0119 extern int cio_cancel (struct subchannel *);
0120 extern int cio_clear (struct subchannel *);
0121 extern int cio_cancel_halt_clear(struct subchannel *, int *);
0122 extern int cio_resume (struct subchannel *);
0123 extern int cio_halt (struct subchannel *);
0124 extern int cio_start (struct subchannel *, struct ccw1 *, __u8);
0125 extern int cio_start_key (struct subchannel *, struct ccw1 *, __u8, __u8);
0126 extern int cio_set_options (struct subchannel *, int);
0127 extern int cio_update_schib(struct subchannel *sch);
0128 extern int cio_commit_config(struct subchannel *sch);
0129 
0130 int cio_tm_start_key(struct subchannel *sch, struct tcw *tcw, u8 lpm, u8 key);
0131 int cio_tm_intrg(struct subchannel *sch);
0132 
0133 extern int __init airq_init(void);
0134 
0135 /* Use with care. */
0136 #ifdef CONFIG_CCW_CONSOLE
0137 extern struct subchannel *cio_probe_console(void);
0138 extern int cio_is_console(struct subchannel_id);
0139 extern void cio_register_early_subchannels(void);
0140 extern void cio_tsch(struct subchannel *sch);
0141 #else
0142 #define cio_is_console(schid) 0
0143 static inline void cio_register_early_subchannels(void) {}
0144 #endif
0145 
0146 #endif