0001
0002 #ifndef _CSS_H
0003 #define _CSS_H
0004
0005 #include <linux/mutex.h>
0006 #include <linux/wait.h>
0007 #include <linux/workqueue.h>
0008 #include <linux/device.h>
0009 #include <linux/types.h>
0010
0011 #include <asm/cio.h>
0012 #include <asm/chpid.h>
0013 #include <asm/schid.h>
0014
0015 #include "cio.h"
0016
0017
0018
0019
0020 #define SPID_FUNC_SINGLE_PATH 0x00
0021 #define SPID_FUNC_MULTI_PATH 0x80
0022 #define SPID_FUNC_ESTABLISH 0x00
0023 #define SPID_FUNC_RESIGN 0x40
0024 #define SPID_FUNC_DISBAND 0x20
0025
0026 #define SNID_STATE1_RESET 0
0027 #define SNID_STATE1_UNGROUPED 2
0028 #define SNID_STATE1_GROUPED 3
0029
0030 #define SNID_STATE2_NOT_RESVD 0
0031 #define SNID_STATE2_RESVD_ELSE 2
0032 #define SNID_STATE2_RESVD_SELF 3
0033
0034 #define SNID_STATE3_MULTI_PATH 1
0035 #define SNID_STATE3_SINGLE_PATH 0
0036
0037
0038
0039
0040 enum css_eval_cond {
0041 CSS_EVAL_UNREG,
0042 CSS_EVAL_NOT_ONLINE
0043 };
0044
0045 struct path_state {
0046 __u8 state1 : 2;
0047 __u8 state2 : 2;
0048 __u8 state3 : 1;
0049 __u8 resvd : 3;
0050 } __attribute__ ((packed));
0051
0052 struct extended_cssid {
0053 u8 version;
0054 u8 cssid;
0055 } __attribute__ ((packed));
0056
0057 struct pgid {
0058 union {
0059 __u8 fc;
0060 struct path_state ps;
0061 } __attribute__ ((packed)) inf;
0062 union {
0063 __u32 cpu_addr : 16;
0064 struct extended_cssid ext_cssid;
0065 } __attribute__ ((packed)) pgid_high;
0066 __u32 cpu_id : 24;
0067 __u32 cpu_model : 16;
0068 __u32 tod_high;
0069 } __attribute__ ((packed));
0070
0071 struct subchannel;
0072 struct chp_link;
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 struct css_driver {
0086 struct css_device_id *subchannel_type;
0087 struct device_driver drv;
0088 void (*irq)(struct subchannel *);
0089 int (*chp_event)(struct subchannel *, struct chp_link *, int);
0090 int (*sch_event)(struct subchannel *, int);
0091 int (*probe)(struct subchannel *);
0092 void (*remove)(struct subchannel *);
0093 void (*shutdown)(struct subchannel *);
0094 int (*settle)(void);
0095 };
0096
0097 #define to_cssdriver(n) container_of(n, struct css_driver, drv)
0098
0099 extern int css_driver_register(struct css_driver *);
0100 extern void css_driver_unregister(struct css_driver *);
0101
0102 extern void css_sch_device_unregister(struct subchannel *);
0103 extern int css_register_subchannel(struct subchannel *);
0104 extern struct subchannel *css_alloc_subchannel(struct subchannel_id,
0105 struct schib *schib);
0106 extern struct subchannel *get_subchannel_by_schid(struct subchannel_id);
0107 extern int css_init_done;
0108 extern int max_ssid;
0109 int for_each_subchannel_staged(int (*fn_known)(struct subchannel *, void *),
0110 int (*fn_unknown)(struct subchannel_id,
0111 void *), void *data);
0112 extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *);
0113 void css_update_ssd_info(struct subchannel *sch);
0114
0115 struct channel_subsystem {
0116 u8 cssid;
0117 u8 iid;
0118 bool id_valid;
0119 struct channel_path *chps[__MAX_CHPID + 1];
0120 struct device device;
0121 struct pgid global_pgid;
0122 struct mutex mutex;
0123
0124 int cm_enabled;
0125 void *cub_addr1;
0126 void *cub_addr2;
0127
0128 struct subchannel *pseudo_subchannel;
0129 };
0130 #define to_css(dev) container_of(dev, struct channel_subsystem, device)
0131
0132 extern struct channel_subsystem *channel_subsystems[];
0133
0134
0135 static inline struct channel_subsystem *css_by_id(u8 cssid)
0136 {
0137 return channel_subsystems[0];
0138 }
0139
0140
0141 #define for_each_css(css) \
0142 for ((css) = channel_subsystems[0]; (css); (css) = NULL)
0143
0144
0145 void css_schedule_eval(struct subchannel_id schid);
0146 void css_schedule_eval_all(void);
0147 void css_schedule_eval_cond(enum css_eval_cond, unsigned long delay);
0148 int css_complete_work(void);
0149
0150 int sch_is_pseudo_sch(struct subchannel *);
0151 struct schib;
0152 int css_sch_is_valid(struct schib *);
0153
0154 extern struct workqueue_struct *cio_work_q;
0155 void css_wait_for_slow_path(void);
0156 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo);
0157 #endif