On Fri, Feb 21, 2020 at 02:09:07PM +0900, YASUOKA Masahiko wrote:
> Hello,
> 
> I am testing a new hardware, HPE DL20 Gen10.
> 
> When efiboot starts the kernel, the video display becomes distorted
> and never recovered until CPU reset.
> 
> Our kernel tries to initialized console twice, first trial is done
> before getting boot info and second trial is done after getting boot
> info.  Since EFI framebuffer needs "boot info", it is initialized on
> second trial.
> 
> On HPE DL20 Gen10, probing vga is succeeded on first trial, the kernel
> selects vga for the console, but actually it is broken.  On usual
> machines which boot with EFI, the problem doesn't happen since they
> have no vga.
> 
> The diff following fixes the problem by initializing efifb console
> even if the VGA is probed.
> 
> # Also, HP DL20 Gen10 has "UEFI optimized boot" setting on BIOS and
> # disabling the setting avoids the problem happening.  But since the
> # setting seems to be for old Windows, I think we should fix our
> # kernel.
> 
> comment? ok?

Is there a way to detect efi or bios before boot info is set?
Ideally vga_cnattach() would never be called when booting via efi.

Should the cninit() before the boot args are parsed be removed and just
have cninit() unconditionally after?  This would make the debug printfs
in boot arg passing useless, but they already wouldn't work when booting
via efi.

> 
> Initialize efifb as a console even if the VGA is probed.
> 
> Index: sys/arch/amd64/amd64/wscons_machdep.c
> ===================================================================
> RCS file: /var/cvs/openbsd/src/sys/arch/amd64/amd64/wscons_machdep.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 wscons_machdep.c
> --- sys/arch/amd64/amd64/wscons_machdep.c     14 Oct 2017 04:44:43 -0000      
> 1.14
> +++ sys/arch/amd64/amd64/wscons_machdep.c     21 Feb 2020 04:42:38 -0000
> @@ -73,7 +73,7 @@
>  #include <machine/efifbvar.h>
>  #endif
>  
> -int  wscn_video_init(void);
> +int  wscn_video_init(int);
>  void wscn_input_init(int);
>  
>  cons_decl(ws);
> @@ -103,10 +103,12 @@ wscninit(struct consdev *cp)
>  {
>       static int initted = 0;
>  
> -     if (initted)
> +     if (initted) {
> +             wscn_video_init(1);
>               return;
> +     }
>  
> -     if (wscn_video_init() == 0) {
> +     if (wscn_video_init(0) == 0) {
>               initted = 1;
>               wscn_input_init(0);
>       }
> @@ -134,11 +136,17 @@ wscnpollc(dev_t dev, int on)
>   * Configure the display part of the console.
>   */
>  int
> -wscn_video_init(void)
> +wscn_video_init(int pass)
>  {
>  #if (NEFIFB > 0)
> -     if (efifb_cnattach() == 0)
> -             return (0);
> +     extern int vgaconsole;
> +     if (pass > 0) {
> +             if (efifb_cnattach() == 0) {
> +                     vgaconsole = 0;
> +                     return (0);
> +             }
> +             return (-1);
> +     }
>  #endif
>  #if (NVGA > 0)
>       if (vga_cnattach(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM, -1, 1) == 0)
> 
> 

Reply via email to