Page MenuHomeFreeBSD

Enable OF_setprop API function to add property in FDT
ClosedPublic

Authored by mw on Aug 5 2017, 10:17 AM.
Tags
Referenced Files
Unknown Object (File)
Wed, Oct 30, 12:51 PM
Unknown Object (File)
Sep 30 2024, 1:38 AM
Unknown Object (File)
Sep 19 2024, 3:19 PM
Unknown Object (File)
Sep 18 2024, 11:57 AM
Unknown Object (File)
Aug 30 2024, 9:38 AM
Unknown Object (File)
Aug 28 2024, 5:04 PM
Unknown Object (File)
Aug 14 2024, 6:59 AM
Unknown Object (File)
Aug 11 2024, 2:16 AM

Details

Summary

This patch modifies function ofw_fdt_setprop (called by OF_setprop),
so that it can add property, when replacing is not possible.
Adding property is needed to fixup FDT's that have missing
properties.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

manu edited edge metadata.

Add Nathan as he is the maintainer of ofw.

Hi @nwhitehorn - do you have any objections to the patch?

Is this expected to actually work with FDT? I had thought the limitation was just that there is no free space in our FDTs, and we don't reallocate them, so that -- in general -- you can't add properties. You certainly can't on my hardware.

Could you elaborate a little on what you want to do here? In general, I think we should treat FDTs as immutable things given by God rather than applying "fix ups" to them, but there are exceptions of course.

Is this expected to actually work with FDT? I had thought the limitation was just that there is no free space in our FDTs, and we don't reallocate them, so that -- in general -- you can't add properties. You certainly can't on my hardware.

When aligning device trees between Linux (sys/gnu/dts/arm) and FreeBSD
(for now in sys/boot/fdt/dts/arm) we came up on a problem that a
certain boolean property is fixed-up in Linux code, so we were forced
to remove it from DT. It came out that fdt_setprop handles all
resizing and adding new property into the device tree (see
_fdt_add_property in fdt_setprop()).

Could you elaborate a little on what you want to do here? In general, I think we should treat FDTs as immutable things given by God rather than applying "fix ups" to them, but there are exceptions of course.

For now we found other way to avoid DT differences, so eventually
fix-ups were not necessary. However for the first version of the
patchset all worked fine (i.e. adding new properties and further
processing them by drivers). I think that this improvement can be
useful, but now I don't insist at all. Please let know your opinion.

Thanks,
Marcin

Hi @nwhitehorn - do you think we can merge the patch, given my last information provided?

Yes, I think that's fine. Sorry for the delay. Insofar as we keep this API existing, it should work properly and this patch helps achieve that. Please be careful using it, and, if you have some spare cycles, it would be worth thinking about how to make it more reliable still.

This revision is now accepted and ready to land.Aug 9 2017, 2:42 PM

Thanks. I agree, it's not perfect but makes ofw_fdt_setprop usable, given current functions we have in hand in the OS.

This revision was automatically updated to reflect the committed changes.