I don't understand #size-cells = <0>

Benjamin Herrenschmidt benh at kernel.crashing.org
Mon Feb 5 10:43:05 EST 2007


On Wed, 2007-01-31 at 16:22 -0800, Andrew Klossner wrote:
> I'm porting the kernel to an 8548-based board whose boot loader does
> not provide a device tree, so I'm rolling my own.
> 
> Rev 0.5 of booting-without-of.txt says:
> 
> 	"reg" properties are always a tuple of the type "address size"
> 	where the number of cells of address and size is specified by
> 	the bus #address-cells and #size-cells.
> 
> but in the examples, we see
> 
> 		reg = <22000 1000>;
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 
> The number of cells of address is 1.  The number of cells of size is 0.
> 1+0=1, so how can the reg property have a tuple of size 2?

Regardless of #size-cell of #address-cell, you are getting one basic
assumption wrong: those properties don't apply to the node itself but to
-children- of that node.

They are typically in a bus node to define the format of the "reg"
properties of nodes -under- that bus node.

Now, there are a few cases where #size-cells is 0, mostly it is an
unofficial and common way to say that devices on that bus aren't mmio
mapped. For example, take an i2c bus. Devices decode one and only one
address (ok, maybe 2, but the concept of "range" is irrelevant) and
there is no direct MMIO translation. This is typically a case where
#size-cells is 0. Another common example is /cpus (which is the parent
for all cores in the system). The cpus themselves have a reg property
that contain their physical ID, there is no concept of ranges of
addresses, thus #size-cell is 0.

Ben.





More information about the Linuxppc-dev mailing list