]> git.karo-electronics.de Git - linux-beck.git/blob - drivers/s390/cio/css.h
f26e16daecb5a1d42557b53f1bb7fb9fe6dcd0f6
[linux-beck.git] / drivers / s390 / cio / css.h
1 #ifndef _CSS_H
2 #define _CSS_H
3
4 #include <linux/wait.h>
5 #include <linux/workqueue.h>
6
7 #include <asm/cio.h>
8
9 #include "schid.h"
10
11 /*
12  * path grouping stuff
13  */
14 #define SPID_FUNC_SINGLE_PATH      0x00
15 #define SPID_FUNC_MULTI_PATH       0x80
16 #define SPID_FUNC_ESTABLISH        0x00
17 #define SPID_FUNC_RESIGN           0x40
18 #define SPID_FUNC_DISBAND          0x20
19
20 #define SNID_STATE1_RESET          0
21 #define SNID_STATE1_UNGROUPED      2
22 #define SNID_STATE1_GROUPED        3
23
24 #define SNID_STATE2_NOT_RESVD      0
25 #define SNID_STATE2_RESVD_ELSE     2
26 #define SNID_STATE2_RESVD_SELF     3
27
28 #define SNID_STATE3_MULTI_PATH     1
29 #define SNID_STATE3_SINGLE_PATH    0
30
31 struct path_state {
32         __u8  state1 : 2;       /* path state value 1 */
33         __u8  state2 : 2;       /* path state value 2 */
34         __u8  state3 : 1;       /* path state value 3 */
35         __u8  resvd  : 3;       /* reserved */
36 } __attribute__ ((packed));
37
38 struct pgid {
39         union {
40                 __u8 fc;        /* SPID function code */
41                 struct path_state ps;   /* SNID path state */
42         } inf;
43         __u32 cpu_addr  : 16;   /* CPU address */
44         __u32 cpu_id    : 24;   /* CPU identification */
45         __u32 cpu_model : 16;   /* CPU model */
46         __u32 tod_high;         /* high word TOD clock */
47 } __attribute__ ((packed));
48
49 extern struct pgid global_pgid;
50
51 #define MAX_CIWS 8
52
53 /*
54  * sense-id response buffer layout
55  */
56 struct senseid {
57         /* common part */
58         __u8  reserved;         /* always 0x'FF' */
59         __u16 cu_type;          /* control unit type */
60         __u8  cu_model;         /* control unit model */
61         __u16 dev_type;         /* device type */
62         __u8  dev_model;        /* device model */
63         __u8  unused;           /* padding byte */
64         /* extended part */
65         struct ciw ciw[MAX_CIWS];       /* variable # of CIWs */
66 }  __attribute__ ((packed,aligned(4)));
67
68 struct ccw_device_private {
69         int state;              /* device state */
70         atomic_t onoff;
71         unsigned long registered;
72         __u16 devno;            /* device number */
73         __u16 sch_no;           /* subchannel number */
74         __u8 imask;             /* lpm mask for SNID/SID/SPGID */
75         int iretry;             /* retry counter SNID/SID/SPGID */
76         struct {
77                 unsigned int fast:1;    /* post with "channel end" */
78                 unsigned int repall:1;  /* report every interrupt status */
79                 unsigned int pgroup:1;  /* do path grouping */
80                 unsigned int force:1;   /* allow forced online */
81         } __attribute__ ((packed)) options;
82         struct {
83                 unsigned int pgid_single:1; /* use single path for Set PGID */
84                 unsigned int esid:1;        /* Ext. SenseID supported by HW */
85                 unsigned int dosense:1;     /* delayed SENSE required */
86                 unsigned int doverify:1;    /* delayed path verification */
87                 unsigned int donotify:1;    /* call notify function */
88                 unsigned int recog_done:1;  /* dev. recog. complete */
89                 unsigned int fake_irb:1;    /* deliver faked irb */
90         } __attribute__((packed)) flags;
91         unsigned long intparm;  /* user interruption parameter */
92         struct qdio_irq *qdio_data;
93         struct irb irb;         /* device status */
94         struct senseid senseid; /* SenseID info */
95         struct pgid pgid;       /* path group ID */
96         struct ccw1 iccws[2];   /* ccws for SNID/SID/SPGID commands */
97         struct work_struct kick_work;
98         wait_queue_head_t wait_q;
99         struct timer_list timer;
100         void *cmb;                      /* measurement information */
101         struct list_head cmb_list;      /* list of measured devices */
102         u64 cmb_start_time;             /* clock value of cmb reset */
103         void *cmb_wait;                 /* deferred cmb enable/disable */
104 };
105
106 /*
107  * A css driver handles all subchannels of one type.
108  * Currently, we only care about I/O subchannels (type 0), these
109  * have a ccw_device connected to them.
110  */
111 struct css_driver {
112         unsigned int subchannel_type;
113         struct device_driver drv;
114         void (*irq)(struct device *);
115         int (*notify)(struct device *, int);
116         void (*verify)(struct device *);
117         void (*termination)(struct device *);
118 };
119
120 /*
121  * all css_drivers have the css_bus_type
122  */
123 extern struct bus_type css_bus_type;
124 extern struct css_driver io_subchannel_driver;
125
126 extern int css_probe_device(struct subchannel_id);
127 extern struct subchannel * get_subchannel_by_schid(struct subchannel_id);
128 extern int css_init_done;
129
130 #define __MAX_SUBCHANNEL 65535
131
132 extern struct bus_type css_bus_type;
133 extern struct device css_bus_device;
134
135 /* Some helper functions for disconnected state. */
136 int device_is_disconnected(struct subchannel *);
137 void device_set_disconnected(struct subchannel *);
138 void device_trigger_reprobe(struct subchannel *);
139
140 /* Helper functions for vary on/off. */
141 int device_is_online(struct subchannel *);
142 void device_set_waiting(struct subchannel *);
143
144 /* Machine check helper function. */
145 void device_kill_pending_timer(struct subchannel *);
146
147 /* Helper functions to build lists for the slow path. */
148 extern int css_enqueue_subchannel_slow(struct subchannel_id schid);
149 void css_walk_subchannel_slow_list(void (*fn)(unsigned long));
150 void css_clear_subchannel_slow_list(void);
151 int css_slow_subchannels_exist(void);
152 extern int need_rescan;
153
154 extern struct workqueue_struct *slow_path_wq;
155 extern struct work_struct slow_path_work;
156 #endif