
Hi Simon,
On Sun, Nov 19, 2023 at 7:12 PM Simon Glass sjg@chromium.org wrote:
When a USB device is unbound, it causes any bootflows attached to it to be removed, via a call to bootdev_clear_bootflows() from bootdev_pre_unbind(). This obviously makes it impossible to boot the bootflow.
However, when booting a bootflow that relies on USB, usb_stop() is called, which unbinds the device. At that point any information attached to the bootflow is dropped.
This is quite risky since the contents of freed memory are not guaranteed to remain unchanged. Depending on what other options are done before boot, a hard-to-find bug may crop up.
There is no need to unbind all the USB devices just to quiesce them. Add a new usb_pause() call which removes them but leaves them bound.
I am no UEFI / bootloader expert and while trying to gather more info on EFI ExitBootServies I came across this https://github.com/tianocore-docs/edk2-UefiDriverWritersGuide/blob/master/7_...
If I understand this correctly, EFI ( U-boot in this case) should be halting all USB controllers like done in usb_stop() Is my understanding correct?
Kind regards Shantur