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