diff options
author | Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 2007-04-27 10:01:26 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-04-27 10:01:38 -0400 |
commit | f86635fad14c4a6810cf0e08488fc9129a3b3b32 (patch) | |
tree | abd431344a28415983f6dcabdc3ac3ce5675e519 /drivers/s390/cio/chpid.h | |
parent | 6fc321fd7dd91f0592f37503219196835314fbb7 (diff) |
[S390] cio: Introduce struct chp_id.
Introduce data type for channel-path IDs.
Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/chpid.h')
-rw-r--r-- | drivers/s390/cio/chpid.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/s390/cio/chpid.h b/drivers/s390/cio/chpid.h new file mode 100644 index 000000000000..44cc00ed9b59 --- /dev/null +++ b/drivers/s390/cio/chpid.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * drivers/s390/cio/chpid.h | ||
3 | * | ||
4 | * Copyright IBM Corp. 2007 | ||
5 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | ||
6 | */ | ||
7 | |||
8 | #ifndef S390_CHP_ID_H | ||
9 | #define S390_CHP_ID_H S390_CHP_ID_H | ||
10 | |||
11 | #include <linux/string.h> | ||
12 | #include <asm/types.h> | ||
13 | #include "css.h" | ||
14 | |||
15 | struct chp_id { | ||
16 | u8 reserved1; | ||
17 | u8 cssid; | ||
18 | u8 reserved2; | ||
19 | u8 id; | ||
20 | } __attribute__((packed)); | ||
21 | |||
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)) | ||
50 | |||
51 | #endif /* S390_CHP_ID_H */ | ||