Üdv,
Van itt olyanvalaki, aki jártas az FDT (.dtb) generálásban? Próbálom kihámozni a specifikációból, de egyre inkább az az érzésem, hogy ez egy förtelem.
Specifikáció itt (PDF), ez próbálom összevetni ezzel: linux dts. Ebben ilyent látok:
soc {
/*
* Defined ranges:
* Common BCM283x peripherals
* BCM2711-specific peripherals
* ARM-local peripherals
*/
ranges = <0x7e000000 0x0 0xfe000000 0x01800000>,
<0x7c000000 0x0 0xfc000000 0x02000000>,
<0x40000000 0x0 0xff800000 0x00800000>;
/* Emulate a contiguous 30-bit address range for DMA */
dma-ranges = <0xc0000000 0x0 0x00000000 0x40000000>;
/*
* This node is the provider for the enable-method for
* bringing up secondary cores.
*/
local_intc: interrupt-controller@40000000 {
compatible = "brcm,bcm2836-l1-intc";
reg = <0x40000000 0x100>;
};
Első számú kérdés, a spec-ben az áll:
2.3.5 #address-cells and #size-cells
...
The #address-cells and #size-cells properties are not inherited from ancestors in the devicetree. They shall be explicitly defined.
Hát a fenti példában ez nyilvánvalóan nem így van. Nincs egyik "-cells" property se, szóval szinte biztos, hogy a szülőtől kellene örökíteni, szemben azzal, amit a spec állít, nem?
A másik kérdés a "ranges" és "dma-ranges" property-kre vonatkozik, na itt aztán végképp se füle, se farka az egésznek. A spec szerint:
2.3.8 ranges
...
The format of the value of the ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length)
Illetve
2.3.9 dma-ranges
...
The format of the value of the dma-ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length).
...
The child-bus-address is a physical address within the child bus’ address space. The number of cells to represent the address depends on the bus and can be determined from the #address-cells of this node (the node in which the dma-ranges property appears).
The parent-bus-address is a physical address within the parent bus’ address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent’s address space.
Namost a "ranges"-ben eleve négyesek vannak, ami sehogy sem jön ki, még akkor se, ha az "#address-cells" 2 és "#size-cells" 1 (és egyébként is, ha igaz, hogy öröklődnek ezek, akkor az "interrupt-controller@40000000" alnode-beli "reg"-nél hogy lehet az "#address-cells" és a "#size-cells" is egyértelműen 1?). Ugyancsak a "dma-ranges"-nél, ott sem hármasok vannak, hanem négyesek. Ez mégis hogy?
Nincs is külön "#address-cells" a node-on, mint ahogy a specifikáció állítása szerint kéne lennie. És különben is, ha az "#address-cells" 2 a "#size-cells" meg 0, akkor is hogy kezdődhetne a számsor a címmel, hisz ez esetben két u32 érték a cím (és a DTB big-endian), szóval az nem 0x0 0x7e000000 lenne? Ha pedig az "#address-cells" és a "#size-cells" is 1, akkor a méret hogy lehetne már 0 és hogy lesz a két cím egy hossz elemből négyes?
És végül az értékek, na ezek sem jönnek ki sehogy se. A specifikáció szerint az alnode-okban a "reg"-beli címek a "ranges"-hez képesti relatív címek.
The ranges property provides a means of defining a mapping or translation between the address space of the bus (the child address space) and the address space of the bus node’s parent (the parent address space).
Namost ez sem jön ki sehogy sem, mert a "interrupt-controller@40000000" node-ban a "reg" propertyben egyértelműen "parent address space"-ben van direktben a cím, és ha hozzáadnám a 0xff800000-át (ugye az utolsó nem-éppen-triplet vonatkozik erre a child címre), akkor hibás eredmény jönne ki.