svn commit: r338437 - in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include conf dev/efidev modules/efirt sys

Conrad Meyer cem at freebsd.org
Tue Sep 4 16:53:33 UTC 2018


Hi Konstantin,

On Sun, Sep 2, 2018 at 2:37 PM, Konstantin Belousov <kib at freebsd.org> wrote:
> Author: kib
> Date: Sun Sep  2 21:37:05 2018
> New Revision: 338437
> URL: https://svnweb.freebsd.org/changeset/base/338437
>
> Log:
>   Catch exceptions during EFI RT calls on amd64.
>
>   This appeared to be required to have EFI RT support and EFI RTC
>   enabled by default, because there are too many reports of faulting
>   calls on many different machines.  The knob is added to leave the
>   exceptions unhandled to allow to debug the actual bugs.
> ...
>
> Modified: head/sys/dev/efidev/efirt.c
> ==============================================================================
> --- head/sys/dev/efidev/efirt.c Sun Sep  2 21:16:43 2018        (r338436)
> +++ head/sys/dev/efidev/efirt.c Sun Sep  2 21:37:05 2018        (r338437)
> ...
> @@ -346,30 +413,35 @@ efi_get_time_capabilities(struct efi_tmcap *tmcap)
>  int
>  efi_reset_system(void)
>  {
> -       int error;
> +       struct efirt_callinfo ec;
>
> -       error = efi_enter();
> -       if (error != 0)
> -               return (error);
> -       efi_runtime->rt_reset(EFI_RESET_WARM, 0, 0, NULL);
> -       efi_leave();
> -       return (EIO);
> +       if (efi_runtime == NULL)
> +               return (ENXIO);
> +       bzero(&ec, sizeof(ec));
> +       ec.ec_name = "rt_reset";
> +       ec.ec_argcnt = 4;
> +       ec.ec_arg1 = (uintptr_t)EFI_RESET_WARM;
> +       ec.ec_arg1 = (uintptr_t)0;
> +       ec.ec_arg1 = (uintptr_t)0;
> +       ec.ec_arg1 = (uintptr_t)NULL;

Coverity warns about ec_arg1 being overwritten before use — should
these be ec_arg2, 3, 4?  CID 1395456.

> +       ec.ec_fptr = EFI_RT_METHOD_PA(rt_reset);
> +       return (efi_call(&ec));
>  }

Best,
Conrad


More information about the svn-src-all mailing list