Bug 204674

Summary: [PATCH] boot1.efi remove consolecontrol as it's not in the UEFI specs
Product: Base System Reporter: Emmanuel Vadot <manu>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Some People CC: bcran, emaste, nao
Priority: --- Keywords: patch, uefi
Version: CURRENT   
Hardware: amd64   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231724
Description Flags
boot1.efi remove ConsoleControl none

Description Emmanuel Vadot 2015-11-19 10:53:03 UTC
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.

Comment 1 Ed Maste freebsd_committer 2015-11-19 16:45:18 UTC
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).
Comment 2 Emmanuel Vadot 2015-11-19 16:55:02 UTC

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 ?
Comment 3 Naomichi Nonaka 2016-03-17 14:39:39 UTC

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.