pci_insn.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_S390_PCI_INSN_H
  3. #define _ASM_S390_PCI_INSN_H
  4. #include <linux/jump_label.h>
  5. /* Load/Store status codes */
  6. #define ZPCI_PCI_ST_FUNC_NOT_ENABLED 4
  7. #define ZPCI_PCI_ST_FUNC_IN_ERR 8
  8. #define ZPCI_PCI_ST_BLOCKED 12
  9. #define ZPCI_PCI_ST_INSUF_RES 16
  10. #define ZPCI_PCI_ST_INVAL_AS 20
  11. #define ZPCI_PCI_ST_FUNC_ALREADY_ENABLED 24
  12. #define ZPCI_PCI_ST_DMA_AS_NOT_ENABLED 28
  13. #define ZPCI_PCI_ST_2ND_OP_IN_INV_AS 36
  14. #define ZPCI_PCI_ST_FUNC_NOT_AVAIL 40
  15. #define ZPCI_PCI_ST_ALREADY_IN_RQ_STATE 44
  16. /* Load/Store return codes */
  17. #define ZPCI_PCI_LS_OK 0
  18. #define ZPCI_PCI_LS_ERR 1
  19. #define ZPCI_PCI_LS_BUSY 2
  20. #define ZPCI_PCI_LS_INVAL_HANDLE 3
  21. /* Load/Store address space identifiers */
  22. #define ZPCI_PCIAS_MEMIO_0 0
  23. #define ZPCI_PCIAS_MEMIO_1 1
  24. #define ZPCI_PCIAS_MEMIO_2 2
  25. #define ZPCI_PCIAS_MEMIO_3 3
  26. #define ZPCI_PCIAS_MEMIO_4 4
  27. #define ZPCI_PCIAS_MEMIO_5 5
  28. #define ZPCI_PCIAS_CFGSPC 15
  29. /* Modify PCI Function Controls */
  30. #define ZPCI_MOD_FC_REG_INT 2
  31. #define ZPCI_MOD_FC_DEREG_INT 3
  32. #define ZPCI_MOD_FC_REG_IOAT 4
  33. #define ZPCI_MOD_FC_DEREG_IOAT 5
  34. #define ZPCI_MOD_FC_REREG_IOAT 6
  35. #define ZPCI_MOD_FC_RESET_ERROR 7
  36. #define ZPCI_MOD_FC_RESET_BLOCK 9
  37. #define ZPCI_MOD_FC_SET_MEASURE 10
  38. #define ZPCI_MOD_FC_REG_INT_D 16
  39. #define ZPCI_MOD_FC_DEREG_INT_D 17
  40. /* FIB function controls */
  41. #define ZPCI_FIB_FC_ENABLED 0x80
  42. #define ZPCI_FIB_FC_ERROR 0x40
  43. #define ZPCI_FIB_FC_LS_BLOCKED 0x20
  44. #define ZPCI_FIB_FC_DMAAS_REG 0x10
  45. /* FIB function controls */
  46. #define ZPCI_FIB_FC_ENABLED 0x80
  47. #define ZPCI_FIB_FC_ERROR 0x40
  48. #define ZPCI_FIB_FC_LS_BLOCKED 0x20
  49. #define ZPCI_FIB_FC_DMAAS_REG 0x10
  50. struct zpci_fib_fmt0 {
  51. u32 : 1;
  52. u32 isc : 3; /* Interrupt subclass */
  53. u32 noi : 12; /* Number of interrupts */
  54. u32 : 2;
  55. u32 aibvo : 6; /* Adapter interrupt bit vector offset */
  56. u32 sum : 1; /* Adapter int summary bit enabled */
  57. u32 : 1;
  58. u32 aisbo : 6; /* Adapter int summary bit offset */
  59. u32 : 32;
  60. u64 aibv; /* Adapter int bit vector address */
  61. u64 aisb; /* Adapter int summary bit address */
  62. };
  63. struct zpci_fib_fmt1 {
  64. u32 : 4;
  65. u32 noi : 12;
  66. u32 : 16;
  67. u32 dibvo : 16;
  68. u32 : 16;
  69. u64 : 64;
  70. u64 : 64;
  71. };
  72. /* Function Information Block */
  73. struct zpci_fib {
  74. u32 fmt : 8; /* format */
  75. u32 : 24;
  76. u32 : 32;
  77. u8 fc; /* function controls */
  78. u64 : 56;
  79. u64 pba; /* PCI base address */
  80. u64 pal; /* PCI address limit */
  81. u64 iota; /* I/O Translation Anchor */
  82. union {
  83. struct zpci_fib_fmt0 fmt0;
  84. struct zpci_fib_fmt1 fmt1;
  85. };
  86. u64 fmb_addr; /* Function measurement block address and key */
  87. u32 : 32;
  88. u32 gd;
  89. } __packed __aligned(8);
  90. /* Set Interruption Controls Operation Controls */
  91. #define SIC_IRQ_MODE_ALL 0
  92. #define SIC_IRQ_MODE_SINGLE 1
  93. #define SIC_SET_AENI_CONTROLS 2
  94. #define SIC_IRQ_MODE_DIRECT 4
  95. #define SIC_IRQ_MODE_D_ALL 16
  96. #define SIC_IRQ_MODE_D_SINGLE 17
  97. #define SIC_IRQ_MODE_SET_CPU 18
  98. /* directed interruption information block */
  99. struct zpci_diib {
  100. u32 : 1;
  101. u32 isc : 3;
  102. u32 : 28;
  103. u16 : 16;
  104. u16 nr_cpus;
  105. u64 disb_addr;
  106. u64 : 64;
  107. u64 : 64;
  108. } __packed __aligned(8);
  109. /* cpu directed interruption information block */
  110. struct zpci_cdiib {
  111. u64 : 64;
  112. u64 dibv_addr;
  113. u64 : 64;
  114. u64 : 64;
  115. u64 : 64;
  116. } __packed __aligned(8);
  117. /* adapter interruption parameters block */
  118. struct zpci_aipb {
  119. u64 faisb;
  120. u64 gait;
  121. u16 : 13;
  122. u16 afi : 3;
  123. u32 : 32;
  124. u16 faal;
  125. } __packed __aligned(8);
  126. union zpci_sic_iib {
  127. struct zpci_diib diib;
  128. struct zpci_cdiib cdiib;
  129. struct zpci_aipb aipb;
  130. };
  131. DECLARE_STATIC_KEY_FALSE(have_mio);
  132. u8 zpci_mod_fc(u64 req, struct zpci_fib *fib, u8 *status);
  133. int zpci_refresh_trans(u64 fn, u64 addr, u64 range);
  134. int __zpci_load(u64 *data, u64 req, u64 offset);
  135. int zpci_load(u64 *data, const volatile void __iomem *addr, unsigned long len);
  136. int __zpci_store(u64 data, u64 req, u64 offset);
  137. int zpci_store(const volatile void __iomem *addr, u64 data, unsigned long len);
  138. int __zpci_store_block(const u64 *data, u64 req, u64 offset);
  139. void zpci_barrier(void);
  140. int zpci_set_irq_ctrl(u16 ctl, u8 isc, union zpci_sic_iib *iib);
  141. #endif