xref: /OK3568_Linux_fs/kernel/Documentation/firmware-guide/acpi/dsd/graph.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun======
4*4882a593SmuzhiyunGraphs
5*4882a593Smuzhiyun======
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun_DSD
8*4882a593Smuzhiyun====
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun_DSD (Device Specific Data) [7] is a predefined ACPI device
11*4882a593Smuzhiyunconfiguration object that can be used to convey information on
12*4882a593Smuzhiyunhardware features which are not specifically covered by the ACPI
13*4882a593Smuzhiyunspecification [1][6]. There are two _DSD extensions that are relevant
14*4882a593Smuzhiyunfor graphs: property [4] and hierarchical data extensions [5]. The
15*4882a593Smuzhiyunproperty extension provides generic key-value pairs whereas the
16*4882a593Smuzhiyunhierarchical data extension supports nodes with references to other
17*4882a593Smuzhiyunnodes, forming a tree. The nodes in the tree may contain properties as
18*4882a593Smuzhiyundefined by the property extension. The two extensions together provide
19*4882a593Smuzhiyuna tree-like structure with zero or more properties (key-value pairs)
20*4882a593Smuzhiyunin each node of the tree.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunThe data structure may be accessed at runtime by using the device_*
23*4882a593Smuzhiyunand fwnode_* functions defined in include/linux/fwnode.h .
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunFwnode represents a generic firmware node object. It is independent on
26*4882a593Smuzhiyunthe firmware type. In ACPI, fwnodes are _DSD hierarchical data
27*4882a593Smuzhiyunextensions objects. A device's _DSD object is represented by an
28*4882a593Smuzhiyunfwnode.
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunThe data structure may be referenced to elsewhere in the ACPI tables
31*4882a593Smuzhiyunby using a hard reference to the device itself and an index to the
32*4882a593Smuzhiyunhierarchical data extension array on each depth.
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunPorts and endpoints
36*4882a593Smuzhiyun===================
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunThe port and endpoint concepts are very similar to those in Devicetree
39*4882a593Smuzhiyun[3]. A port represents an interface in a device, and an endpoint
40*4882a593Smuzhiyunrepresents a connection to that interface.
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunAll port nodes are located under the device's "_DSD" node in the hierarchical
43*4882a593Smuzhiyundata extension tree. The data extension related to each port node must begin
44*4882a593Smuzhiyunwith "port" and must be followed by the "@" character and the number of the
45*4882a593Smuzhiyunport as its key. The target object it refers to should be called "PRTX", where
46*4882a593Smuzhiyun"X" is the number of the port. An example of such a package would be::
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun    Package() { "port@4", "PRT4" }
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunFurther on, endpoints are located under the port nodes. The hierarchical
51*4882a593Smuzhiyundata extension key of the endpoint nodes must begin with
52*4882a593Smuzhiyun"endpoint" and must be followed by the "@" character and the number of the
53*4882a593Smuzhiyunendpoint. The object it refers to should be called "EPXY", where "X" is the
54*4882a593Smuzhiyunnumber of the port and "Y" is the number of the endpoint. An example of such a
55*4882a593Smuzhiyunpackage would be::
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun    Package() { "endpoint@0", "EP40" }
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunEach port node contains a property extension key "port", the value of which is
60*4882a593Smuzhiyunthe number of the port. Each endpoint is similarly numbered with a property
61*4882a593Smuzhiyunextension key "reg", the value of which is the number of the endpoint. Port
62*4882a593Smuzhiyunnumbers must be unique within a device and endpoint numbers must be unique
63*4882a593Smuzhiyunwithin a port. If a device object may only has a single port, then the number
64*4882a593Smuzhiyunof that port shall be zero. Similarly, if a port may only have a single
65*4882a593Smuzhiyunendpoint, the number of that endpoint shall be zero.
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunThe endpoint reference uses property extension with "remote-endpoint" property
68*4882a593Smuzhiyunname followed by a reference in the same package. Such references consist of
69*4882a593Smuzhiyunthe remote device reference, the first package entry of the port data extension
70*4882a593Smuzhiyunreference under the device and finally the first package entry of the endpoint
71*4882a593Smuzhiyundata extension reference under the port. Individual references thus appear as::
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun    Package() { device, "port@X", "endpoint@Y" }
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunIn the above example, "X" is the number of the port and "Y" is the number of
76*4882a593Smuzhiyunthe endpoint.
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunThe references to endpoints must be always done both ways, to the
79*4882a593Smuzhiyunremote endpoint and back from the referred remote endpoint node.
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunA simple example of this is show below::
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun    Scope (\_SB.PCI0.I2C2)
84*4882a593Smuzhiyun    {
85*4882a593Smuzhiyun	Device (CAM0)
86*4882a593Smuzhiyun	{
87*4882a593Smuzhiyun	    Name (_DSD, Package () {
88*4882a593Smuzhiyun		ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
89*4882a593Smuzhiyun		Package () {
90*4882a593Smuzhiyun		    Package () { "compatible", Package () { "nokia,smia" } },
91*4882a593Smuzhiyun		},
92*4882a593Smuzhiyun		ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
93*4882a593Smuzhiyun		Package () {
94*4882a593Smuzhiyun		    Package () { "port@0", "PRT0" },
95*4882a593Smuzhiyun		}
96*4882a593Smuzhiyun	    })
97*4882a593Smuzhiyun	    Name (PRT0, Package() {
98*4882a593Smuzhiyun		ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
99*4882a593Smuzhiyun		Package () {
100*4882a593Smuzhiyun		    Package () { "reg", 0 },
101*4882a593Smuzhiyun		},
102*4882a593Smuzhiyun		ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
103*4882a593Smuzhiyun		Package () {
104*4882a593Smuzhiyun		    Package () { "endpoint@0", "EP00" },
105*4882a593Smuzhiyun		}
106*4882a593Smuzhiyun	    })
107*4882a593Smuzhiyun	    Name (EP00, Package() {
108*4882a593Smuzhiyun		ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
109*4882a593Smuzhiyun		Package () {
110*4882a593Smuzhiyun		    Package () { "reg", 0 },
111*4882a593Smuzhiyun		    Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, "port@4", "endpoint@0" } },
112*4882a593Smuzhiyun		}
113*4882a593Smuzhiyun	    })
114*4882a593Smuzhiyun	}
115*4882a593Smuzhiyun    }
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun    Scope (\_SB.PCI0)
118*4882a593Smuzhiyun    {
119*4882a593Smuzhiyun	Device (ISP)
120*4882a593Smuzhiyun	{
121*4882a593Smuzhiyun	    Name (_DSD, Package () {
122*4882a593Smuzhiyun		ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
123*4882a593Smuzhiyun		Package () {
124*4882a593Smuzhiyun		    Package () { "port@4", "PRT4" },
125*4882a593Smuzhiyun		}
126*4882a593Smuzhiyun	    })
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun	    Name (PRT4, Package() {
129*4882a593Smuzhiyun		ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
130*4882a593Smuzhiyun		Package () {
131*4882a593Smuzhiyun		    Package () { "reg", 4 }, /* CSI-2 port number */
132*4882a593Smuzhiyun		},
133*4882a593Smuzhiyun		ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
134*4882a593Smuzhiyun		Package () {
135*4882a593Smuzhiyun		    Package () { "endpoint@0", "EP40" },
136*4882a593Smuzhiyun		}
137*4882a593Smuzhiyun	    })
138*4882a593Smuzhiyun
139*4882a593Smuzhiyun	    Name (EP40, Package() {
140*4882a593Smuzhiyun		ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
141*4882a593Smuzhiyun		Package () {
142*4882a593Smuzhiyun		    Package () { "reg", 0 },
143*4882a593Smuzhiyun		    Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, "port@0", "endpoint@0" } },
144*4882a593Smuzhiyun		}
145*4882a593Smuzhiyun	    })
146*4882a593Smuzhiyun	}
147*4882a593Smuzhiyun    }
148*4882a593Smuzhiyun
149*4882a593SmuzhiyunHere, the port 0 of the "CAM0" device is connected to the port 4 of
150*4882a593Smuzhiyunthe "ISP" device and vice versa.
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun
153*4882a593SmuzhiyunReferences
154*4882a593Smuzhiyun==========
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun[1] _DSD (Device Specific Data) Implementation Guide.
157*4882a593Smuzhiyun    https://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel-1_1.htm,
158*4882a593Smuzhiyun    referenced 2016-10-03.
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun[2] Devicetree. https://www.devicetree.org, referenced 2016-10-03.
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun[3] Documentation/devicetree/bindings/graph.txt
163*4882a593Smuzhiyun
164*4882a593Smuzhiyun[4] Device Properties UUID For _DSD.
165*4882a593Smuzhiyun    https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf,
166*4882a593Smuzhiyun    referenced 2016-10-04.
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun[5] Hierarchical Data Extension UUID For _DSD.
169*4882a593Smuzhiyun    https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf,
170*4882a593Smuzhiyun    referenced 2016-10-04.
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun[6] Advanced Configuration and Power Interface Specification.
173*4882a593Smuzhiyun    https://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf,
174*4882a593Smuzhiyun    referenced 2016-10-04.
175*4882a593Smuzhiyun
176*4882a593Smuzhiyun[7] _DSD Device Properties Usage Rules.
177*4882a593Smuzhiyun    :doc:`../DSD-properties-rules`
178