1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_PCI_CLP_H
3 #define _ASM_S390_PCI_CLP_H
8 * Call Logical Processor - Command Codes
10 #define CLP_SLPC 0x0001
11 #define CLP_LIST_PCI 0x0002
12 #define CLP_QUERY_PCI_FN 0x0003
13 #define CLP_QUERY_PCI_FNGRP 0x0004
14 #define CLP_SET_PCI_FN 0x0005
16 /* PCI function handle list entry */
17 struct clp_fh_list_entry {
22 u32 fid; /* PCI function id */
23 u32 fh; /* PCI function handle */
26 #define CLP_RC_SETPCIFN_FH 0x0101 /* Invalid PCI fn handle */
27 #define CLP_RC_SETPCIFN_FHOP 0x0102 /* Fn handle not valid for op */
28 #define CLP_RC_SETPCIFN_DMAAS 0x0103 /* Invalid DMA addr space */
29 #define CLP_RC_SETPCIFN_RES 0x0104 /* Insufficient resources */
30 #define CLP_RC_SETPCIFN_ALRDY 0x0105 /* Fn already in requested state */
31 #define CLP_RC_SETPCIFN_ERR 0x0106 /* Fn in permanent error state */
32 #define CLP_RC_SETPCIFN_RECPND 0x0107 /* Error recovery pending */
33 #define CLP_RC_SETPCIFN_BUSY 0x0108 /* Fn busy */
34 #define CLP_RC_LISTPCI_BADRT 0x010a /* Resume token not recognized */
35 #define CLP_RC_QUERYPCIFG_PFGID 0x010b /* Unrecognized PFGID */
37 /* request or response block header length */
38 #define LIST_PCI_HDR_LEN 32
40 /* Number of function handles fitting in response block */
41 #define CLP_FH_LIST_NR_ENTRIES \
42 ((CLP_BLK_SIZE - 2 * LIST_PCI_HDR_LEN) \
43 / sizeof(struct clp_fh_list_entry))
45 #define CLP_SET_ENABLE_PCI_FN 0 /* Yes, 0 enables it */
46 #define CLP_SET_DISABLE_PCI_FN 1 /* Yes, 1 disables it */
47 #define CLP_SET_ENABLE_MIO 2
48 #define CLP_SET_DISABLE_MIO 3
50 #define CLP_UTIL_STR_LEN 64
51 #define CLP_PFIP_NR_SEGMENTS 4
53 /* PCI function type numbers */
54 #define PCI_FUNC_TYPE_ISM 0x5 /* ISM device */
56 extern bool zpci_unique_uid;
58 struct clp_rsp_slpc_pci {
59 struct clp_rsp_hdr hdr;
71 /* List PCI functions request */
72 struct clp_req_list_pci {
73 struct clp_req_hdr hdr;
78 /* List PCI functions response */
79 struct clp_rsp_list_pci {
80 struct clp_rsp_hdr hdr;
87 struct clp_fh_list_entry fh_list[CLP_FH_LIST_NR_ENTRIES];
97 } addr[PCI_STD_NUM_BARS];
101 /* Query PCI function request */
102 struct clp_req_query_pci {
103 struct clp_req_hdr hdr;
104 u32 fh; /* function handle */
109 /* Query PCI function response */
110 struct clp_rsp_query_pci {
111 struct clp_rsp_hdr hdr;
112 u16 vfn; /* virtual fn number */
118 u16 mio_addr_avail : 1;
119 u16 util_str_avail : 1; /* utility string available? */
120 u16 pfgid : 8; /* pci function group id */
121 u32 fid; /* pci function id */
122 u8 bar_size[PCI_STD_NUM_BARS];
124 __le32 bar[PCI_STD_NUM_BARS];
125 u8 pfip[CLP_PFIP_NR_SEGMENTS]; /* pci function internal path */
130 u8 pft; /* pci function type */
131 u64 sdma; /* start dma as */
132 u64 edma; /* end dma as */
133 #define ZPCI_RID_MASK_DEVFN 0x00ff
134 u16 rid; /* BUS/DEVFN PCI address */
138 u32 uid; /* user defined id */
139 u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */
144 /* Query PCI function group request */
145 struct clp_req_query_pci_grp {
146 struct clp_req_hdr hdr;
148 u32 pfgid : 8; /* function group id */
153 /* Query PCI function group response */
154 struct clp_rsp_query_pci_grp {
155 struct clp_rsp_hdr hdr;
157 u16 noi : 12; /* number of interrupts */
161 u8 refresh : 1; /* TLB refresh mode */
163 u16 maxstbl : 13; /* Maximum store block size */
165 u8 dtsm; /* Supported DT mask */
171 u64 dasm; /* dma address space mask */
172 u64 msia; /* MSI address */
177 /* Set PCI function request */
178 struct clp_req_set_pci {
179 struct clp_req_hdr hdr;
180 u32 fh; /* function handle */
182 u8 oc; /* operation controls */
183 u8 ndas; /* number of dma spaces */
185 u32 gisa; /* GISA designation */
188 /* Set PCI function response */
189 struct clp_rsp_set_pci {
190 struct clp_rsp_hdr hdr;
191 u32 fh; /* function handle */
197 /* Combined request/response block structures used by clp insn */
198 struct clp_req_rsp_slpc_pci {
199 struct clp_req_slpc request;
200 struct clp_rsp_slpc_pci response;
203 struct clp_req_rsp_list_pci {
204 struct clp_req_list_pci request;
205 struct clp_rsp_list_pci response;
208 struct clp_req_rsp_set_pci {
209 struct clp_req_set_pci request;
210 struct clp_rsp_set_pci response;
213 struct clp_req_rsp_query_pci {
214 struct clp_req_query_pci request;
215 struct clp_rsp_query_pci response;
218 struct clp_req_rsp_query_pci_grp {
219 struct clp_req_query_pci_grp request;
220 struct clp_rsp_query_pci_grp response;