pci_clp.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_S390_PCI_CLP_H
  3. #define _ASM_S390_PCI_CLP_H
  4. #include <asm/clp.h>
  5. /*
  6. * Call Logical Processor - Command Codes
  7. */
  8. #define CLP_LIST_PCI 0x0002
  9. #define CLP_QUERY_PCI_FN 0x0003
  10. #define CLP_QUERY_PCI_FNGRP 0x0004
  11. #define CLP_SET_PCI_FN 0x0005
  12. /* PCI function handle list entry */
  13. struct clp_fh_list_entry {
  14. u16 device_id;
  15. u16 vendor_id;
  16. u32 config_state : 1;
  17. u32 : 31;
  18. u32 fid; /* PCI function id */
  19. u32 fh; /* PCI function handle */
  20. } __packed;
  21. #define CLP_RC_SETPCIFN_FH 0x0101 /* Invalid PCI fn handle */
  22. #define CLP_RC_SETPCIFN_FHOP 0x0102 /* Fn handle not valid for op */
  23. #define CLP_RC_SETPCIFN_DMAAS 0x0103 /* Invalid DMA addr space */
  24. #define CLP_RC_SETPCIFN_RES 0x0104 /* Insufficient resources */
  25. #define CLP_RC_SETPCIFN_ALRDY 0x0105 /* Fn already in requested state */
  26. #define CLP_RC_SETPCIFN_ERR 0x0106 /* Fn in permanent error state */
  27. #define CLP_RC_SETPCIFN_RECPND 0x0107 /* Error recovery pending */
  28. #define CLP_RC_SETPCIFN_BUSY 0x0108 /* Fn busy */
  29. #define CLP_RC_LISTPCI_BADRT 0x010a /* Resume token not recognized */
  30. #define CLP_RC_QUERYPCIFG_PFGID 0x010b /* Unrecognized PFGID */
  31. /* request or response block header length */
  32. #define LIST_PCI_HDR_LEN 32
  33. /* Number of function handles fitting in response block */
  34. #define CLP_FH_LIST_NR_ENTRIES \
  35. ((CLP_BLK_SIZE - 2 * LIST_PCI_HDR_LEN) \
  36. / sizeof(struct clp_fh_list_entry))
  37. #define CLP_SET_ENABLE_PCI_FN 0 /* Yes, 0 enables it */
  38. #define CLP_SET_DISABLE_PCI_FN 1 /* Yes, 1 disables it */
  39. #define CLP_UTIL_STR_LEN 64
  40. #define CLP_PFIP_NR_SEGMENTS 4
  41. extern bool zpci_unique_uid;
  42. /* List PCI functions request */
  43. struct clp_req_list_pci {
  44. struct clp_req_hdr hdr;
  45. u64 resume_token;
  46. u64 reserved2;
  47. } __packed;
  48. /* List PCI functions response */
  49. struct clp_rsp_list_pci {
  50. struct clp_rsp_hdr hdr;
  51. u64 resume_token;
  52. u32 reserved2;
  53. u16 max_fn;
  54. u8 : 7;
  55. u8 uid_checking : 1;
  56. u8 entry_size;
  57. struct clp_fh_list_entry fh_list[CLP_FH_LIST_NR_ENTRIES];
  58. } __packed;
  59. /* Query PCI function request */
  60. struct clp_req_query_pci {
  61. struct clp_req_hdr hdr;
  62. u32 fh; /* function handle */
  63. u32 reserved2;
  64. u64 reserved3;
  65. } __packed;
  66. /* Query PCI function response */
  67. struct clp_rsp_query_pci {
  68. struct clp_rsp_hdr hdr;
  69. u16 vfn; /* virtual fn number */
  70. u16 : 7;
  71. u16 util_str_avail : 1; /* utility string available? */
  72. u16 pfgid : 8; /* pci function group id */
  73. u32 fid; /* pci function id */
  74. u8 bar_size[PCI_BAR_COUNT];
  75. u16 pchid;
  76. __le32 bar[PCI_BAR_COUNT];
  77. u8 pfip[CLP_PFIP_NR_SEGMENTS]; /* pci function internal path */
  78. u32 : 16;
  79. u8 fmb_len;
  80. u8 pft; /* pci function type */
  81. u64 sdma; /* start dma as */
  82. u64 edma; /* end dma as */
  83. u32 reserved[11];
  84. u32 uid; /* user defined id */
  85. u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */
  86. } __packed;
  87. /* Query PCI function group request */
  88. struct clp_req_query_pci_grp {
  89. struct clp_req_hdr hdr;
  90. u32 reserved2 : 24;
  91. u32 pfgid : 8; /* function group id */
  92. u32 reserved3;
  93. u64 reserved4;
  94. } __packed;
  95. /* Query PCI function group response */
  96. struct clp_rsp_query_pci_grp {
  97. struct clp_rsp_hdr hdr;
  98. u16 : 4;
  99. u16 noi : 12; /* number of interrupts */
  100. u8 version;
  101. u8 : 6;
  102. u8 frame : 1;
  103. u8 refresh : 1; /* TLB refresh mode */
  104. u16 reserved2;
  105. u16 mui;
  106. u64 reserved3;
  107. u64 dasm; /* dma address space mask */
  108. u64 msia; /* MSI address */
  109. u64 reserved4;
  110. u64 reserved5;
  111. } __packed;
  112. /* Set PCI function request */
  113. struct clp_req_set_pci {
  114. struct clp_req_hdr hdr;
  115. u32 fh; /* function handle */
  116. u16 reserved2;
  117. u8 oc; /* operation controls */
  118. u8 ndas; /* number of dma spaces */
  119. u64 reserved3;
  120. } __packed;
  121. /* Set PCI function response */
  122. struct clp_rsp_set_pci {
  123. struct clp_rsp_hdr hdr;
  124. u32 fh; /* function handle */
  125. u32 reserved3;
  126. u64 reserved4;
  127. } __packed;
  128. /* Combined request/response block structures used by clp insn */
  129. struct clp_req_rsp_list_pci {
  130. struct clp_req_list_pci request;
  131. struct clp_rsp_list_pci response;
  132. } __packed;
  133. struct clp_req_rsp_set_pci {
  134. struct clp_req_set_pci request;
  135. struct clp_rsp_set_pci response;
  136. } __packed;
  137. struct clp_req_rsp_query_pci {
  138. struct clp_req_query_pci request;
  139. struct clp_rsp_query_pci response;
  140. } __packed;
  141. struct clp_req_rsp_query_pci_grp {
  142. struct clp_req_query_pci_grp request;
  143. struct clp_rsp_query_pci_grp response;
  144. } __packed;
  145. #endif