Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD still fails to boot on a MacBook7,1



On Sat, 20 Dec 2025, Greg A. Woods wrote:

At Sat, 20 Dec 2025 12:24:03 +0000 (UTC), RVP <rvp%SDF.ORG@localhost> wrote:
Subject: Re: NetBSD still fails to boot on a MacBook7,1

Looking at that screenshot again however, it still looks very much like what
would happen if there was some mis-agreement between the bootloader and the
kernel.

The bootloader seems to be running with the default mini vga emulation
done by the EFI firmware.


Can you please try the patch below? I'd also like to see what the exact output
of a `gop' command looks like with the patch.

-RVP

---START---
--- src/sys/arch/i386/stand/efiboot/eficons.c.orig	2025-10-16 04:13:16.379365256 +0000
+++ src/sys/arch/i386/stand/efiboot/eficons.c	2026-11-16 15:48:44.574717565 +0000
@@ -480,36 +480,30 @@
 	EFI_STATUS status;
 	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
 	struct btinfo_framebuffer fb;
-	INT32 bestmode;
-	UINTN sz;
+	INT32 bestmode, curmode;

 	if (efi_gop == NULL)
 		goto nofb;

+	curmode = efi_gop->Mode->Mode;
+
 	if (efi_gop_mode >= 0) {
 		bestmode = efi_gop_mode;
 	} else {
-		/* If a mode has not been selected, choose a default */
-		bestmode = efi_find_gop_mode(DEFAULT_GOP_MODE);
-		if (bestmode == -1)
-			bestmode = FALLBACK_GOP_MODE;
+		bestmode = curmode;
 	}

-	status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,
-	    bestmode);
-	if (EFI_ERROR(status) || efi_gop->Mode->Mode != bestmode) {
-		printf("GOP setmode failed: %" PRIxMAX "\n",
-		    (uintmax_t)status);
-		goto nofb;
+	if (efi_gop_mode != bestmode) {
+		status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,
+		    bestmode);
+		if (EFI_ERROR(status) || efi_gop->Mode->Mode != bestmode) {
+			printf("GOP setmode failed: %" PRIxMAX "\n",
+			    (uintmax_t)status);
+			(void)uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop, curmode);
+		}
 	}

-	status = uefi_call_wrapper(efi_gop->QueryMode, 4,
-	    efi_gop, bestmode, &sz, &info);
-	if (EFI_ERROR(status)) {
-		printf("GOP querymode failed: %" PRIxMAX "\n",
-		    (uintmax_t)status);
-		goto nofb;
-	}
+	info = efi_gop->Mode->Info;

 	memset(&fb, 0, sizeof(fb));
 	fb.physaddr = efi_gop->Mode->FrameBufferBase;
@@ -661,9 +655,7 @@
 		if (EFI_ERROR(status))
 			continue;

-		printf("%c%d: %dx%d ",
-		    memcmp(info, efi_gop->Mode->Info, sizeof(*info)) == 0 ?
-		      '*' : ' ',
+		printf("%c%d: %dx%d ", efi_gop->Mode->Mode == i ? '*' : ' ',
 		      i, info->HorizontalResolution, info->VerticalResolution);
 		switch (info->PixelFormat) {
 		case PixelRedGreenBlueReserved8BitPerColor:
---END---


Home | Main Index | Thread Index | Old Index