Module Name:    src
Committed By:   martin
Date:           Mon Jan  1 14:00:17 UTC 2024

Modified Files:
        src/sys/stand/efiboot [netbsd-10]: efinet.c

Log Message:
Additionally pull up following revision(s) (requested by rin in ticket #524):

        sys/stand/efiboot/efinet.c: revision 1.9

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.


To generate a diff of this commit:
cvs rdiff -u -r1.6.32.1 -r1.6.32.2 src/sys/stand/efiboot/efinet.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/stand/efiboot/efinet.c
diff -u src/sys/stand/efiboot/efinet.c:1.6.32.1 src/sys/stand/efiboot/efinet.c:1.6.32.2
--- src/sys/stand/efiboot/efinet.c:1.6.32.1	Sat Dec 30 19:33:25 2023
+++ src/sys/stand/efiboot/efinet.c	Mon Jan  1 14:00:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: efinet.c,v 1.6.32.1 2023/12/30 19:33:25 martin Exp $	*/
+/*	$NetBSD: efinet.c,v 1.6.32.2 2024/01/01 14:00:17 martin 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++;

Reply via email to