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)
19 #define ISM_IDENT_MASK 0x00FFFF
21 #define ISM_REG_SBA 0x1
22 #define ISM_REG_IEQ 0x2
23 #define ISM_READ_GID 0x3
24 #define ISM_ADD_VLAN_ID 0x4
25 #define ISM_DEL_VLAN_ID 0x5
26 #define ISM_SET_VLAN 0x6
27 #define ISM_RESET_VLAN 0x7
28 #define ISM_QUERY_INFO 0x8
29 #define ISM_QUERY_RGID 0x9
30 #define ISM_REG_DMB 0xA
31 #define ISM_UNREG_DMB 0xB
32 #define ISM_SIGNAL_IEQ 0xE
33 #define ISM_UNREG_SBA 0x11
34 #define ISM_UNREG_IEQ 0x12
50 struct ism_req_hdr hdr;
54 struct ism_resp_hdr hdr;
60 struct ism_req_hdr hdr;
65 struct ism_resp_hdr hdr;
71 struct ism_req_hdr hdr;
74 struct ism_resp_hdr hdr;
81 struct ism_req_hdr hdr;
84 struct ism_resp_hdr hdr;
101 union ism_query_rgid {
103 struct ism_req_hdr hdr;
109 struct ism_resp_hdr hdr;
115 struct ism_req_hdr hdr;
124 struct ism_resp_hdr hdr;
131 struct ism_req_hdr hdr;
138 struct ism_resp_hdr hdr;
142 union ism_unreg_dmb {
144 struct ism_req_hdr hdr;
148 struct ism_resp_hdr hdr;
152 union ism_cmd_simple {
154 struct ism_req_hdr hdr;
157 struct ism_resp_hdr hdr;
161 union ism_set_vlan_id {
163 struct ism_req_hdr hdr;
167 struct ism_resp_hdr hdr;
171 struct ism_eq_header {
179 struct ism_eq_header header;
180 struct ism_event entry[15];
184 u32 s : 1; /* summary bit */
185 u32 e : 1; /* event bit */
187 u32 dmb_bits[ISM_NR_DMBS / 32];
189 u16 dmbe_mask[ISM_NR_DMBS];
192 #define ISM_CREATE_REQ(dmb, idx, sf, offset) \
193 ((dmb) | (idx) << 24 | (sf) << 23 | (offset))
195 struct ism_systemeid {
201 static inline void __ism_read_cmd(struct ism_dev *ism, void *data,
202 unsigned long offset, unsigned long len)
204 struct zpci_dev *zdev = to_zpci(ism->pdev);
205 u64 req = ZPCI_CREATE_REQ(zdev->fh, 2, 8);
208 __zpci_load(data, req, offset);
215 static inline void __ism_write_cmd(struct ism_dev *ism, void *data,
216 unsigned long offset, unsigned long len)
218 struct zpci_dev *zdev = to_zpci(ism->pdev);
219 u64 req = ZPCI_CREATE_REQ(zdev->fh, 2, len);
222 __zpci_store_block(data, req, offset);
225 static inline int __ism_move(struct ism_dev *ism, u64 dmb_req, void *data,
228 struct zpci_dev *zdev = to_zpci(ism->pdev);
229 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, size);
231 return __zpci_store_block(data, req, dmb_req);
234 #endif /* S390_ISM_H */