Commit | Line | Data |
---|---|---|
f86635fa | 1 | /* |
4dcc2a4d | 2 | * Copyright IBM Corp. 2007, 2012 |
f86635fa PO |
3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> |
4 | */ | |
e5854a58 | 5 | #ifndef _ASM_S390_CHPID_H |
87d2f5e3 | 6 | #define _ASM_S390_CHPID_H |
f86635fa | 7 | |
9807f759 | 8 | #include <uapi/asm/chpid.h> |
626f3117 AB |
9 | #include <asm/cio.h> |
10 | ||
2bf29df7 SO |
11 | struct channel_path_desc { |
12 | u8 flags; | |
13 | u8 lsn; | |
14 | u8 desc; | |
15 | u8 chpid; | |
16 | u8 swla; | |
17 | u8 zeroes; | |
18 | u8 chla; | |
19 | u8 chpp; | |
20 | } __packed; | |
21 | ||
f86635fa PO |
22 | static inline void chp_id_init(struct chp_id *chpid) |
23 | { | |
24 | memset(chpid, 0, sizeof(struct chp_id)); | |
25 | } | |
26 | ||
27 | static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b) | |
28 | { | |
29 | return (a->id == b->id) && (a->cssid == b->cssid); | |
30 | } | |
31 | ||
32 | static inline void chp_id_next(struct chp_id *chpid) | |
33 | { | |
34 | if (chpid->id < __MAX_CHPID) | |
35 | chpid->id++; | |
36 | else { | |
37 | chpid->id = 0; | |
38 | chpid->cssid++; | |
39 | } | |
40 | } | |
41 | ||
42 | static inline int chp_id_is_valid(struct chp_id *chpid) | |
43 | { | |
44 | return (chpid->cssid <= __MAX_CSSID); | |
45 | } | |
46 | ||
47 | ||
48 | #define chp_id_for_each(c) \ | |
49 | for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c)) | |
e5854a58 | 50 | #endif /* _ASM_S390_CHPID_H */ |