162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci====== 462306a36Sopenharmony_ciGraphs 562306a36Sopenharmony_ci====== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci_DSD 862306a36Sopenharmony_ci==== 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci_DSD (Device Specific Data) [dsd-guide] is a predefined ACPI device 1162306a36Sopenharmony_ciconfiguration object that can be used to convey information on 1262306a36Sopenharmony_cihardware features which are not specifically covered by the ACPI 1362306a36Sopenharmony_cispecification [acpi]. There are two _DSD extensions that are relevant 1462306a36Sopenharmony_cifor graphs: property [dsd-guide] and hierarchical data extensions. The 1562306a36Sopenharmony_ciproperty extension provides generic key-value pairs whereas the 1662306a36Sopenharmony_cihierarchical data extension supports nodes with references to other 1762306a36Sopenharmony_cinodes, forming a tree. The nodes in the tree may contain properties as 1862306a36Sopenharmony_cidefined by the property extension. The two extensions together provide 1962306a36Sopenharmony_cia tree-like structure with zero or more properties (key-value pairs) 2062306a36Sopenharmony_ciin each node of the tree. 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciThe data structure may be accessed at runtime by using the device_* 2362306a36Sopenharmony_ciand fwnode_* functions defined in include/linux/fwnode.h . 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciFwnode represents a generic firmware node object. It is independent on 2662306a36Sopenharmony_cithe firmware type. In ACPI, fwnodes are _DSD hierarchical data 2762306a36Sopenharmony_ciextensions objects. A device's _DSD object is represented by an 2862306a36Sopenharmony_cifwnode. 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ciThe data structure may be referenced to elsewhere in the ACPI tables 3162306a36Sopenharmony_ciby using a hard reference to the device itself and an index to the 3262306a36Sopenharmony_cihierarchical data extension array on each depth. 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciPorts and endpoints 3662306a36Sopenharmony_ci=================== 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciThe port and endpoint concepts are very similar to those in Devicetree 3962306a36Sopenharmony_ci[devicetree, graph-bindings]. A port represents an interface in a device, and 4062306a36Sopenharmony_cian endpoint represents a connection to that interface. Also see [data-node-ref] 4162306a36Sopenharmony_cifor generic data node references. 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ciAll port nodes are located under the device's "_DSD" node in the hierarchical 4462306a36Sopenharmony_cidata extension tree. The data extension related to each port node must begin 4562306a36Sopenharmony_ciwith "port" and must be followed by the "@" character and the number of the 4662306a36Sopenharmony_ciport as its key. The target object it refers to should be called "PRTX", where 4762306a36Sopenharmony_ci"X" is the number of the port. An example of such a package would be:: 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci Package() { "port@4", "PRT4" } 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciFurther on, endpoints are located under the port nodes. The hierarchical 5262306a36Sopenharmony_cidata extension key of the endpoint nodes must begin with 5362306a36Sopenharmony_ci"endpoint" and must be followed by the "@" character and the number of the 5462306a36Sopenharmony_ciendpoint. The object it refers to should be called "EPXY", where "X" is the 5562306a36Sopenharmony_cinumber of the port and "Y" is the number of the endpoint. An example of such a 5662306a36Sopenharmony_cipackage would be:: 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci Package() { "endpoint@0", "EP40" } 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ciEach port node contains a property extension key "port", the value of which is 6162306a36Sopenharmony_cithe number of the port. Each endpoint is similarly numbered with a property 6262306a36Sopenharmony_ciextension key "reg", the value of which is the number of the endpoint. Port 6362306a36Sopenharmony_cinumbers must be unique within a device and endpoint numbers must be unique 6462306a36Sopenharmony_ciwithin a port. If a device object may only has a single port, then the number 6562306a36Sopenharmony_ciof that port shall be zero. Similarly, if a port may only have a single 6662306a36Sopenharmony_ciendpoint, the number of that endpoint shall be zero. 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ciThe endpoint reference uses property extension with "remote-endpoint" property 6962306a36Sopenharmony_ciname followed by a reference in the same package. Such references consist of 7062306a36Sopenharmony_cithe remote device reference, the first package entry of the port data extension 7162306a36Sopenharmony_cireference under the device and finally the first package entry of the endpoint 7262306a36Sopenharmony_cidata extension reference under the port. Individual references thus appear as:: 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci Package() { device, "port@X", "endpoint@Y" } 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ciIn the above example, "X" is the number of the port and "Y" is the number of 7762306a36Sopenharmony_cithe endpoint. 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ciThe references to endpoints must be always done both ways, to the 8062306a36Sopenharmony_ciremote endpoint and back from the referred remote endpoint node. 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ciA simple example of this is show below:: 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci Scope (\_SB.PCI0.I2C2) 8562306a36Sopenharmony_ci { 8662306a36Sopenharmony_ci Device (CAM0) 8762306a36Sopenharmony_ci { 8862306a36Sopenharmony_ci Name (_DSD, Package () { 8962306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 9062306a36Sopenharmony_ci Package () { 9162306a36Sopenharmony_ci Package () { "compatible", Package () { "nokia,smia" } }, 9262306a36Sopenharmony_ci }, 9362306a36Sopenharmony_ci ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 9462306a36Sopenharmony_ci Package () { 9562306a36Sopenharmony_ci Package () { "port@0", "PRT0" }, 9662306a36Sopenharmony_ci } 9762306a36Sopenharmony_ci }) 9862306a36Sopenharmony_ci Name (PRT0, Package() { 9962306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 10062306a36Sopenharmony_ci Package () { 10162306a36Sopenharmony_ci Package () { "reg", 0 }, 10262306a36Sopenharmony_ci }, 10362306a36Sopenharmony_ci ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 10462306a36Sopenharmony_ci Package () { 10562306a36Sopenharmony_ci Package () { "endpoint@0", "EP00" }, 10662306a36Sopenharmony_ci } 10762306a36Sopenharmony_ci }) 10862306a36Sopenharmony_ci Name (EP00, Package() { 10962306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 11062306a36Sopenharmony_ci Package () { 11162306a36Sopenharmony_ci Package () { "reg", 0 }, 11262306a36Sopenharmony_ci Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, "port@4", "endpoint@0" } }, 11362306a36Sopenharmony_ci } 11462306a36Sopenharmony_ci }) 11562306a36Sopenharmony_ci } 11662306a36Sopenharmony_ci } 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci Scope (\_SB.PCI0) 11962306a36Sopenharmony_ci { 12062306a36Sopenharmony_ci Device (ISP) 12162306a36Sopenharmony_ci { 12262306a36Sopenharmony_ci Name (_DSD, Package () { 12362306a36Sopenharmony_ci ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 12462306a36Sopenharmony_ci Package () { 12562306a36Sopenharmony_ci Package () { "port@4", "PRT4" }, 12662306a36Sopenharmony_ci } 12762306a36Sopenharmony_ci }) 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci Name (PRT4, Package() { 13062306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 13162306a36Sopenharmony_ci Package () { 13262306a36Sopenharmony_ci Package () { "reg", 4 }, /* CSI-2 port number */ 13362306a36Sopenharmony_ci }, 13462306a36Sopenharmony_ci ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 13562306a36Sopenharmony_ci Package () { 13662306a36Sopenharmony_ci Package () { "endpoint@0", "EP40" }, 13762306a36Sopenharmony_ci } 13862306a36Sopenharmony_ci }) 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci Name (EP40, Package() { 14162306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 14262306a36Sopenharmony_ci Package () { 14362306a36Sopenharmony_ci Package () { "reg", 0 }, 14462306a36Sopenharmony_ci Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, "port@0", "endpoint@0" } }, 14562306a36Sopenharmony_ci } 14662306a36Sopenharmony_ci }) 14762306a36Sopenharmony_ci } 14862306a36Sopenharmony_ci } 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ciHere, the port 0 of the "CAM0" device is connected to the port 4 of 15162306a36Sopenharmony_cithe "ISP" device and vice versa. 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ciReferences 15562306a36Sopenharmony_ci========== 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci[acpi] Advanced Configuration and Power Interface Specification. 15862306a36Sopenharmony_ci https://uefi.org/specifications/ACPI/6.4/, referenced 2021-11-30. 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci[data-node-ref] Documentation/firmware-guide/acpi/dsd/data-node-references.rst 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci[devicetree] Devicetree. https://www.devicetree.org, referenced 2016-10-03. 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci[dsd-guide] DSD Guide. 16562306a36Sopenharmony_ci https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced 16662306a36Sopenharmony_ci 2021-11-30. 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci[dsd-rules] _DSD Device Properties Usage Rules. 16962306a36Sopenharmony_ci Documentation/firmware-guide/acpi/DSD-properties-rules.rst 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci[graph-bindings] Common bindings for device graphs (Devicetree). 17262306a36Sopenharmony_ci https://github.com/devicetree-org/dt-schema/blob/main/schemas/graph.yaml, 17362306a36Sopenharmony_ci referenced 2021-11-30. 174