MI efiboot: Revert "Stop using efi_bootdp after exclusive open for PXE"

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/stand/efiboot/efinet.c#rev1.7

Some UEFI implementations pass multiple boot options as boot device path,
and NULL-clearing it results in boot failures.

Thanks skrll@ for pointing it out.
This commit is contained in:
rin 2024-01-01 13:38:57 +00:00
parent 5a6163e80d
commit 71d224f4ab
1 changed files with 3 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: efinet.c,v 1.8 2023/12/27 09:40:35 rin Exp $ */
/* $NetBSD: efinet.c,v 1.9 2024/01/01 13:38:57 rin Exp $ */
/*-
* Copyright (c) 2001 Doug Rabson
@ -333,7 +333,7 @@ efi_net_probe(void)
EFI_STATUS status;
UINTN i, nhandles;
int nifs, depth = -1;
bool found, is_bootdp;
bool found;
status = LibLocateHandle(ByProtocol, &SimpleNetworkProtocol, NULL,
&nhandles, &handles);
@ -377,9 +377,6 @@ efi_net_probe(void)
if (!found)
continue;
is_bootdp = depth > 0 &&
efi_device_path_ncmp(efi_bootdp, dp0, depth) == 0;
status = uefi_call_wrapper(BS->OpenProtocol, 6, handles[i],
&SimpleNetworkProtocol, (void **)&net, IH, NULL,
EFI_OPEN_PROTOCOL_EXCLUSIVE);
@ -407,21 +404,10 @@ efi_net_probe(void)
return;
}
if (is_bootdp) {
/*
* This is boot device...
*/
if (depth > 0 && efi_device_path_ncmp(efi_bootdp, dp0, depth) == 0) {
char devname[9];
snprintf(devname, sizeof(devname), "net%u", nifs);
set_default_device(devname);
/*
* and now opened for us excluively. Therefore,
* access via device path is illegal.
*/
efi_bootdp = NULL;
depth = -1;
}
nifs++;