Module Name:    src
Committed By:   jmcneill
Date:           Tue Sep 28 11:37:45 UTC 2021

Modified Files:
        src/sys/stand/efiboot: Makefile.efiboot boot.c efiboot.c efiboot.h
            version

Log Message:
efiboot: Add support for changing the video mode.

Add a new "gop" command that can query the list of available video modes.
With a mode number as argument (eg. "gop 16"), the new display mode will
be selected.

The "version" command prints the current display mode.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.36 -r1.37 src/sys/stand/efiboot/boot.c
cvs rdiff -u -r1.20 -r1.21 src/sys/stand/efiboot/efiboot.c
cvs rdiff -u -r1.16 -r1.17 src/sys/stand/efiboot/efiboot.h
cvs rdiff -u -r1.28 -r1.29 src/sys/stand/efiboot/version

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/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.22 src/sys/stand/efiboot/Makefile.efiboot:1.23
--- src/sys/stand/efiboot/Makefile.efiboot:1.22	Sun Jun 20 19:10:47 2021
+++ src/sys/stand/efiboot/Makefile.efiboot	Tue Sep 28 11:37:45 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.22 2021/06/20 19:10:47 jmcneill Exp $
+# $NetBSD: Makefile.efiboot,v 1.23 2021/09/28 11:37:45 jmcneill Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -24,8 +24,8 @@ SOURCES=	crt0-efi-${GNUEFIARCH}.S reloc_
 SOURCES+=	boot.c bootmenu.c conf.c console.c dev_net.c devopen.c exec.c \
 		module.c overlay.c panic.c prompt.c
 SOURCES+=	efiboot.c efichar.c efidev.c efigetsecs.c efifdt.c \
-		efifile.c efiblock.c efinet.c efipxe.c efiacpi.c efirng.c efiwatchdog.c \
-	       	smbios.c
+		efifile.c efiblock.c efinet.c efipxe.c efiacpi.c efirng.c \
+		efiwatchdog.c efigop.c smbios.c
 
 .PATH: ${S}/external/bsd/libfdt/dist
 CPPFLAGS+=	-I${S}/external/bsd/libfdt/dist

Index: src/sys/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.36 src/sys/stand/efiboot/boot.c:1.37
--- src/sys/stand/efiboot/boot.c:1.36	Tue Sep  7 11:41:31 2021
+++ src/sys/stand/efiboot/boot.c	Tue Sep 28 11:37:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.36 2021/09/07 11:41:31 nia Exp $	*/
+/*	$NetBSD: boot.c,v 1.37 2021/09/28 11:37:45 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <non...@netbsd.org>
@@ -99,6 +99,7 @@ void	command_modules(char *);
 void	command_load(char *);
 void	command_unload(char *);
 void	command_ls(char *);
+void	command_gop(char *);
 void	command_mem(char *);
 void	command_menu(char *);
 void	command_reset(char *);
@@ -118,6 +119,7 @@ const struct boot_command commands[] = {
 	{ "load",	command_load,		"load <module_name>" },
 	{ "unload",	command_unload,		"unload <module_name>" },
 	{ "ls",		command_ls,		"ls [hdNn:/path]" },
+	{ "gop",	command_gop,		"gop [mode]" },
 	{ "mem",	command_mem,		"mem" },
 	{ "menu",	command_menu,		"menu" },
 	{ "reboot",	command_reset,		"reboot|reset" },
@@ -290,6 +292,20 @@ command_ls(char *arg)
 }
 
 void
+command_gop(char *arg)
+{
+	UINT32 mode;
+
+	if (!arg || !*arg) {
+		efi_gop_dump();
+		return;
+	}
+
+	mode = atoi(arg);
+	efi_gop_setmode(mode);
+}
+
+void
 command_mem(char *arg)
 {
 	EFI_MEMORY_DESCRIPTOR *md, *memmap;
@@ -347,6 +363,7 @@ command_version(char *arg)
 	efi_acpi_show();
 	efi_rng_show();
 	efi_md_show();
+	efi_gop_show();
 }
 
 void

Index: src/sys/stand/efiboot/efiboot.c
diff -u src/sys/stand/efiboot/efiboot.c:1.20 src/sys/stand/efiboot/efiboot.c:1.21
--- src/sys/stand/efiboot/efiboot.c:1.20	Fri Jun 26 03:23:04 2020
+++ src/sys/stand/efiboot/efiboot.c	Tue Sep 28 11:37:45 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: efiboot.c,v 1.20 2020/06/26 03:23:04 thorpej Exp $ */
+/* $NetBSD: efiboot.c,v 1.21 2021/09/28 11:37:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcne...@invisible.ca>
@@ -98,6 +98,7 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS
 	efi_file_system_probe();
 	efi_block_probe();
 	efi_rng_probe();
+	efi_gop_probe();
 
 	boot();
 

Index: src/sys/stand/efiboot/efiboot.h
diff -u src/sys/stand/efiboot/efiboot.h:1.16 src/sys/stand/efiboot/efiboot.h:1.17
--- src/sys/stand/efiboot/efiboot.h:1.16	Tue Sep  7 11:41:31 2021
+++ src/sys/stand/efiboot/efiboot.h	Tue Sep 28 11:37:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.16 2021/09/07 11:41:31 nia Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.17 2021/09/28 11:37:45 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <non...@netbsd.org>
@@ -106,6 +106,12 @@ bool efi_pxe_match_booted_interface(cons
 /* efiwatchdog.c */
 void efi_set_watchdog(uint32_t, uint64_t);
 
+/* efigop.c */
+void efi_gop_probe(void);
+void efi_gop_show(void);
+void efi_gop_dump(void);
+void efi_gop_setmode(UINT32);
+
 /* exec.c */
 int exec_netbsd(const char *, const char *);
 

Index: src/sys/stand/efiboot/version
diff -u src/sys/stand/efiboot/version:1.28 src/sys/stand/efiboot/version:1.29
--- src/sys/stand/efiboot/version:1.28	Sun Aug  8 21:50:10 2021
+++ src/sys/stand/efiboot/version	Tue Sep 28 11:37:45 2021
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.28 2021/08/08 21:50:10 andvar Exp $
+$NetBSD: version,v 1.29 2021/09/28 11:37:45 jmcneill Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -31,3 +31,4 @@ is taken as the current.
 2.8:	Add bi-endian disklabel and FFS support.
 2.9:	Watchdog support.
 2.10:	Use disk I/O protocol for block devices.
+2.11:	Add support for changing the video mode.

Reply via email to