0001
0002
0003
0004
0005
0006 #ifndef _ASM_S390_CHPID_H
0007 #define _ASM_S390_CHPID_H
0008
0009 #include <uapi/asm/chpid.h>
0010 #include <asm/cio.h>
0011
0012 struct channel_path_desc_fmt0 {
0013 u8 flags;
0014 u8 lsn;
0015 u8 desc;
0016 u8 chpid;
0017 u8 swla;
0018 u8 zeroes;
0019 u8 chla;
0020 u8 chpp;
0021 } __packed;
0022
0023 static inline void chp_id_init(struct chp_id *chpid)
0024 {
0025 memset(chpid, 0, sizeof(struct chp_id));
0026 }
0027
0028 static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
0029 {
0030 return (a->id == b->id) && (a->cssid == b->cssid);
0031 }
0032
0033 static inline void chp_id_next(struct chp_id *chpid)
0034 {
0035 if (chpid->id < __MAX_CHPID)
0036 chpid->id++;
0037 else {
0038 chpid->id = 0;
0039 chpid->cssid++;
0040 }
0041 }
0042
0043 static inline int chp_id_is_valid(struct chp_id *chpid)
0044 {
0045 return (chpid->cssid <= __MAX_CSSID);
0046 }
0047
0048
0049 #define chp_id_for_each(c) \
0050 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
0051 #endif