pci-msi.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. This document describes the generic device tree binding for describing the
  2. relationship between PCI devices and MSI controllers.
  3. Each PCI device under a root complex is uniquely identified by its Requester ID
  4. (AKA RID). A Requester ID is a triplet of a Bus number, Device number, and
  5. Function number.
  6. For the purpose of this document, when treated as a numeric value, a RID is
  7. formatted such that:
  8. * Bits [15:8] are the Bus number.
  9. * Bits [7:3] are the Device number.
  10. * Bits [2:0] are the Function number.
  11. * Any other bits required for padding must be zero.
  12. MSIs may be distinguished in part through the use of sideband data accompanying
  13. writes. In the case of PCI devices, this sideband data may be derived from the
  14. Requester ID. A mechanism is required to associate a device with both the MSI
  15. controllers it can address, and the sideband data that will be associated with
  16. its writes to those controllers.
  17. For generic MSI bindings, see
  18. Documentation/devicetree/bindings/interrupt-controller/msi.txt.
  19. PCI root complex
  20. ================
  21. Optional properties
  22. -------------------
  23. - msi-map: Maps a Requester ID to an MSI controller and associated
  24. msi-specifier data. The property is an arbitrary number of tuples of
  25. (rid-base,msi-controller,msi-base,length), where:
  26. * rid-base is a single cell describing the first RID matched by the entry.
  27. * msi-controller is a single phandle to an MSI controller
  28. * msi-base is an msi-specifier describing the msi-specifier produced for the
  29. first RID matched by the entry.
  30. * length is a single cell describing how many consecutive RIDs are matched
  31. following the rid-base.
  32. Any RID r in the interval [rid-base, rid-base + length) is associated with
  33. the listed msi-controller, with the msi-specifier (r - rid-base + msi-base).
  34. - msi-map-mask: A mask to be applied to each Requester ID prior to being mapped
  35. to an msi-specifier per the msi-map property.
  36. - msi-parent: Describes the MSI parent of the root complex itself. Where
  37. the root complex and MSI controller do not pass sideband data with MSI
  38. writes, this property may be used to describe the MSI controller(s)
  39. used by PCI devices under the root complex, if defined as such in the
  40. binding for the root complex.
  41. Example (1)
  42. ===========
  43. / {
  44. #address-cells = <1>;
  45. #size-cells = <1>;
  46. msi: msi-controller@a {
  47. reg = <0xa 0x1>;
  48. compatible = "vendor,some-controller";
  49. msi-controller;
  50. #msi-cells = <1>;
  51. };
  52. pci: pci@f {
  53. reg = <0xf 0x1>;
  54. compatible = "vendor,pcie-root-complex";
  55. device_type = "pci";
  56. /*
  57. * The sideband data provided to the MSI controller is
  58. * the RID, identity-mapped.
  59. */
  60. msi-map = <0x0 &msi_a 0x0 0x10000>,
  61. };
  62. };
  63. Example (2)
  64. ===========
  65. / {
  66. #address-cells = <1>;
  67. #size-cells = <1>;
  68. msi: msi-controller@a {
  69. reg = <0xa 0x1>;
  70. compatible = "vendor,some-controller";
  71. msi-controller;
  72. #msi-cells = <1>;
  73. };
  74. pci: pci@f {
  75. reg = <0xf 0x1>;
  76. compatible = "vendor,pcie-root-complex";
  77. device_type = "pci";
  78. /*
  79. * The sideband data provided to the MSI controller is
  80. * the RID, masked to only the device and function bits.
  81. */
  82. msi-map = <0x0 &msi_a 0x0 0x100>,
  83. msi-map-mask = <0xff>
  84. };
  85. };
  86. Example (3)
  87. ===========
  88. / {
  89. #address-cells = <1>;
  90. #size-cells = <1>;
  91. msi: msi-controller@a {
  92. reg = <0xa 0x1>;
  93. compatible = "vendor,some-controller";
  94. msi-controller;
  95. #msi-cells = <1>;
  96. };
  97. pci: pci@f {
  98. reg = <0xf 0x1>;
  99. compatible = "vendor,pcie-root-complex";
  100. device_type = "pci";
  101. /*
  102. * The sideband data provided to the MSI controller is
  103. * the RID, but the high bit of the bus number is
  104. * ignored.
  105. */
  106. msi-map = <0x0000 &msi 0x0000 0x8000>,
  107. <0x8000 &msi 0x0000 0x8000>;
  108. };
  109. };
  110. Example (4)
  111. ===========
  112. / {
  113. #address-cells = <1>;
  114. #size-cells = <1>;
  115. msi: msi-controller@a {
  116. reg = <0xa 0x1>;
  117. compatible = "vendor,some-controller";
  118. msi-controller;
  119. #msi-cells = <1>;
  120. };
  121. pci: pci@f {
  122. reg = <0xf 0x1>;
  123. compatible = "vendor,pcie-root-complex";
  124. device_type = "pci";
  125. /*
  126. * The sideband data provided to the MSI controller is
  127. * the RID, but the high bit of the bus number is
  128. * negated.
  129. */
  130. msi-map = <0x0000 &msi 0x8000 0x8000>,
  131. <0x8000 &msi 0x0000 0x8000>;
  132. };
  133. };
  134. Example (5)
  135. ===========
  136. / {
  137. #address-cells = <1>;
  138. #size-cells = <1>;
  139. msi_a: msi-controller@a {
  140. reg = <0xa 0x1>;
  141. compatible = "vendor,some-controller";
  142. msi-controller;
  143. #msi-cells = <1>;
  144. };
  145. msi_b: msi-controller@b {
  146. reg = <0xb 0x1>;
  147. compatible = "vendor,some-controller";
  148. msi-controller;
  149. #msi-cells = <1>;
  150. };
  151. msi_c: msi-controller@c {
  152. reg = <0xc 0x1>;
  153. compatible = "vendor,some-controller";
  154. msi-controller;
  155. #msi-cells = <1>;
  156. };
  157. pci: pci@c {
  158. reg = <0xf 0x1>;
  159. compatible = "vendor,pcie-root-complex";
  160. device_type = "pci";
  161. /*
  162. * The sideband data provided to MSI controller a is the
  163. * RID, but the high bit of the bus number is negated.
  164. * The sideband data provided to MSI controller b is the
  165. * RID, identity-mapped.
  166. * MSI controller c is not addressable.
  167. */
  168. msi-map = <0x0000 &msi_a 0x8000 0x08000>,
  169. <0x8000 &msi_a 0x0000 0x08000>,
  170. <0x0000 &msi_b 0x0000 0x10000>;
  171. };
  172. };