From: David Gwynne Subject: Re: arm64/efiboot: add mach fwsetup To: tech@openbsd.org Date: Thu, 28 Aug 2025 16:22:40 +1000 On 28/08/2025 14:58, Jonathan Matthew wrote: > This is basically the same diff as for amd64's efiboot. It's only useful > on machines with actual EFI firmware, so things like the Ampere Altra, > Overdrive 1000, etc. u-boot doesn't implement this feature. > > ok? ok > > I notice we don't have a boot/boot.conf man page on arm64. Should we have > one? > > > Index: efiboot/conf.c > =================================================================== > RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/conf.c,v > diff -u -p -u -p -r1.49 conf.c > --- efiboot/conf.c 23 Jun 2024 15:37:31 -0000 1.49 > +++ efiboot/conf.c 28 Aug 2025 03:40:00 -0000 > @@ -47,7 +47,7 @@ > #include "efipxe.h" > #include "softraid_arm64.h" > > -const char version[] = "1.20"; > +const char version[] = "1.21"; > int debug = 0; > > struct fs_ops file_system[] = { > Index: efiboot/efiboot.c > =================================================================== > RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/efiboot.c,v > diff -u -p -u -p -r1.63 efiboot.c > --- efiboot/efiboot.c 13 Jan 2025 16:58:09 -0000 1.63 > +++ efiboot/efiboot.c 28 Aug 2025 03:40:00 -0000 > @@ -44,6 +44,8 @@ > #include "efidt.h" > #include "fdt.h" > > +#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 1ULL > + > EFI_SYSTEM_TABLE *ST; > EFI_BOOT_SERVICES *BS; > EFI_RUNTIME_SERVICES *RS; > @@ -1262,12 +1264,14 @@ retry: > int Xacpi_efi(void); > int Xdtb_efi(void); > int Xexit_efi(void); > +int Xfwsetup_efi(void); > int Xpoweroff_efi(void); > > const struct cmd_table cmd_machine[] = { > { "acpi", CMDT_CMD, Xacpi_efi }, > { "dtb", CMDT_CMD, Xdtb_efi }, > { "exit", CMDT_CMD, Xexit_efi }, > + { "fwsetup", CMDT_CMD, Xfwsetup_efi }, > { "poweroff", CMDT_CMD, Xpoweroff_efi }, > { NULL, 0 } > }; > @@ -1299,6 +1303,44 @@ int > Xexit_efi(void) > { > BS->Exit(IH, 0, 0, NULL); > + for (;;) > + continue; > + return (0); > +} > + > +int > +Xfwsetup_efi(void) > +{ > + UINT64 osind; > + UINTN osind_size = sizeof(osind); > + UINT32 osind_attrs = 0x1 | 0x2 | 0x4; > + EFI_GUID global = EFI_GLOBAL_VARIABLE; > + EFI_STATUS status; > + > + status = RS->GetVariable(L"OsIndicationsSupported", &global, NULL, > + &osind_size, &osind); > + if (status == EFI_NOT_FOUND) { > + printf("not supported on this machine.\n"); > + return (-1); > + } else if (status != EFI_SUCCESS) { > + printf("%s: %d\n", __func__, status); > + return (-1); > + } > + > + if ((osind & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) == 0) { > + printf("not supported on this machine.\n"); > + return (-1); > + } > + > + osind = EFI_OS_INDICATIONS_BOOT_TO_FW_UI; > + status = RS->SetVariable(L"OsIndications", &global, osind_attrs, > + sizeof(osind), &osind); > + if (status != EFI_SUCCESS) { > + printf("%s: %d\n", __func__, status); > + return (-1); > + } > + > + RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); > for (;;) > continue; > return (0); >