Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 9 | #include "schid.h" |
| 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 73 | __u16 sch_no; /* subchannel number */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 126 | extern int css_probe_device(struct subchannel_id); |
| 127 | extern struct subchannel * get_subchannel_by_schid(struct subchannel_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | extern int css_init_done; |
Cornelia Huck | f97a56f | 2006-01-06 00:19:22 -0800 | [diff] [blame^] | 129 | extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 131 | #define __MAX_SUBCHANNEL 65535 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | |
| 133 | extern struct bus_type css_bus_type; |
| 134 | extern struct device css_bus_device; |
| 135 | |
| 136 | /* Some helper functions for disconnected state. */ |
| 137 | int device_is_disconnected(struct subchannel *); |
| 138 | void device_set_disconnected(struct subchannel *); |
| 139 | void device_trigger_reprobe(struct subchannel *); |
| 140 | |
| 141 | /* Helper functions for vary on/off. */ |
| 142 | int device_is_online(struct subchannel *); |
| 143 | void device_set_waiting(struct subchannel *); |
| 144 | |
| 145 | /* Machine check helper function. */ |
| 146 | void device_kill_pending_timer(struct subchannel *); |
| 147 | |
| 148 | /* Helper functions to build lists for the slow path. */ |
Cornelia Huck | a8237fc | 2006-01-06 00:19:21 -0800 | [diff] [blame] | 149 | extern int css_enqueue_subchannel_slow(struct subchannel_id schid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | void css_walk_subchannel_slow_list(void (*fn)(unsigned long)); |
| 151 | void css_clear_subchannel_slow_list(void); |
| 152 | int css_slow_subchannels_exist(void); |
| 153 | extern int need_rescan; |
| 154 | |
| 155 | extern struct workqueue_struct *slow_path_wq; |
| 156 | extern struct work_struct slow_path_work; |
| 157 | #endif |