2007-04-27 21:01:26 +07:00
|
|
|
/*
|
2012-10-05 15:43:31 +07:00
|
|
|
* Copyright IBM Corp. 2007, 2012
|
2007-04-27 21:01:26 +07:00
|
|
|
* Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
|
|
|
|
*/
|
2007-04-27 21:01:31 +07:00
|
|
|
#ifndef _ASM_S390_CHPID_H
|
2011-12-13 16:26:45 +07:00
|
|
|
#define _ASM_S390_CHPID_H
|
2007-04-27 21:01:26 +07:00
|
|
|
|
2012-10-09 15:47:31 +07:00
|
|
|
#include <uapi/asm/chpid.h>
|
2008-07-17 22:16:42 +07:00
|
|
|
#include <asm/cio.h>
|
|
|
|
|
2007-04-27 21:01:26 +07:00
|
|
|
static inline void chp_id_init(struct chp_id *chpid)
|
|
|
|
{
|
|
|
|
memset(chpid, 0, sizeof(struct chp_id));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
|
|
|
|
{
|
|
|
|
return (a->id == b->id) && (a->cssid == b->cssid);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void chp_id_next(struct chp_id *chpid)
|
|
|
|
{
|
|
|
|
if (chpid->id < __MAX_CHPID)
|
|
|
|
chpid->id++;
|
|
|
|
else {
|
|
|
|
chpid->id = 0;
|
|
|
|
chpid->cssid++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int chp_id_is_valid(struct chp_id *chpid)
|
|
|
|
{
|
|
|
|
return (chpid->cssid <= __MAX_CSSID);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define chp_id_for_each(c) \
|
|
|
|
for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
|
2007-04-27 21:01:31 +07:00
|
|
|
#endif /* _ASM_S390_CHPID_H */
|