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