1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/spinlock.h>
6 #include <linux/types.h>
10 #include <asm/pci_insn.h>
12 #define UTIL_STR_LEN 16
15 * Do not use the first word of the DMB bits to ensure 8 byte aligned access.
17 #define ISM_DMB_WORD_OFFSET 1
18 #define ISM_DMB_BIT_OFFSET (ISM_DMB_WORD_OFFSET * 32)
20 #define ISM_REG_SBA 0x1
21 #define ISM_REG_IEQ 0x2
22 #define ISM_READ_GID 0x3
23 #define ISM_ADD_VLAN_ID 0x4
24 #define ISM_DEL_VLAN_ID 0x5
25 #define ISM_SET_VLAN 0x6
26 #define ISM_RESET_VLAN 0x7
27 #define ISM_QUERY_INFO 0x8
28 #define ISM_QUERY_RGID 0x9
29 #define ISM_REG_DMB 0xA
30 #define ISM_UNREG_DMB 0xB
31 #define ISM_SIGNAL_IEQ 0xE
32 #define ISM_UNREG_SBA 0x11
33 #define ISM_UNREG_IEQ 0x12
49 struct ism_req_hdr hdr;
53 struct ism_resp_hdr hdr;
59 struct ism_req_hdr hdr;
64 struct ism_resp_hdr hdr;
70 struct ism_req_hdr hdr;
73 struct ism_resp_hdr hdr;
80 struct ism_req_hdr hdr;
83 struct ism_resp_hdr hdr;
100 union ism_query_rgid {
102 struct ism_req_hdr hdr;
108 struct ism_resp_hdr hdr;
114 struct ism_req_hdr hdr;
123 struct ism_resp_hdr hdr;
130 struct ism_req_hdr hdr;
137 struct ism_resp_hdr hdr;
141 union ism_unreg_dmb {
143 struct ism_req_hdr hdr;
147 struct ism_resp_hdr hdr;
151 union ism_cmd_simple {
153 struct ism_req_hdr hdr;
156 struct ism_resp_hdr hdr;
160 union ism_set_vlan_id {
162 struct ism_req_hdr hdr;
166 struct ism_resp_hdr hdr;
170 struct ism_eq_header {
178 struct ism_eq_header header;
179 struct ism_event entry[15];
183 u32 s : 1; /* summary bit */
184 u32 e : 1; /* event bit */
186 u32 dmb_bits[ISM_NR_DMBS / 32];
188 u16 dmbe_mask[ISM_NR_DMBS];
191 #define ISM_CREATE_REQ(dmb, idx, sf, offset) \
192 ((dmb) | (idx) << 24 | (sf) << 23 | (offset))
194 static inline void __ism_read_cmd(struct ism_dev *ism, void *data,
195 unsigned long offset, unsigned long len)
197 struct zpci_dev *zdev = to_zpci(ism->pdev);
198 u64 req = ZPCI_CREATE_REQ(zdev->fh, 2, 8);
201 __zpci_load(data, req, offset);
208 static inline void __ism_write_cmd(struct ism_dev *ism, void *data,
209 unsigned long offset, unsigned long len)
211 struct zpci_dev *zdev = to_zpci(ism->pdev);
212 u64 req = ZPCI_CREATE_REQ(zdev->fh, 2, len);
215 __zpci_store_block(data, req, offset);
218 static inline int __ism_move(struct ism_dev *ism, u64 dmb_req, void *data,
221 struct zpci_dev *zdev = to_zpci(ism->pdev);
222 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, size);
224 return __zpci_store_block(data, req, dmb_req);
227 #endif /* S390_ISM_H */