Created attachment 163324 [details]
boot1.efi remove ConsoleControl
The ConsoleControl->SetMode in boot1.efi breaks booting freebsd correctly on my machines (HP 840G1 and HP 840G2).
The console during boot1.efi and loader.efi isn't setup correctly, neither is the framebuffer which means when kernel starts, display is garbage.
After some research I've found that ConsoleControl isn't part of the UEFI specs but was only on the EDK implementation (there is a bug on grub about this).
I suspect that HP firmware incorrectly implement it. i.e.: The LocateProtocol works but the SetMode screw things up.
With this patch I can correctly boot FreeBSD on my HP 840 machines and also on my Samsung 870Z.
Thank you for your contribution!
Unfortunately just removing the SetMode is no good, because with other UEFI implementations the display is not set up correctly for us at boot and the loader output does not work w/o it.
As you point out we should handle the case that ConsoleControl is not implemented (we just skip the SetMode if LocateProtocol fails), so this suggests that the failing systems here implement a broken ConsoleControl.
It looks like we may need a blacklist of broken systems (or a whitelist of systems that implement & require ConsoleControl).
I've noticed that after. I've sent a mail to hacker@ (https://lists.freebsd.org/pipermail/freebsd-hackers/2015-November/048639.html).
As said on my second mail, removing the mode selection and the reset of the conout resolves the problem.
I had another idea of what could be wrong, it could be that setting the mode to text strictly disable the graphical mode so I tested to set the mode to graphical just before calling ExitBootService but this doesn't change anything.
Maybe we can just remove the reset/mode change ? The console is cleared after and since the number of lines are hardcoded to 24 by default maybe it's sane to leave the text mode to 80x25 for now ?
I wrote another patch bug #207940 which removes ConsoleControl dependency (and add boot partition selection) from boot1.efi. I'm grad if you try that.