On Tue, Dec 03, 2019 at 11:07:36AM +0100, Gerd Hoffmann wrote:
+static int rom_instance;
What is this? Not used anywhere in the patch ...
This is required on calling getRomPriority(). Please check below lines in the patch. boot_add_bev(FLATPTR_TO_SEG(rom), pnp->bev, pnp->productname, getRomPriority(sources, rom, rom_instance++));
I think you can just pass "0" instead of using rom_instance.
I suspect you can even drop the getRomPriority call altogether as it probably isn't going to give any useful results in CSM mode anyway.
The priority value(the last argument we pass to boot_add_bev()) will affect the order of the boot list. The getRomPriority() will calculate the final priority based on the system provided BBS, etc. This is even true in CSM case. If we drop the getRomPriority call and instead do: boot_add_bev(FLATPTR_TO_SEG(rom), pnp->bev, pnp->productname, 0); then this bev entry will be the first boot option in the boot list because hard disk typically has priority larger than 100 (lower priority will be closer to the beginning of the boot list). I'm fine to drop the getRomPriority call and pass 0 to the boot_add_bev() call since I need manually adjust do_boot() logic anyway for my case.
cheers, Gerd