Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FdtBusDxe: consider a setprop like interface. #9

Open
andreiw opened this issue Jan 12, 2024 · 4 comments
Open

FdtBusDxe: consider a setprop like interface. #9

andreiw opened this issue Jan 12, 2024 · 4 comments

Comments

@andreiw
Copy link
Contributor

andreiw commented Jan 12, 2024

Use case is ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.c.

E.g. a driver binding to the RTC device need to disable the RTC device so that the OS always goes through UEFI RT.

Depends on #8

@andreiw
Copy link
Contributor Author

andreiw commented Jan 15, 2024

Consider https://github.com/U-Boot-EFI/EFI_DT_FIXUP_PROTOCOL too, in the sense that a different client-requested tree may be used for fixups. EFI_DT_FIXUP_PROTOCOL can be implemented by FdtBusDxe, the real question is how to push the patching down into DT device drivers (another CB?)

@andreiw
Copy link
Contributor Author

andreiw commented Feb 16, 2024

RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashDeviceTreeLib.c is another good example where this would be useful functionaly.

@andreiw
Copy link
Contributor Author

andreiw commented Feb 18, 2024

One major problem is that setprop (FdtClient->SetNodeProperty as called by VirtNorFlashPlatformLib) is destructive to the devicetree. Node offsets get changed, so every DtDevice becomes invalid.

So if an interface is added, it should not modify the in-use Devicetree. The updates could be pended, and stored as "command" /path/to/node" "property" "value". This would work well with something like EFI_DT_FIXUP_PROTOCOL, too, in that they could be applied to arbitrary (but similar enough) trees.

The DT should be installed in the ConfigurationTable at EFI_EVENT_GROUP_AFTER_READY_TO_BOOT. That is, a copy of the active DT with the updates applied.

@andreiw
Copy link
Contributor Author

andreiw commented Feb 18, 2024

OnPlatformHasDeviceTree needs to register a EFI_EVENT_GROUP_AFTER_READY_TO_BOOT event. Also OnPlatformHasDeviceTree should be renamed to "OnDevicetreeExposedToOs" or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant