0001
0002
0003
0004
0005
0006
0007 #ifndef S390_CHP_H
0008 #define S390_CHP_H
0009
0010 #include <linux/types.h>
0011 #include <linux/device.h>
0012 #include <linux/mutex.h>
0013 #include <asm/chpid.h>
0014 #include "chsc.h"
0015 #include "css.h"
0016
0017 #define CHP_STATUS_STANDBY 0
0018 #define CHP_STATUS_CONFIGURED 1
0019 #define CHP_STATUS_RESERVED 2
0020 #define CHP_STATUS_NOT_RECOGNIZED 3
0021
0022 #define CHP_ONLINE 0
0023 #define CHP_OFFLINE 1
0024 #define CHP_VARY_ON 2
0025 #define CHP_VARY_OFF 3
0026 #define CHP_FCES_EVENT 4
0027
0028 struct chp_link {
0029 struct chp_id chpid;
0030 u32 fla_mask;
0031 u16 fla;
0032 };
0033
0034 static inline int chp_test_bit(u8 *bitmap, int num)
0035 {
0036 int byte = num >> 3;
0037 int mask = 128 >> (num & 7);
0038
0039 return (bitmap[byte] & mask) ? 1 : 0;
0040 }
0041
0042
0043 struct channel_path {
0044 struct device dev;
0045 struct chp_id chpid;
0046 struct mutex lock;
0047 int state;
0048 struct channel_path_desc_fmt0 desc;
0049 struct channel_path_desc_fmt1 desc_fmt1;
0050 struct channel_path_desc_fmt3 desc_fmt3;
0051
0052 int cmg;
0053 int shared;
0054 struct cmg_chars cmg_chars;
0055 };
0056
0057
0058 static inline struct channel_path *chpid_to_chp(struct chp_id chpid)
0059 {
0060 return css_by_id(chpid.cssid)->chps[chpid.id];
0061 }
0062
0063 int chp_get_status(struct chp_id chpid);
0064 u8 chp_get_sch_opm(struct subchannel *sch);
0065 int chp_is_registered(struct chp_id chpid);
0066 struct channel_path_desc_fmt0 *chp_get_chp_desc(struct chp_id chpid);
0067 void chp_remove_cmg_attr(struct channel_path *chp);
0068 int chp_add_cmg_attr(struct channel_path *chp);
0069 int chp_update_desc(struct channel_path *chp);
0070 int chp_new(struct chp_id chpid);
0071 void chp_cfg_schedule(struct chp_id chpid, int configure);
0072 void chp_cfg_cancel_deconfigure(struct chp_id chpid);
0073 int chp_info_get_status(struct chp_id chpid);
0074 int chp_ssd_get_mask(struct chsc_ssd_info *, struct chp_link *);
0075 #endif