1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/spinlock.h>
6 #include <linux/types.h>
9 #include <asm/pci_insn.h>
11 #define UTIL_STR_LEN 16
14 * Do not use the first word of the DMB bits to ensure 8 byte aligned access.
16 #define ISM_DMB_WORD_OFFSET 1
17 #define ISM_DMB_BIT_OFFSET (ISM_DMB_WORD_OFFSET * 32)
18 #define ISM_NR_DMBS 1920
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 smcd_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
];
193 struct pci_dev
*pdev
;
194 struct smcd_dev
*smcd
;
197 dma_addr_t sba_dma_addr
;
198 DECLARE_BITMAP(sba_bitmap
, ISM_NR_DMBS
);
201 dma_addr_t ieq_dma_addr
;
206 #define ISM_CREATE_REQ(dmb, idx, sf, offset) \
207 ((dmb) | (idx) << 24 | (sf) << 23 | (offset))
209 static inline void __ism_read_cmd(struct ism_dev
*ism
, void *data
,
210 unsigned long offset
, unsigned long len
)
212 struct zpci_dev
*zdev
= to_zpci(ism
->pdev
);
213 u64 req
= ZPCI_CREATE_REQ(zdev
->fh
, 2, 8);
216 __zpci_load(data
, req
, offset
);
223 static inline void __ism_write_cmd(struct ism_dev
*ism
, void *data
,
224 unsigned long offset
, unsigned long len
)
226 struct zpci_dev
*zdev
= to_zpci(ism
->pdev
);
227 u64 req
= ZPCI_CREATE_REQ(zdev
->fh
, 2, len
);
230 __zpci_store_block(data
, req
, offset
);
233 static inline int __ism_move(struct ism_dev
*ism
, u64 dmb_req
, void *data
,
236 struct zpci_dev
*zdev
= to_zpci(ism
->pdev
);
237 u64 req
= ZPCI_CREATE_REQ(zdev
->fh
, 0, size
);
239 return __zpci_store_block(data
, req
, dmb_req
);
242 #endif /* S390_ISM_H */