Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_S390_PCI_INSN_H
0003 #define _ASM_S390_PCI_INSN_H
0004 
0005 #include <linux/jump_label.h>
0006 
0007 /* Load/Store status codes */
0008 #define ZPCI_PCI_ST_FUNC_NOT_ENABLED        4
0009 #define ZPCI_PCI_ST_FUNC_IN_ERR         8
0010 #define ZPCI_PCI_ST_BLOCKED         12
0011 #define ZPCI_PCI_ST_INSUF_RES           16
0012 #define ZPCI_PCI_ST_INVAL_AS            20
0013 #define ZPCI_PCI_ST_FUNC_ALREADY_ENABLED    24
0014 #define ZPCI_PCI_ST_DMA_AS_NOT_ENABLED      28
0015 #define ZPCI_PCI_ST_2ND_OP_IN_INV_AS        36
0016 #define ZPCI_PCI_ST_FUNC_NOT_AVAIL      40
0017 #define ZPCI_PCI_ST_ALREADY_IN_RQ_STATE     44
0018 
0019 /* Load/Store return codes */
0020 #define ZPCI_PCI_LS_OK              0
0021 #define ZPCI_PCI_LS_ERR             1
0022 #define ZPCI_PCI_LS_BUSY            2
0023 #define ZPCI_PCI_LS_INVAL_HANDLE        3
0024 
0025 /* Load/Store address space identifiers */
0026 #define ZPCI_PCIAS_MEMIO_0          0
0027 #define ZPCI_PCIAS_MEMIO_1          1
0028 #define ZPCI_PCIAS_MEMIO_2          2
0029 #define ZPCI_PCIAS_MEMIO_3          3
0030 #define ZPCI_PCIAS_MEMIO_4          4
0031 #define ZPCI_PCIAS_MEMIO_5          5
0032 #define ZPCI_PCIAS_CFGSPC           15
0033 
0034 /* Modify PCI Function Controls */
0035 #define ZPCI_MOD_FC_REG_INT 2
0036 #define ZPCI_MOD_FC_DEREG_INT   3
0037 #define ZPCI_MOD_FC_REG_IOAT    4
0038 #define ZPCI_MOD_FC_DEREG_IOAT  5
0039 #define ZPCI_MOD_FC_REREG_IOAT  6
0040 #define ZPCI_MOD_FC_RESET_ERROR 7
0041 #define ZPCI_MOD_FC_RESET_BLOCK 9
0042 #define ZPCI_MOD_FC_SET_MEASURE 10
0043 #define ZPCI_MOD_FC_REG_INT_D   16
0044 #define ZPCI_MOD_FC_DEREG_INT_D 17
0045 
0046 /* FIB function controls */
0047 #define ZPCI_FIB_FC_ENABLED 0x80
0048 #define ZPCI_FIB_FC_ERROR   0x40
0049 #define ZPCI_FIB_FC_LS_BLOCKED  0x20
0050 #define ZPCI_FIB_FC_DMAAS_REG   0x10
0051 
0052 /* FIB function controls */
0053 #define ZPCI_FIB_FC_ENABLED 0x80
0054 #define ZPCI_FIB_FC_ERROR   0x40
0055 #define ZPCI_FIB_FC_LS_BLOCKED  0x20
0056 #define ZPCI_FIB_FC_DMAAS_REG   0x10
0057 
0058 struct zpci_fib_fmt0 {
0059     u32     :  1;
0060     u32 isc     :  3;   /* Interrupt subclass */
0061     u32 noi     : 12;   /* Number of interrupts */
0062     u32     :  2;
0063     u32 aibvo   :  6;   /* Adapter interrupt bit vector offset */
0064     u32 sum     :  1;   /* Adapter int summary bit enabled */
0065     u32     :  1;
0066     u32 aisbo   :  6;   /* Adapter int summary bit offset */
0067     u32     : 32;
0068     u64 aibv;       /* Adapter int bit vector address */
0069     u64 aisb;       /* Adapter int summary bit address */
0070 };
0071 
0072 struct zpci_fib_fmt1 {
0073     u32     :  4;
0074     u32 noi     : 12;
0075     u32     : 16;
0076     u32 dibvo   : 16;
0077     u32     : 16;
0078     u64     : 64;
0079     u64     : 64;
0080 };
0081 
0082 /* Function Information Block */
0083 struct zpci_fib {
0084     u32 fmt     :  8;   /* format */
0085     u32     : 24;
0086     u32     : 32;
0087     u8 fc;          /* function controls */
0088     u64     : 56;
0089     u64 pba;        /* PCI base address */
0090     u64 pal;        /* PCI address limit */
0091     u64 iota;       /* I/O Translation Anchor */
0092     union {
0093         struct zpci_fib_fmt0 fmt0;
0094         struct zpci_fib_fmt1 fmt1;
0095     };
0096     u64 fmb_addr;       /* Function measurement block address and key */
0097     u32     : 32;
0098     u32 gd;
0099 } __packed __aligned(8);
0100 
0101 /* Set Interruption Controls Operation Controls  */
0102 #define SIC_IRQ_MODE_ALL        0
0103 #define SIC_IRQ_MODE_SINGLE     1
0104 #define SIC_SET_AENI_CONTROLS       2
0105 #define SIC_IRQ_MODE_DIRECT     4
0106 #define SIC_IRQ_MODE_D_ALL      16
0107 #define SIC_IRQ_MODE_D_SINGLE       17
0108 #define SIC_IRQ_MODE_SET_CPU        18
0109 
0110 /* directed interruption information block */
0111 struct zpci_diib {
0112     u32 : 1;
0113     u32 isc : 3;
0114     u32 : 28;
0115     u16 : 16;
0116     u16 nr_cpus;
0117     u64 disb_addr;
0118     u64 : 64;
0119     u64 : 64;
0120 } __packed __aligned(8);
0121 
0122 /* cpu directed interruption information block */
0123 struct zpci_cdiib {
0124     u64 : 64;
0125     u64 dibv_addr;
0126     u64 : 64;
0127     u64 : 64;
0128     u64 : 64;
0129 } __packed __aligned(8);
0130 
0131 /* adapter interruption parameters block */
0132 struct zpci_aipb {
0133     u64 faisb;
0134     u64 gait;
0135     u16 : 13;
0136     u16 afi : 3;
0137     u32 : 32;
0138     u16 faal;
0139 } __packed __aligned(8);
0140 
0141 union zpci_sic_iib {
0142     struct zpci_diib diib;
0143     struct zpci_cdiib cdiib;
0144     struct zpci_aipb aipb;
0145 };
0146 
0147 DECLARE_STATIC_KEY_FALSE(have_mio);
0148 
0149 u8 zpci_mod_fc(u64 req, struct zpci_fib *fib, u8 *status);
0150 int zpci_refresh_trans(u64 fn, u64 addr, u64 range);
0151 int __zpci_load(u64 *data, u64 req, u64 offset);
0152 int zpci_load(u64 *data, const volatile void __iomem *addr, unsigned long len);
0153 int __zpci_store(u64 data, u64 req, u64 offset);
0154 int zpci_store(const volatile void __iomem *addr, u64 data, unsigned long len);
0155 int __zpci_store_block(const u64 *data, u64 req, u64 offset);
0156 void zpci_barrier(void);
0157 int zpci_set_irq_ctrl(u16 ctl, u8 isc, union zpci_sic_iib *iib);
0158 
0159 #endif