[PATCH 3/3] state: support backend-diskuuid / backend-offset

Sascha Hauer sha at pengutronix.de
Thu Jan 27 04:39:24 PST 2022

On Wed, Jan 26, 2022 at 04:18:51PM -0800, Trent Piepho wrote:
> DTS ranges are usually specified as <offset> <length> in one property.
> The sizes of offset and length fields are done with the #address-cells
> and #size-cells of the bus the node is on.  I.e., barebox state
> shouldn't be defining if offsets or lengths are 32 or 64 bits, it
> should/is done by the device the offset or length refers to.
> Like the normal 'reg' property in most nodes for register banks, or
> the various "ranges" properties map an address space in the current
> node to one in another node.
> This backend-diskuuid, backend-offset, and backend-length seems like a
> custom alternative version of a range that is specific to barebox
> state.  Also, if the backend is a partition defined in the dts, then
> the node of the partition specifies its size.  But if the partition is
> found by uuid, then the barebox state device specifies the size of the
> partition.  Seems inconsistent.
> It seems like there should be a better and more consistent way to do this.
> Here's an idea.  Identify the device by uuid and use existing
> fixed-partitions.  Example:
> {
>     compatible = "storage-by-uuid";
>     uuid = "abcd-1234";
>     // Everything below here already exists and is unchanged
>     partitions {
>         compatible = "fixed-partitions";
>         barebox_state: state at 1000 {
>             label = "barebox-state";
>             reg = <0x1000 0x200>;
>         };
>         barebox_env: env at 1200 {
>             label = "barebox-env";
>             reg = <0x1200 0x1000>;
>         };
>     };
> };
> When the top level node here is found, the matching device is located
> by uuid and contents of the node are added to that device.  Adding
> fixed partitions is done the same way it's already done.  The
> difference is we can specify the device by uuid instead of needing to
> locate the path of the exact hardware device.

We discussed this approach internally as well and decided for the way
Michael has implemented it for two reasons. First it is easier to
implement, if not in barebox, but in Linux userspace where we need to
parse that binding as well. Second we don't need another barebox custom
binding when we extend the existing custom binding.

The fact that with the current approach we have to know that an
arbitrary property contains a 64bit value rather than the default 32bit
made me think if the approach of having a compatible =
"storage-by-uuid" driver is really the better one. I know that Ahmad
agrees here as well :)


Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

More information about the barebox mailing list