From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by mx.groups.io with SMTP id smtpd.web10.5156.1630485956234150668 for ; Wed, 01 Sep 2021 01:45:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=ARh0asmD; spf=none, err=SPF record not found (domain: semihalf.com, ip: 209.85.160.176, mailfrom: gjb@semihalf.com) Received: by mail-qt1-f176.google.com with SMTP id c19so1918298qte.7 for ; Wed, 01 Sep 2021 01:45:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5YUO3wgG0KaFDSNjfeW0xEVbhRAWUa5TXCF0KNbHsd0=; b=ARh0asmDU0vXMDUvUVaK36A3VA/2yPWY2VLGJIK8kPZYABwmIMLATYG8Cuk1SnVufD +/sW1C8IWdxQvfuKM3nrEvvRyFWxaG6Cdpv4sJSRr0HP33J9ekQKgdRLo2Yuz946jG6f My0tLMyuOpqgyTeKeDAXuRseuOI+WSwEtl5fS7OyCqISHtz+MXXDEdcoafbNJycgX5uO x+Fm+6t+2z6Vet2Mxqo3IYPypnSwP8wxrvABMtgWm7g3nV4TJG4jE4xExFGOA0vz3PIs otB2AhCOWcCCFoPyy2m69zEp9W6BhzmB65PLQBfRuCegqZKFuM+e0qDWSJcxuNF3ePhX jJSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=5YUO3wgG0KaFDSNjfeW0xEVbhRAWUa5TXCF0KNbHsd0=; b=JX3rxuB0dacJJv2fuLOiDVJvbhcKm9kcRYy6AaTy2AB/vsf7j+ER9SeqQI4jo3u+C1 95TsJ6zIMfffwqL+DfRUVUdkoFaKYAz8MfC1vti9Ad7362ynWhPc6fJ9ghqRf0/Exl+Y /Cn8l6LFkWqcj5JFWUt5Z8Y9ftGVpjTq2v4zofZ0CdrShGl32wt4o5wgjXNq/qgOYixK /t2V3HmHLGcZHu58slOd4uMrHVuOcR9nEuZgofLFJ7/JokG6vBMiaAnU8LphOEQ/cEQY b+wOknHpvJ7uNRYLwqIjcwoBVnSccF7Xr7RkTUeDGHpkQluslRwXE6OQShKXi/vzf37w vp7w== X-Gm-Message-State: AOAM533JGidhjfy7UVQQ9bhLv8X/nsKcUGRd1KQq1tAeMC1HpcSAhKsH ljkVOJa0SGaSNHR5EV3EHqcVFjBZ980cde46Zt76Sw== X-Google-Smtp-Source: ABdhPJxGwz/20NVNGyyo/ysKgfr1rpCThGfzf2ugrrYHevVk19/IVtmfeIA59CQzcn8S0+CphXpvxBiKiQfhc86GlX8= X-Received: by 2002:ac8:7352:: with SMTP id q18mr7182836qtp.5.1630485955108; Wed, 01 Sep 2021 01:45:55 -0700 (PDT) MIME-Version: 1.0 References: <20210818073811.3571796-1-gjb@semihalf.com> In-Reply-To: From: "Grzegorz Bernacki" Date: Wed, 1 Sep 2021 10:45:44 +0200 Message-ID: Subject: Re: [edk2-platforms PATCH] Platform/RaspberryPi: Check for Boot Discovery Policy change. To: Ard Biesheuvel Cc: edk2-devel-groups-io , Leif Lindholm , Ard Biesheuvel , Samer El-Haj-Mahmoud , Sunny Wang , Marcin Wojtas , upstream@semihalf.com, Pete Batard Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Ard, The problem is that for some reason EfiBootManagerRefreshAllBootOption () overwrites BootOrder. For example, if USB bootable device is removed from the top and added at the bottom of the list. I will debug the problem further, however this patch is needed to retain correct boot order unless I find the root cause of the problem. thanks, greg wt., 31 sie 2021 o 14:11 Ard Biesheuvel napisa=C5=82(a): > > On Wed, 18 Aug 2021 at 09:38, Grzegorz Bernacki wrote: > > > > This patch adds checks if Boot Discovery Policy has been > > changed. Only in that case EfiBootManagerRefreshAllBootOption() > > should be called. > > > > Signed-off-by: Grzegorz Bernacki > > To be honest, I'm not a fan of this bodge. Can you explain why we need > two separate EFI variables to keep track of this state? > > > > --- > > Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c | 24 = +++++++++++++++++++- > > 1 file changed, 23 insertions(+), 1 deletion(-) > > > > diff --git a/Platform/RaspberryPi/Library/PlatformBootManagerLib/Platfo= rmBm.c b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c > > index c8305ce4f5..378ba0ebf4 100644 > > --- a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c > > +++ b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c > > @@ -617,6 +617,7 @@ BootDiscoveryPolicyHandler ( > > { > > EFI_STATUS Status; > > UINT32 DiscoveryPolicy; > > + UINT32 DiscoveryPolicyOld; > > UINTN Size; > > EFI_BOOT_MANAGER_POLICY_PROTOCOL *BMPolicy; > > EFI_GUID *Class; > > @@ -678,7 +679,28 @@ BootDiscoveryPolicyHandler ( > > return Status; > > } > > > > - EfiBootManagerRefreshAllBootOption(); > > + // > > + // Refresh Boot Options if Boot Discovery Policy has been changed > > + // > > + Size =3D sizeof (DiscoveryPolicyOld); > > + Status =3D gRT->GetVariable ( > > + BOOT_DISCOVERY_POLICY_OLD_VAR, > > + &gBootDiscoveryPolicyMgrFormsetGuid, > > + NULL, > > + &Size, > > + &DiscoveryPolicyOld > > + ); > > + if ((Status =3D=3D EFI_NOT_FOUND) || (DiscoveryPolicyOld !=3D Discov= eryPolicy)) { > > + EfiBootManagerRefreshAllBootOption(); > > + > > + Status =3D gRT->SetVariable ( > > + BOOT_DISCOVERY_POLICY_OLD_VAR, > > + &gBootDiscoveryPolicyMgrFormsetGuid, > > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVI= CE_ACCESS, > > + sizeof (DiscoveryPolicyOld), > > + &DiscoveryPolicy > > + ); > > + } > > > > return EFI_SUCCESS; > > } > > -- > > 2.25.1 > >