ACPI: thinkpad-acpi: update CMOS commands documentation
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-s390 / chpid.h
blobb203336fd892596b7422a8506bb822044574dda7
1 /*
2 * drivers/s390/cio/chpid.h
4 * Copyright IBM Corp. 2007
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
8 #ifndef _ASM_S390_CHPID_H
9 #define _ASM_S390_CHPID_H _ASM_S390_CHPID_H
11 #include <linux/string.h>
12 #include <asm/types.h>
13 #include <asm/cio.h>
15 #define __MAX_CHPID 255
17 struct chp_id {
18 u8 reserved1;
19 u8 cssid;
20 u8 reserved2;
21 u8 id;
22 } __attribute__((packed));
24 static inline void chp_id_init(struct chp_id *chpid)
26 memset(chpid, 0, sizeof(struct chp_id));
29 static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
31 return (a->id == b->id) && (a->cssid == b->cssid);
34 static inline void chp_id_next(struct chp_id *chpid)
36 if (chpid->id < __MAX_CHPID)
37 chpid->id++;
38 else {
39 chpid->id = 0;
40 chpid->cssid++;
44 static inline int chp_id_is_valid(struct chp_id *chpid)
46 return (chpid->cssid <= __MAX_CSSID);
50 #define chp_id_for_each(c) \
51 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
53 #endif /* _ASM_S390_CHPID_H */