xref: /freebsd/sys/contrib/device-tree/Bindings/pci/pci.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotPCI bus bridges have standardized Device Tree bindings:
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotPCI Bus Binding to: IEEE Std 1275-1994
4*c66ec88fSEmmanuel Vadothttps://www.devicetree.org/open-firmware/bindings/pci/pci2_1.pdf
5*c66ec88fSEmmanuel Vadot
6*c66ec88fSEmmanuel VadotAnd for the interrupt mapping part:
7*c66ec88fSEmmanuel Vadot
8*c66ec88fSEmmanuel VadotOpen Firmware Recommended Practice: Interrupt Mapping
9*c66ec88fSEmmanuel Vadothttps://www.devicetree.org/open-firmware/practice/imap/imap0_9d.pdf
10*c66ec88fSEmmanuel Vadot
11*c66ec88fSEmmanuel VadotAdditionally to the properties specified in the above standards a host bridge
12*c66ec88fSEmmanuel Vadotdriver implementation may support the following properties:
13*c66ec88fSEmmanuel Vadot
14*c66ec88fSEmmanuel Vadot- linux,pci-domain:
15*c66ec88fSEmmanuel Vadot   If present this property assigns a fixed PCI domain number to a host bridge,
16*c66ec88fSEmmanuel Vadot   otherwise an unstable (across boots) unique number will be assigned.
17*c66ec88fSEmmanuel Vadot   It is required to either not set this property at all or set it for all
18*c66ec88fSEmmanuel Vadot   host bridges in the system, otherwise potentially conflicting domain numbers
19*c66ec88fSEmmanuel Vadot   may be assigned to root buses behind different host bridges.  The domain
20*c66ec88fSEmmanuel Vadot   number for each host bridge in the system must be unique.
21*c66ec88fSEmmanuel Vadot- max-link-speed:
22*c66ec88fSEmmanuel Vadot   If present this property specifies PCI gen for link capability.  Host
23*c66ec88fSEmmanuel Vadot   drivers could add this as a strategy to avoid unnecessary operation for
24*c66ec88fSEmmanuel Vadot   unsupported link speed, for instance, trying to do training for
25*c66ec88fSEmmanuel Vadot   unsupported link speed, etc.  Must be '4' for gen4, '3' for gen3, '2'
26*c66ec88fSEmmanuel Vadot   for gen2, and '1' for gen1. Any other values are invalid.
27*c66ec88fSEmmanuel Vadot- reset-gpios:
28*c66ec88fSEmmanuel Vadot   If present this property specifies PERST# GPIO. Host drivers can parse the
29*c66ec88fSEmmanuel Vadot   GPIO and apply fundamental reset to endpoints.
30*c66ec88fSEmmanuel Vadot- supports-clkreq:
31*c66ec88fSEmmanuel Vadot   If present this property specifies that CLKREQ signal routing exists from
32*c66ec88fSEmmanuel Vadot   root port to downstream device and host bridge drivers can do programming
33*c66ec88fSEmmanuel Vadot   which depends on CLKREQ signal existence. For example, programming root port
34*c66ec88fSEmmanuel Vadot   not to advertise ASPM L1 Sub-States support if there is no CLKREQ signal.
35*c66ec88fSEmmanuel Vadot
36*c66ec88fSEmmanuel VadotPCI-PCI Bridge properties
37*c66ec88fSEmmanuel Vadot-------------------------
38*c66ec88fSEmmanuel Vadot
39*c66ec88fSEmmanuel VadotPCIe root ports and switch ports may be described explicitly in the device
40*c66ec88fSEmmanuel Vadottree, as children of the host bridge node. Even though those devices are
41*c66ec88fSEmmanuel Vadotdiscoverable by probing, it might be necessary to describe properties that
42*c66ec88fSEmmanuel Vadotaren't provided by standard PCIe capabilities.
43*c66ec88fSEmmanuel Vadot
44*c66ec88fSEmmanuel VadotRequired properties:
45*c66ec88fSEmmanuel Vadot
46*c66ec88fSEmmanuel Vadot- reg:
47*c66ec88fSEmmanuel Vadot   Identifies the PCI-PCI bridge. As defined in the IEEE Std 1275-1994
48*c66ec88fSEmmanuel Vadot   document, it is a five-cell address encoded as (phys.hi phys.mid
49*c66ec88fSEmmanuel Vadot   phys.lo size.hi size.lo). phys.hi should contain the device's BDF as
50*c66ec88fSEmmanuel Vadot   0b00000000 bbbbbbbb dddddfff 00000000. The other cells should be zero.
51*c66ec88fSEmmanuel Vadot
52*c66ec88fSEmmanuel Vadot   The bus number is defined by firmware, through the standard bridge
53*c66ec88fSEmmanuel Vadot   configuration mechanism. If this port is a switch port, then firmware
54*c66ec88fSEmmanuel Vadot   allocates the bus number and writes it into the Secondary Bus Number
55*c66ec88fSEmmanuel Vadot   register of the bridge directly above this port. Otherwise, the bus
56*c66ec88fSEmmanuel Vadot   number of a root port is the first number in the bus-range property,
57*c66ec88fSEmmanuel Vadot   defaulting to zero.
58*c66ec88fSEmmanuel Vadot
59*c66ec88fSEmmanuel Vadot   If firmware leaves the ARI Forwarding Enable bit set in the bridge
60*c66ec88fSEmmanuel Vadot   above this port, then phys.hi contains the 8-bit function number as
61*c66ec88fSEmmanuel Vadot   0b00000000 bbbbbbbb ffffffff 00000000. Note that the PCIe specification
62*c66ec88fSEmmanuel Vadot   recommends that firmware only leaves ARI enabled when it knows that the
63*c66ec88fSEmmanuel Vadot   OS is ARI-aware.
64*c66ec88fSEmmanuel Vadot
65*c66ec88fSEmmanuel VadotOptional properties:
66*c66ec88fSEmmanuel Vadot
67*c66ec88fSEmmanuel Vadot- external-facing:
68*c66ec88fSEmmanuel Vadot   When present, the port is external-facing. All bridges and endpoints
69*c66ec88fSEmmanuel Vadot   downstream of this port are external to the machine. The OS can, for
70*c66ec88fSEmmanuel Vadot   example, use this information to identify devices that cannot be
71*c66ec88fSEmmanuel Vadot   trusted with relaxed DMA protection, as users could easily attach
72*c66ec88fSEmmanuel Vadot   malicious devices to this port.
73*c66ec88fSEmmanuel Vadot
74*c66ec88fSEmmanuel VadotExample:
75*c66ec88fSEmmanuel Vadot
76*c66ec88fSEmmanuel Vadotpcie@10000000 {
77*c66ec88fSEmmanuel Vadot	compatible = "pci-host-ecam-generic";
78*c66ec88fSEmmanuel Vadot	...
79*c66ec88fSEmmanuel Vadot	pcie@0008 {
80*c66ec88fSEmmanuel Vadot		/* Root port 00:01.0 is external-facing */
81*c66ec88fSEmmanuel Vadot		reg = <0x00000800 0 0 0 0>;
82*c66ec88fSEmmanuel Vadot		external-facing;
83*c66ec88fSEmmanuel Vadot	};
84*c66ec88fSEmmanuel Vadot};
85