1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_PCI_INSN_H
3 #define _ASM_S390_PCI_INSN_H
5 #include <linux/jump_label.h>
7 /* Load/Store status codes */
8 #define ZPCI_PCI_ST_FUNC_NOT_ENABLED 4
9 #define ZPCI_PCI_ST_FUNC_IN_ERR 8
10 #define ZPCI_PCI_ST_BLOCKED 12
11 #define ZPCI_PCI_ST_INSUF_RES 16
12 #define ZPCI_PCI_ST_INVAL_AS 20
13 #define ZPCI_PCI_ST_FUNC_ALREADY_ENABLED 24
14 #define ZPCI_PCI_ST_DMA_AS_NOT_ENABLED 28
15 #define ZPCI_PCI_ST_2ND_OP_IN_INV_AS 36
16 #define ZPCI_PCI_ST_FUNC_NOT_AVAIL 40
17 #define ZPCI_PCI_ST_ALREADY_IN_RQ_STATE 44
19 /* Load/Store return codes */
20 #define ZPCI_PCI_LS_OK 0
21 #define ZPCI_PCI_LS_ERR 1
22 #define ZPCI_PCI_LS_BUSY 2
23 #define ZPCI_PCI_LS_INVAL_HANDLE 3
25 /* Load/Store address space identifiers */
26 #define ZPCI_PCIAS_MEMIO_0 0
27 #define ZPCI_PCIAS_MEMIO_1 1
28 #define ZPCI_PCIAS_MEMIO_2 2
29 #define ZPCI_PCIAS_MEMIO_3 3
30 #define ZPCI_PCIAS_MEMIO_4 4
31 #define ZPCI_PCIAS_MEMIO_5 5
32 #define ZPCI_PCIAS_CFGSPC 15
34 /* Modify PCI Function Controls */
35 #define ZPCI_MOD_FC_REG_INT 2
36 #define ZPCI_MOD_FC_DEREG_INT 3
37 #define ZPCI_MOD_FC_REG_IOAT 4
38 #define ZPCI_MOD_FC_DEREG_IOAT 5
39 #define ZPCI_MOD_FC_REREG_IOAT 6
40 #define ZPCI_MOD_FC_RESET_ERROR 7
41 #define ZPCI_MOD_FC_RESET_BLOCK 9
42 #define ZPCI_MOD_FC_SET_MEASURE 10
43 #define ZPCI_MOD_FC_REG_INT_D 16
44 #define ZPCI_MOD_FC_DEREG_INT_D 17
46 /* FIB function controls */
47 #define ZPCI_FIB_FC_ENABLED 0x80
48 #define ZPCI_FIB_FC_ERROR 0x40
49 #define ZPCI_FIB_FC_LS_BLOCKED 0x20
50 #define ZPCI_FIB_FC_DMAAS_REG 0x10
52 /* FIB function controls */
53 #define ZPCI_FIB_FC_ENABLED 0x80
54 #define ZPCI_FIB_FC_ERROR 0x40
55 #define ZPCI_FIB_FC_LS_BLOCKED 0x20
56 #define ZPCI_FIB_FC_DMAAS_REG 0x10
58 struct zpci_fib_fmt0
{
60 u32 isc
: 3; /* Interrupt subclass */
61 u32 noi
: 12; /* Number of interrupts */
63 u32 aibvo
: 6; /* Adapter interrupt bit vector offset */
64 u32 sum
: 1; /* Adapter int summary bit enabled */
66 u32 aisbo
: 6; /* Adapter int summary bit offset */
68 u64 aibv
; /* Adapter int bit vector address */
69 u64 aisb
; /* Adapter int summary bit address */
72 struct zpci_fib_fmt1
{
82 /* Function Information Block */
84 u32 fmt
: 8; /* format */
87 u8 fc
; /* function controls */
89 u64 pba
; /* PCI base address */
90 u64 pal
; /* PCI address limit */
91 u64 iota
; /* I/O Translation Anchor */
93 struct zpci_fib_fmt0 fmt0
;
94 struct zpci_fib_fmt1 fmt1
;
96 u64 fmb_addr
; /* Function measurement block address and key */
99 } __packed
__aligned(8);
101 /* directed interruption information block */
111 } __packed
__aligned(8);
113 /* cpu directed interruption information block */
120 } __packed
__aligned(8);
123 struct zpci_diib diib
;
124 struct zpci_cdiib cdiib
;
127 DECLARE_STATIC_KEY_FALSE(have_mio
);
129 u8
zpci_mod_fc(u64 req
, struct zpci_fib
*fib
, u8
*status
);
130 int zpci_refresh_trans(u64 fn
, u64 addr
, u64 range
);
131 int __zpci_load(u64
*data
, u64 req
, u64 offset
);
132 int zpci_load(u64
*data
, const volatile void __iomem
*addr
, unsigned long len
);
133 int __zpci_store(u64 data
, u64 req
, u64 offset
);
134 int zpci_store(const volatile void __iomem
*addr
, u64 data
, unsigned long len
);
135 int __zpci_store_block(const u64
*data
, u64 req
, u64 offset
);
136 void zpci_barrier(void);
137 int __zpci_set_irq_ctrl(u16 ctl
, u8 isc
, union zpci_sic_iib
*iib
);
139 static inline int zpci_set_irq_ctrl(u16 ctl
, u8 isc
)
141 union zpci_sic_iib iib
= {{0}};
143 return __zpci_set_irq_ctrl(ctl
, isc
, &iib
);