1f2dde1edSChangbin Du.. SPDX-License-Identifier: GPL-2.0 2f2dde1edSChangbin Du 3f2dde1edSChangbin Du====== 4f2dde1edSChangbin DuGraphs 5f2dde1edSChangbin Du====== 6f2dde1edSChangbin Du 7f2dde1edSChangbin Du_DSD 8f2dde1edSChangbin Du==== 9f2dde1edSChangbin Du 1059f3f982SSakari Ailus_DSD (Device Specific Data) [dsd-guide] is a predefined ACPI device 11f2dde1edSChangbin Duconfiguration object that can be used to convey information on 12f2dde1edSChangbin Duhardware features which are not specifically covered by the ACPI 1359f3f982SSakari Ailusspecification [acpi]. There are two _DSD extensions that are relevant 1459f3f982SSakari Ailusfor graphs: property [dsd-guide] and hierarchical data extensions. The 15f2dde1edSChangbin Duproperty extension provides generic key-value pairs whereas the 16f2dde1edSChangbin Duhierarchical data extension supports nodes with references to other 17f2dde1edSChangbin Dunodes, forming a tree. The nodes in the tree may contain properties as 18f2dde1edSChangbin Dudefined by the property extension. The two extensions together provide 19f2dde1edSChangbin Dua tree-like structure with zero or more properties (key-value pairs) 20f2dde1edSChangbin Duin each node of the tree. 21f2dde1edSChangbin Du 22f2dde1edSChangbin DuThe data structure may be accessed at runtime by using the device_* 23f2dde1edSChangbin Duand fwnode_* functions defined in include/linux/fwnode.h . 24f2dde1edSChangbin Du 25f2dde1edSChangbin DuFwnode represents a generic firmware node object. It is independent on 26f2dde1edSChangbin Duthe firmware type. In ACPI, fwnodes are _DSD hierarchical data 27f2dde1edSChangbin Duextensions objects. A device's _DSD object is represented by an 28f2dde1edSChangbin Dufwnode. 29f2dde1edSChangbin Du 30f2dde1edSChangbin DuThe data structure may be referenced to elsewhere in the ACPI tables 31f2dde1edSChangbin Duby using a hard reference to the device itself and an index to the 32f2dde1edSChangbin Duhierarchical data extension array on each depth. 33f2dde1edSChangbin Du 34f2dde1edSChangbin Du 35f2dde1edSChangbin DuPorts and endpoints 36f2dde1edSChangbin Du=================== 37f2dde1edSChangbin Du 38f2dde1edSChangbin DuThe port and endpoint concepts are very similar to those in Devicetree 3959f3f982SSakari Ailus[devicetree, graph-bindings]. A port represents an interface in a device, and 4059f3f982SSakari Ailusan endpoint represents a connection to that interface. Also see [data-node-ref] 4159f3f982SSakari Ailusfor generic data node references. 42f2dde1edSChangbin Du 43f2dde1edSChangbin DuAll port nodes are located under the device's "_DSD" node in the hierarchical 44f2dde1edSChangbin Dudata extension tree. The data extension related to each port node must begin 45f2dde1edSChangbin Duwith "port" and must be followed by the "@" character and the number of the 46f2dde1edSChangbin Duport as its key. The target object it refers to should be called "PRTX", where 47f2dde1edSChangbin Du"X" is the number of the port. An example of such a package would be:: 48f2dde1edSChangbin Du 49a423bd84SSakari Ailus Package() { "port@4", "PRT4" } 50f2dde1edSChangbin Du 51f2dde1edSChangbin DuFurther on, endpoints are located under the port nodes. The hierarchical 52f2dde1edSChangbin Dudata extension key of the endpoint nodes must begin with 53f2dde1edSChangbin Du"endpoint" and must be followed by the "@" character and the number of the 54f2dde1edSChangbin Duendpoint. The object it refers to should be called "EPXY", where "X" is the 55f2dde1edSChangbin Dunumber of the port and "Y" is the number of the endpoint. An example of such a 56f2dde1edSChangbin Dupackage would be:: 57f2dde1edSChangbin Du 58a423bd84SSakari Ailus Package() { "endpoint@0", "EP40" } 59f2dde1edSChangbin Du 60f2dde1edSChangbin DuEach port node contains a property extension key "port", the value of which is 61f2dde1edSChangbin Duthe number of the port. Each endpoint is similarly numbered with a property 62f2dde1edSChangbin Duextension key "reg", the value of which is the number of the endpoint. Port 63f2dde1edSChangbin Dunumbers must be unique within a device and endpoint numbers must be unique 64f2dde1edSChangbin Duwithin a port. If a device object may only has a single port, then the number 65f2dde1edSChangbin Duof that port shall be zero. Similarly, if a port may only have a single 66f2dde1edSChangbin Duendpoint, the number of that endpoint shall be zero. 67f2dde1edSChangbin Du 68f2dde1edSChangbin DuThe endpoint reference uses property extension with "remote-endpoint" property 69*6db0261fSSakari Ailusname followed by a string reference in the same package. [data-node-ref]:: 70f2dde1edSChangbin Du 71*6db0261fSSakari Ailus "device.datanode" 72f2dde1edSChangbin Du 73f2dde1edSChangbin DuIn the above example, "X" is the number of the port and "Y" is the number of 74f2dde1edSChangbin Duthe endpoint. 75f2dde1edSChangbin Du 76f2dde1edSChangbin DuThe references to endpoints must be always done both ways, to the 77f2dde1edSChangbin Duremote endpoint and back from the referred remote endpoint node. 78f2dde1edSChangbin Du 79f2dde1edSChangbin DuA simple example of this is show below:: 80f2dde1edSChangbin Du 81f2dde1edSChangbin Du Scope (\_SB.PCI0.I2C2) 82f2dde1edSChangbin Du { 83f2dde1edSChangbin Du Device (CAM0) 84f2dde1edSChangbin Du { 85f2dde1edSChangbin Du Name (_DSD, Package () { 86f2dde1edSChangbin Du ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 87f2dde1edSChangbin Du Package () { 88f2dde1edSChangbin Du Package () { "compatible", Package () { "nokia,smia" } }, 89f2dde1edSChangbin Du }, 90f2dde1edSChangbin Du ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 91f2dde1edSChangbin Du Package () { 92a423bd84SSakari Ailus Package () { "port@0", "PRT0" }, 93f2dde1edSChangbin Du } 94f2dde1edSChangbin Du }) 95f2dde1edSChangbin Du Name (PRT0, Package() { 96f2dde1edSChangbin Du ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 97f2dde1edSChangbin Du Package () { 98f2dde1edSChangbin Du Package () { "reg", 0 }, 99f2dde1edSChangbin Du }, 100f2dde1edSChangbin Du ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 101f2dde1edSChangbin Du Package () { 102a423bd84SSakari Ailus Package () { "endpoint@0", "EP00" }, 103f2dde1edSChangbin Du } 104f2dde1edSChangbin Du }) 105f2dde1edSChangbin Du Name (EP00, Package() { 106f2dde1edSChangbin Du ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 107f2dde1edSChangbin Du Package () { 108f2dde1edSChangbin Du Package () { "reg", 0 }, 109*6db0261fSSakari Ailus Package () { "remote-endpoint", "\\_SB.PCI0.ISP.EP40" }, 110f2dde1edSChangbin Du } 111f2dde1edSChangbin Du }) 112f2dde1edSChangbin Du } 113f2dde1edSChangbin Du } 114f2dde1edSChangbin Du 115f2dde1edSChangbin Du Scope (\_SB.PCI0) 116f2dde1edSChangbin Du { 117f2dde1edSChangbin Du Device (ISP) 118f2dde1edSChangbin Du { 119f2dde1edSChangbin Du Name (_DSD, Package () { 120f2dde1edSChangbin Du ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 121f2dde1edSChangbin Du Package () { 122a423bd84SSakari Ailus Package () { "port@4", "PRT4" }, 123f2dde1edSChangbin Du } 124f2dde1edSChangbin Du }) 125f2dde1edSChangbin Du 126f2dde1edSChangbin Du Name (PRT4, Package() { 127f2dde1edSChangbin Du ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 128f2dde1edSChangbin Du Package () { 129f2dde1edSChangbin Du Package () { "reg", 4 }, /* CSI-2 port number */ 130f2dde1edSChangbin Du }, 131f2dde1edSChangbin Du ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 132f2dde1edSChangbin Du Package () { 133a423bd84SSakari Ailus Package () { "endpoint@0", "EP40" }, 134f2dde1edSChangbin Du } 135f2dde1edSChangbin Du }) 136f2dde1edSChangbin Du 137f2dde1edSChangbin Du Name (EP40, Package() { 138f2dde1edSChangbin Du ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 139f2dde1edSChangbin Du Package () { 140f2dde1edSChangbin Du Package () { "reg", 0 }, 141*6db0261fSSakari Ailus Package () { "remote-endpoint", "\\_SB.PCI0.I2C2.CAM0.EP00" }, 142f2dde1edSChangbin Du } 143f2dde1edSChangbin Du }) 144f2dde1edSChangbin Du } 145f2dde1edSChangbin Du } 146f2dde1edSChangbin Du 147f2dde1edSChangbin DuHere, the port 0 of the "CAM0" device is connected to the port 4 of 148f2dde1edSChangbin Duthe "ISP" device and vice versa. 149f2dde1edSChangbin Du 150f2dde1edSChangbin Du 151f2dde1edSChangbin DuReferences 152f2dde1edSChangbin Du========== 153f2dde1edSChangbin Du 15459f3f982SSakari Ailus[acpi] Advanced Configuration and Power Interface Specification. 15559f3f982SSakari Ailus https://uefi.org/specifications/ACPI/6.4/, referenced 2021-11-30. 156f2dde1edSChangbin Du 15759f3f982SSakari Ailus[data-node-ref] Documentation/firmware-guide/acpi/dsd/data-node-references.rst 158f2dde1edSChangbin Du 15959f3f982SSakari Ailus[devicetree] Devicetree. https://www.devicetree.org, referenced 2016-10-03. 160f2dde1edSChangbin Du 16159f3f982SSakari Ailus[dsd-guide] DSD Guide. 16259f3f982SSakari Ailus https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced 16359f3f982SSakari Ailus 2021-11-30. 164f2dde1edSChangbin Du 16559f3f982SSakari Ailus[dsd-rules] _DSD Device Properties Usage Rules. 1664d361d6cSMauro Carvalho Chehab Documentation/firmware-guide/acpi/DSD-properties-rules.rst 16759f3f982SSakari Ailus 16859f3f982SSakari Ailus[graph-bindings] Common bindings for device graphs (Devicetree). 16959f3f982SSakari Ailus https://github.com/devicetree-org/dt-schema/blob/main/schemas/graph.yaml, 17059f3f982SSakari Ailus referenced 2021-11-30. 171