CVS commit: src/sys/arch/i386/stand/efiboot

2023-09-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 14 03:05:15 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/eficons.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2023-09-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 14 03:05:15 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/eficons.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/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.13 src/sys/arch/i386/stand/efiboot/eficons.c:1.14
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.13	Mon Jul 24 01:56:59 2023
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Thu Sep 14 03:05:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.13 2023/07/24 01:56:59 rin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.14 2023/09/14 03:05:15 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,6 +26,7 @@
  * SUCH DAMAGE.
  */
 
+#include 
 #include 
 #include 
 



Re: CVS commit: src/sys/arch/i386/stand/efiboot

2023-07-24 Thread Rin Okuyama

On 2023/07/24 16:14, matthew green wrote:

"Rin Okuyama" writes:

Module Name:src
Committed By:   rin
Date:   Mon Jul 24 01:56:59 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot: eficpufunc.c eficpufunc.h

Log Message:
efiboot/x86: Add serial console support via raw I/O port access


thanks!  this makes efiboot capable of replacing bios on many
of my test systems that can use serial console (and often do.)


Thank you too for your feedback! I'm glad to hear that :)

rin


re: CVS commit: src/sys/arch/i386/stand/efiboot

2023-07-24 Thread matthew green
"Rin Okuyama" writes:
> Module Name:  src
> Committed By: rin
> Date: Mon Jul 24 01:56:59 UTC 2023
>
> Modified Files:
>   src/sys/arch/i386/stand/efiboot: Makefile.efiboot eficons.c
> Added Files:
>   src/sys/arch/i386/stand/efiboot: eficpufunc.c eficpufunc.h
>
> Log Message:
> efiboot/x86: Add serial console support via raw I/O port access

thanks!  this makes efiboot capable of replacing bios on many
of my test systems that can use serial console (and often do.)


.mrg.


CVS commit: src/sys/arch/i386/stand/efiboot

2023-07-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 24 01:56:59 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot: eficpufunc.c eficpufunc.h

Log Message:
efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.

``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.

Proposed as PR port-amd64/57523


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/eficpufunc.c \
src/sys/arch/i386/stand/efiboot/eficpufunc.h

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



CVS commit: src/sys/arch/i386/stand/efiboot

2023-07-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 24 01:56:59 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot: eficpufunc.c eficpufunc.h

Log Message:
efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.

``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.

Proposed as PR port-amd64/57523


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/eficpufunc.c \
src/sys/arch/i386/stand/efiboot/eficpufunc.h

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.21 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.22
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.21	Sat Jun  3 08:52:56 2023
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Mon Jul 24 01:56:59 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.21 2023/06/03 08:52:56 lukem Exp $
+# $NetBSD: Makefile.efiboot,v 1.22 2023/07/24 01:56:59 rin Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -14,9 +14,11 @@ AFLAGS.start.S= ${${ACTIVE_CC} == "clang
 
 SOURCES= start.S boot.c conf.c devopen.c dev_net.c self_reloc.c panic.c
 SOURCES+= efiboot.c efichar.c eficons.c efidelay.c efidev.c
+SOURCES+= eficpufunc.c
 SOURCES+= efidisk.c efidisk_ll.c efigetsecs.c efimemory.c
 SOURCES+= efinet.c efipxe.c
 LIBI386SRCS= biosdisk.c bootinfo.c bootinfo_biosgeom.c bootmenu.c
+LIBI386SRCS+= comio_direct.c
 LIBI386SRCS+= diskbuf.c exec.c menuutils.c parseutils.c pread.c
 LIBI386SRCS+= exec_multiboot1.c exec_multiboot2.c
 # use our own nfs implementation

Index: src/sys/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.12 src/sys/arch/i386/stand/efiboot/eficons.c:1.13
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.12	Thu Oct 28 06:13:13 2021
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Mon Jul 24 01:56:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.12 2021/10/28 06:13:13 kim Exp $	*/
+/*	$NetBSD: eficons.c,v 1.13 2023/07/24 01:56:59 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -29,6 +29,8 @@
 #include 
 #include 
 
+#include 
+
 #include "efiboot.h"
 
 #include "bootinfo.h"
@@ -60,6 +62,8 @@ static u_char serbuf[16];
 static int serbuf_read = 0;
 static int serbuf_write = 0;
 
+static int raw_com_addr = 0;
+
 static void eficons_init_video(void);
 static void efi_switch_video_to_text_mode(void);
 
@@ -76,6 +80,12 @@ static int efi_com_putc(int);
 static int efi_com_status(int);
 static int efi_com_waitforinputevent(uint64_t);
 
+static int raw_com_init(int, int);
+static int raw_com_getc(void);
+static int raw_com_putc(int);
+static int raw_com_status(int);
+static int raw_com_waitforinputevent(uint64_t);
+
 static int efi_find_gop_mode(char *);
 
 static int iodev;
@@ -134,11 +144,8 @@ ok:
 	case CONSDEV_COM3:
 		iodev = dev;
 		btinfo_console.addr = ioport;
-		if (btinfo_console.addr == 0) {
-			if (!efi_valid_com(iodev))
-goto nocom;
+		if (btinfo_console.addr == 0)
 			btinfo_console.addr = getcomaddr(iodev - CONSDEV_COM0);
-		}
 		if (speed != 0)
 			btinfo_console.speed = speed;
 		efi_com_init(btinfo_console.addr, btinfo_console.speed);
@@ -149,8 +156,6 @@ ok:
 	case CONSDEV_COM2KBD:
 	case CONSDEV_COM3KBD:
 		iodev = dev - CONSDEV_COM0KBD + CONSDEV_COM0;
-		if (!efi_valid_com(iodev))
-			goto nocom;
 		btinfo_console.addr = getcomaddr(iodev - CONSDEV_COM0);
 
 		efi_cons_putc('0' + iodev - CONSDEV_COM0);
@@ -869,7 +874,7 @@ efi_com_init(int addr, int speed)
 		return 0;
 
 	if (!efi_valid_com(iodev))
-		return 0;
+		return raw_com_init(addr, speed);
 
 	serio = serios[iodev - CONSDEV_COM0];
 
@@ -885,6 +890,7 @@ efi_com_init(int addr, int speed)
 		}
 	}
 
+	raw_com_addr = 0;
 	default_comspeed = speed;
 	internal_getchar = efi_com_getc;
 	internal_putchar = efi_com_putc;
@@ -1019,3 +1025,65 @@ efi_com_waitforinputevent(uint64_t timeo
 		return ETIMEDOUT;
 	return EINVAL;
 }
+
+static int
+raw_com_init(int addr, int speed)
+{
+
+	if (addr == 0 || speed <= 0)
+		return 0;
+
+	speed = cominit_d(addr, speed);
+
+	raw_com_addr = addr;
+	default_comspeed = speed;
+	internal_getchar = raw_com_getc;
+	internal_putchar = raw_com_putc;
+	internal_iskey = raw_com_status;
+	internal_waitforinputevent = raw_com_waitforinputevent;
+
+	return speed;
+}
+
+static int
+raw_com_getc(void)
+{
+
+	if (raw_com_addr == 0)
+		panic("%s: Invalid serial port", 

CVS commit: src/sys/arch/i386/stand/efiboot

2023-06-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 20 07:46:03 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
``int i'' is used only for SUPPORT_NFS || SUPPORT_TFTP.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/devopen.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2023-06-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 20 07:46:03 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
``int i'' is used only for SUPPORT_NFS || SUPPORT_TFTP.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/devopen.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/arch/i386/stand/efiboot/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.13 src/sys/arch/i386/stand/efiboot/devopen.c:1.14
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.13	Mon Dec 27 12:19:27 2021
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Tue Jun 20 07:46:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.13 2021/12/27 12:19:27 simonb Exp $	 */
+/*	$NetBSD: devopen.c,v 1.14 2023/06/20 07:46:03 rin Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -154,13 +154,13 @@ devopen(struct open_file *f, const char 
 	const char *xname = NULL;
 	int unit, partition;
 	int biosdev;
-	int i, error;
+	int error;
 #if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
 	struct devdesc desc;
 	const struct netboot_fstab *nf;
 	char *filename;
 	size_t fsnamelen;
-	int n;
+	int i, n;
 #endif
 
 	error = parsebootfile(fname, , , , ,



CVS commit: src/sys/arch/i386/stand/efiboot/bootia32

2023-06-18 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jun 19 04:30:27 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c

Log Message:
whitespace -> tab, blank line, no binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.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/arch/i386/stand/efiboot/bootia32/efibootia32.c
diff -u src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.7 src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.8
--- src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.7	Sun May 14 09:07:54 2023
+++ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c	Mon Jun 19 04:30:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibootia32.c,v 1.7 2023/05/14 09:07:54 riastradh Exp $	*/
+/*	$NetBSD: efibootia32.c,v 1.8 2023/06/19 04:30:27 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -57,16 +57,15 @@ efi_md_init(void)
 	startprog32 = (void *)(u_long)addr;
 	CopyMem(startprog32, startprog32_start, startprog32_size);
 
-addr = EFI_ALLOCATE_MAX_ADDRESS;
-sz = EFI_SIZE_TO_PAGES(multiboot32_size);
-status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
-EfiLoaderData, sz, );
-if (EFI_ERROR(status))
-panic("%s: AllocatePages() failed: %d page(s): %" PRIxMAX,
-__func__, sz, (uintmax_t)status);
-multiboot32 = (void *)(u_long)addr;
-CopyMem(multiboot32, multiboot32_start, multiboot32_size);
-
+	addr = EFI_ALLOCATE_MAX_ADDRESS;
+	sz = EFI_SIZE_TO_PAGES(multiboot32_size);
+	status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
+	EfiLoaderData, sz, );
+	if (EFI_ERROR(status))
+		panic("%s: AllocatePages() failed: %d page(s): %" PRIxMAX,
+		__func__, sz, (uintmax_t)status);
+	multiboot32 = (void *)(u_long)addr;
+	CopyMem(multiboot32, multiboot32_start, multiboot32_size);
 }
 
 /* ARGSUSED */



CVS commit: src/sys/arch/i386/stand/efiboot/bootia32

2023-06-18 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jun 19 04:30:27 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c

Log Message:
whitespace -> tab, blank line, no binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2023-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 14 09:07:54 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c efidisk.c efimemory.c
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c

Log Message:
x86/efiboot: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efidisk.c \
src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.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/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.22 src/sys/arch/i386/stand/efiboot/boot.c:1.23
--- src/sys/arch/i386/stand/efiboot/boot.c:1.22	Thu Apr 20 00:42:24 2023
+++ src/sys/arch/i386/stand/efiboot/boot.c	Sun May 14 09:07:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.22 2023/04/20 00:42:24 manu Exp $	*/
+/*	$NetBSD: boot.c,v 1.23 2023/05/14 09:07:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -483,7 +483,7 @@ command_dev(char *arg)
 	if (*arg == '\0') {
 		efi_disk_show();
 		efi_net_show();
-	
+
 		if (default_part_name != NULL)
 			printf("default NAME=%s\n", default_part_name);
 		else
@@ -647,7 +647,7 @@ void
 command_reloc(char *arg)
 {
 	char *ep;
-	
+
 	if (*arg == '\0') {
 		switch (efi_reloc_type) {
 		case RELOC_NONE:

Index: src/sys/arch/i386/stand/efiboot/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.9 src/sys/arch/i386/stand/efiboot/efidisk.c:1.10
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.9	Tue Dec 17 01:37:52 2019
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Sun May 14 09:07:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.9 2019/12/17 01:37:52 manu Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.10 2023/05/14 09:07:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -70,9 +70,9 @@ dealloc_biosdisk_part(struct biosdisk_pa
 			part[i].part_name = NULL;
 		}
 	}
-	
+
 	dealloc(part, sizeof(*part) * nparts);
-	
+
 	return;
 }
 
@@ -194,7 +194,6 @@ efi_raidframe_probe(struct efi_raidframe
 	return;
 }
 
-
 void
 efi_disk_show(void)
 {
@@ -293,7 +292,7 @@ efi_disk_show(void)
 		raidframe[i].size,
 		, ))
 			continue;
-			
+
 		first = 1;
 		for (j = 0; j < nparts; j++) {
 			bool bootme = part[j].attr & GPT_ENT_ATTR_BOOTME;
Index: src/sys/arch/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.9 src/sys/arch/i386/stand/efiboot/efimemory.c:1.10
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.9	Fri Sep 13 02:19:45 2019
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Sun May 14 09:07:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.9 2019/09/13 02:19:45 manu Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.10 2023/05/14 09:07:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -221,7 +221,7 @@ efi_memory_get_memmap(struct bi_memmap_e
 
 		next = NextMemoryDescriptor(md, DescriptorSize);
 	}
-	
+
 	*memmapp = memmap;
 	*num = NoEntries;
 	return 0;

Index: src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c
diff -u src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.6 src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.7
--- src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.6	Thu Apr 20 00:42:24 2023
+++ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c	Sun May 14 09:07:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibootia32.c,v 1.6 2023/04/20 00:42:24 manu Exp $	*/
+/*	$NetBSD: efibootia32.c,v 1.7 2023/05/14 09:07:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -60,7 +60,7 @@ efi_md_init(void)
 addr = EFI_ALLOCATE_MAX_ADDRESS;
 sz = EFI_SIZE_TO_PAGES(multiboot32_size);
 status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
-EfiLoaderData, sz, ); 
+EfiLoaderData, sz, );
 if (EFI_ERROR(status))
 panic("%s: AllocatePages() failed: %d page(s): %" PRIxMAX,
 __func__, sz, (uintmax_t)status);



CVS commit: src/sys/arch/i386/stand/efiboot

2023-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 14 09:07:54 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c efidisk.c efimemory.c
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c

Log Message:
x86/efiboot: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efidisk.c \
src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2023-05-09 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Wed May 10 00:49:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: version

Log Message:
Raise the version for new feature (here reloc command)
Suggested by Masanobu SAITOH


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/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/arch/i386/stand/efiboot/version
diff -u src/sys/arch/i386/stand/efiboot/version:1.2 src/sys/arch/i386/stand/efiboot/version:1.3
--- src/sys/arch/i386/stand/efiboot/version:1.2	Sat Aug  3 08:13:36 2019
+++ src/sys/arch/i386/stand/efiboot/version	Wed May 10 00:49:17 2023
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.2 2019/08/03 08:13:36 nonaka Exp $
+$NetBSD: version,v 1.3 2023/05/10 00:49:17 manu 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
@@ -6,3 +6,4 @@ is taken as the current.
 
 1.0:	Initial version.
 1.1:	Add CD/DVD-ROM, serial, PXE boot and UEFI memory map compaction support.
+1.2:	Add reloc command



CVS commit: src/sys/arch/i386/stand/efiboot

2023-05-09 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Wed May 10 00:49:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: version

Log Message:
Raise the version for new feature (here reloc command)
Suggested by Masanobu SAITOH


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/version

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



CVS commit: src/sys/arch/i386/stand/efiboot

2022-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 25 22:14:05 UTC 2022

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot

Log Message:
Fix broken flag -nocombreloc, 2.34 did not complain for not understanding it,
but 2.39 wants -z nocombreloc. Is it really needed?


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/efiboot/Makefile.efiboot

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



CVS commit: src/sys/arch/i386/stand/efiboot

2022-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 25 22:14:05 UTC 2022

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot

Log Message:
Fix broken flag -nocombreloc, 2.34 did not complain for not understanding it,
but 2.39 wants -z nocombreloc. Is it really needed?


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/efiboot/Makefile.efiboot

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.19 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.20
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.19	Thu Nov 18 11:17:40 2021
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Sun Dec 25 17:14:05 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.19 2021/11/18 16:17:40 manu Exp $
+# $NetBSD: Makefile.efiboot,v 1.20 2022/12/25 22:14:05 christos Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -41,8 +41,8 @@ BINMODE=444
 .PATH:	${.CURDIR}/../../libsa
 
 LDSCRIPT?= ${.CURDIR}/ldscript
-LDFLAGS+= --no-dynamic-linker --noinhibit-exec
-LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared -nocombreloc
+LDFLAGS+= --no-dynamic-linker --noinhibit-exec -z nocombreloc
+LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared
 CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR}/.. -I$S/lib/libsa
 CPPFLAGS+= -I${.OBJDIR}
 CPPFLAGS+= -I${.CURDIR}/../../lib



Re: CVS commit: src/sys/arch/i386/stand/efiboot

2021-12-27 Thread Simon Burge
Emmanuel Dreyfus wrote:

> In src/sys/arch/i386/stand/lib/biosdisk.c
> int
> biosdisk_findpartition(int biosdev, daddr_t sector,
>int *partition, const char **part_name)
> {
> (...)
> /* default ot first partition */
> *partition = 0;
> *part_name = NULL;
>
> part_name is NULL, *part_name crashes. How do you avoid that?

Aha, I have this elsewhere in my zfs tree:

*partition = 0;
-   *part_name = NULL;
+   if (part_name)
+   *part_name = NULL;

I'll commit that now (as well as the same check for the
NO_DISKLABEL && NO_GPT case.  Thanks for the digging!

Cheers,
Simon.


CVS commit: src/sys/arch/i386/stand/efiboot

2021-12-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Dec 27 12:19:27 UTC 2021

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
Revert rev 1.12 of devopen.c.  This had the unintented side effect
of breaking opens on non-root filesystems (eg trying to open/read
"esp:/EFI/NetBSD/boot.cfg" on the EFI system partition).

Ok manu@.  Original problem to be re-addressed.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/devopen.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/arch/i386/stand/efiboot/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.12 src/sys/arch/i386/stand/efiboot/devopen.c:1.13
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.12	Thu Nov 18 16:18:13 2021
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Mon Dec 27 12:19:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.12 2021/11/18 16:18:13 manu Exp $	 */
+/*	$NetBSD: devopen.c,v 1.13 2021/12/27 12:19:27 simonb Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -288,9 +288,8 @@ neterr:
 	 * biosdisk
 	 */
 	if (strcmp(devname, "esp") == 0) {
-		const char *part_name = NULL;
 		bios2dev(boot_biosdev, boot_biossector, , ,
-		, _name);
+		, NULL);
 		if (efidisk_get_efi_system_partition(boot_biosdev, ))
 			return ENXIO;
 	}



CVS commit: src/sys/arch/i386/stand/efiboot

2021-12-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Dec 27 12:19:27 UTC 2021

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
Revert rev 1.12 of devopen.c.  This had the unintented side effect
of breaking opens on non-root filesystems (eg trying to open/read
"esp:/EFI/NetBSD/boot.cfg" on the EFI system partition).

Ok manu@.  Original problem to be re-addressed.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/devopen.c

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



Re: CVS commit: src/sys/arch/i386/stand/efiboot

2021-12-27 Thread Simon Burge
Emmanuel Dreyfus wrote:

> On Mon, Dec 27, 2021 at 01:08:15PM +1100, Simon Burge wrote:
> > What crash did this fix?  All the use of part_name by the
> > called functions should check if it is NULL before trying
> > to assign anything to *part_name.
>
> I do not recall the details now, but I had a crash because
> of this. Please revert my change, I will get back to it when
> I find some time.

Thanks.  I'll revert that now.

If you have a way of preproducing this, I'm happy to have a look.

Cheers,
Simon.


Re: CVS commit: src/sys/arch/i386/stand/efiboot

2021-12-26 Thread Emmanuel Dreyfus
On Mon, Dec 27, 2021 at 01:08:15PM +1100, Simon Burge wrote:
> What crash did this fix?  All the use of part_name by the
> called functions should check if it is NULL before trying
> to assign anything to *part_name.

I do not recall the details now, but I had a crash because
of this. Please revert my change, I will get back to it when
I find some time.

-- 
Emmanuel Dreyfus
m...@netbsd.org


Re: CVS commit: src/sys/arch/i386/stand/efiboot

2021-12-26 Thread Simon Burge
Hi Emmanuel,

"Emmanuel Dreyfus" wrote:

> Module Name:  src
> Committed By: manu
> Date: Thu Nov 18 16:18:13 UTC 2021
>
> Modified Files:
>
>   src/sys/arch/i386/stand/efiboot: devopen.c
>
> Log Message:
>
> Fix crash because of NULL pointer reference

What crash did this fix?  All the use of part_name by the
called functions should check if it is NULL before trying
to assign anything to *part_name.

This change has broken loading boot.cfg via the EFI path
"esp:/EFI/NetBSD/boot.cfg" since the call to bios_boot() at
https://nxr.netbsd.org/xref/src/sys/arch/i386/stand/efiboot/devopen.c#292
with a non-NULL last argument means devname gets updated and
now points to the partition with a root filesystem rather
than the EFI system partition.

Cheers,
Simon.


CVS commit: src/sys/arch/i386/stand/efiboot

2021-11-18 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Nov 18 16:18:13 UTC 2021

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
Fix crash because of NULL pointer reference


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/devopen.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/arch/i386/stand/efiboot/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.11 src/sys/arch/i386/stand/efiboot/devopen.c:1.12
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.11	Sat Jan 18 19:25:58 2020
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Thu Nov 18 16:18:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.11 2020/01/18 19:25:58 nonaka Exp $	 */
+/*	$NetBSD: devopen.c,v 1.12 2021/11/18 16:18:13 manu Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -288,8 +288,9 @@ neterr:
 	 * biosdisk
 	 */
 	if (strcmp(devname, "esp") == 0) {
+		const char *part_name = NULL;
 		bios2dev(boot_biosdev, boot_biossector, , ,
-		, NULL);
+		, _name);
 		if (efidisk_get_efi_system_partition(boot_biosdev, ))
 			return ENXIO;
 	}



CVS commit: src/sys/arch/i386/stand/efiboot

2021-11-18 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Nov 18 16:18:13 UTC 2021

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
Fix crash because of NULL pointer reference


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/devopen.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2021-11-18 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Nov 18 16:17:41 UTC 2021

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot

Log Message:
Do not pass BIOS geometry when booting using EFI

Recent Mac return garbage data that will crash the code handling it,
and EFI boot does not need it anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/efiboot/Makefile.efiboot

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



CVS commit: src/sys/arch/i386/stand/efiboot

2021-11-18 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Nov 18 16:17:41 UTC 2021

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot

Log Message:
Do not pass BIOS geometry when booting using EFI

Recent Mac return garbage data that will crash the code handling it,
and EFI boot does not need it anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/efiboot/Makefile.efiboot

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.18 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.19
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.18	Sun Sep  6 07:20:29 2020
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Thu Nov 18 16:17:40 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.18 2020/09/06 07:20:29 mrg Exp $
+# $NetBSD: Makefile.efiboot,v 1.19 2021/11/18 16:17:40 manu Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -66,7 +66,8 @@ CPPFLAGS+= -DSUPPORT_BOOTP
 CPPFLAGS+= -DSUPPORT_DHCP
 CPPFLAGS+= -DSUPPORT_NFS
 CPPFLAGS+= -DSUPPORT_TFTP
-CPPFLAGS+= -DPASS_BIOSGEOM
+# Recent macs report garbage geometry
+#CPPFLAGS+= -DPASS_BIOSGEOM
 CPPFLAGS+= -DBIOSDISK_DEFAULT_SECSIZE=2048	# for bootinfo_biosgeom.c
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
 



CVS commit: src/sys/arch/i386/stand/efiboot

2021-10-28 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Thu Oct 28 06:13:13 UTC 2021

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
Make "0 seconds" overwrite the countdown also when enter is pressed

Fixes PR misc/56486.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/eficons.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/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.11 src/sys/arch/i386/stand/efiboot/eficons.c:1.12
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.11	Sat Feb 22 10:30:37 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Thu Oct 28 06:13:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.11 2020/02/22 10:30:37 jmcneill Exp $	*/
+/*	$NetBSD: eficons.c,v 1.12 2021/10/28 06:13:13 kim Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -355,7 +355,9 @@ awaitkey(int timeout, int tell)
 c = getchar();
 			if (c == 0)
 c = -1;
-			goto out;
+			if (tell && timeout)
+printf("%s", numbuf);
+			break;
 		}
 		if (timeout--)
 			internal_waitforinputevent(1000);
@@ -365,7 +367,6 @@ awaitkey(int timeout, int tell)
 			printf("%s", numbuf);
 	}
 
-out:
 	if (tell)
 		printf("0 seconds. \n");
 



CVS commit: src/sys/arch/i386/stand/efiboot

2021-10-28 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Thu Oct 28 06:13:13 UTC 2021

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
Make "0 seconds" overwrite the countdown also when enter is pressed

Fixes PR misc/56486.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/eficons.c

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



Re: CVS commit: src/sys/arch/i386/stand/efiboot

2020-02-10 Thread Kimihiro Nonaka
Hi,

Hyper-V Gen.2 VM has only 1024x768 GOP entry.
https://twitter.com/nonakap/status/1227076603470942208

kernel will be booted in text mode. no output to the console.
If execute "gop 0" command before booting a kernel, it works fine.

On Sat, Feb 8, 2020 at 11:35 PM Jared D. McNeill  wrote:
>
> Module Name:src
> Committed By:   jmcneill
> Date:   Sat Feb  8 14:35:47 UTC 2020
>
> Modified Files:
> src/sys/arch/i386/stand/efiboot: eficons.c
>
> Log Message:
> Fix a few bugs related to the framebuffer:
>  - If a GOP mode wasn't explicitly requested, the bootloader was passing
>fb info to the kernel even if the console was in text mode! This
>results in garbled console output on at least ThinkPad T420 and
>likely many others. If a mode isn't specified, default to 800x600.
>  - The "gop" command was incorrectly parsing video modes in the form
>WxHxD as WxWxD.
>  - Allow a short form WxH for the "gop" command to select any mode with
>the target dimensions.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/eficons.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>


CVS commit: src/sys/arch/i386/stand/efiboot

2019-09-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Sep 26 12:21:03 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c conf.c dev_net.c devopen.c
devopen.h

Log Message:
x86 efiboot: pass a filename to BOOTP and parse a DHCP server provided filename.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/conf.c \
src/sys/arch/i386/stand/efiboot/dev_net.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/devopen.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/devopen.h

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



CVS commit: src/sys/arch/i386/stand/efiboot

2019-09-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Sep 26 12:21:03 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c conf.c dev_net.c devopen.c
devopen.h

Log Message:
x86 efiboot: pass a filename to BOOTP and parse a DHCP server provided filename.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/conf.c \
src/sys/arch/i386/stand/efiboot/dev_net.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/devopen.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/devopen.h

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.16 src/sys/arch/i386/stand/efiboot/boot.c:1.17
--- src/sys/arch/i386/stand/efiboot/boot.c:1.16	Fri Sep 13 02:19:45 2019
+++ src/sys/arch/i386/stand/efiboot/boot.c	Thu Sep 26 12:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.16 2019/09/13 02:19:45 manu Exp $	*/
+/*	$NetBSD: boot.c,v 1.17 2019/09/26 12:21:03 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -111,6 +111,7 @@ const struct bootblk_command commands[] 
 	{ NULL,		NULL },
 };
 
+static char *default_fsname;
 static char *default_devname;
 static int default_unit, default_partition;
 static const char *default_filename;
@@ -125,8 +126,11 @@ parsebootfile(const char *fname, char **
 {
 	const char *col;
 	static char savedevname[MAXDEVNAME+1];
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+	const struct netboot_fstab *nf;
+#endif
 
-	*fsname = "ufs";
+	*fsname = default_fsname;
 	if (default_part_name == NULL) {
 		*devname = default_devname;
 	} else {
@@ -152,6 +156,7 @@ parsebootfile(const char *fname, char **
 
 		if (strstr(fname, "NAME=") == fname) {
 			strlcpy(savedevname, fname, devlen + 1);
+			*fsname = "ufs";
 			*devname = savedevname;
 			*unit = -1;
 			*partition = -1;
@@ -188,6 +193,13 @@ parsebootfile(const char *fname, char **
 		if (i != devlen)
 			return ENXIO;
 
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+		nf = netboot_fstab_find(savedevname);
+		if (nf != NULL)
+			*fsname = (char *)nf->name;
+		else
+#endif
+		*fsname = "ufs";
 		*devname = savedevname;
 		*unit = u;
 		*partition = p;
@@ -278,6 +290,9 @@ boot(void)
 {
 	int currname;
 	int c;
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+	const struct netboot_fstab *nf;
+#endif
 
 	boot_modules_enabled = !(boot_params.bp_flags & X86_BP_FLAGS_NOMODULES);
 
@@ -288,6 +303,14 @@ boot(void)
 	/* if the user types "boot" without filename */
 	default_filename = DEFFILENAME;
 
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+	nf = netboot_fstab_find(default_devname);
+	if (nf != NULL)
+		default_fsname = (char *)nf->name;
+	else
+#endif
+	default_fsname = "ufs";
+
 	if (!(boot_params.bp_flags & X86_BP_FLAGS_NOBOOTCONF)) {
 #ifdef EFIBOOTCFG_FILENAME
 		int rv = EINVAL;
@@ -456,7 +479,7 @@ command_dev(char *arg)
 {
 	static char savedevname[MAXDEVNAME + 1];
 	char buf[80];
-	char *fsname, *devname;
+	char *devname;
 	const char *file; /* dummy */
 
 	if (*arg == '\0') {
@@ -474,7 +497,7 @@ command_dev(char *arg)
 	}
 
 	if (strchr(arg, ':') == NULL ||
-	parsebootfile(arg, , , _unit,
+	parsebootfile(arg, _fsname, , _unit,
 	  _partition, )) {
 		command_help(NULL);
 		return;

Index: src/sys/arch/i386/stand/efiboot/conf.c
diff -u src/sys/arch/i386/stand/efiboot/conf.c:1.2 src/sys/arch/i386/stand/efiboot/conf.c:1.3
--- src/sys/arch/i386/stand/efiboot/conf.c:1.2	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/conf.c	Thu Sep 26 12:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.2 2018/04/11 10:32:09 nonaka Exp $	 */
+/*	$NetBSD: conf.c,v 1.3 2019/09/26 12:21:03 nonaka Exp $	 */
 
 /*
  * Copyright (c) 1997
@@ -54,20 +54,23 @@
 #endif
 #endif
 #include 
+#include "devopen.h"
 #include "efinet.h"
 
 struct devsw devsw[] = {
 	{ "disk", biosdisk_strategy, biosdisk_open, biosdisk_close, biosdisk_ioctl },
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
 	{ "net", net_strategy, net_open, net_close, net_ioctl },
+#endif
 };
 int ndevs = __arraycount(devsw);
 
-#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
 struct netif_driver *netif_drivers[] = {
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
 	,
+#endif
 };
 int n_netif_drivers = __arraycount(netif_drivers);
-#endif
 
 struct fs_ops file_system[] = {
 #ifdef SUPPORT_CD9660
@@ -113,3 +116,15 @@ struct fs_ops file_system_nfs = FS_OPS(n
 #ifdef SUPPORT_TFTP
 struct fs_ops file_system_tftp = FS_OPS(tftp);
 #endif
+
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+const struct netboot_fstab netboot_fstab[] = {
+#ifdef SUPPORT_NFS
+	{ "nfs", _system_nfs },
+#endif
+#ifdef SUPPORT_TFTP
+	{ "tftp", _system_tftp },
+#endif
+};
+const int nnetboot_fstab = __arraycount(netboot_fstab);
+#endif
Index: 

CVS commit: src/sys/arch/i386/stand/efiboot/bootia32

2019-09-23 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Tue Sep 24 00:47:46 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot/bootia32: multiboot32.S

Log Message:
Fix multiboot32 argument usage


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S
diff -u src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S:1.1 src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S:1.2
--- src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S:1.1	Fri Sep 13 02:19:45 2019
+++ src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S	Tue Sep 24 00:47:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: multiboot32.S,v 1.1 2019/09/13 02:19:45 manu Exp $ */
+/*	$NetBSD: multiboot32.S,v 1.2 2019/09/24 00:47:46 manu Exp $ */
 
 #include 
 #include 
@@ -16,12 +16,12 @@ _C_LABEL(multiboot32_size):
 	.p2align 4,,15
 
 /*
- * multiboot32(entry 8(%esp), multiboot2_info 12(%esp), magic 16(%esp))
+ * multiboot32(entry 4(%esp), multiboot2_info 8(%esp), magic 12(%esp))
  */
 ENTRY(multiboot32_start)
 start:
-movl16(%esp),%eax
-movl12(%esp),%ebx
-movl8(%esp),%edx
+movl12(%esp),%eax
+movl8(%esp),%ebx
+movl4(%esp),%edx
 jmp*%edx
 multiboot32_end:



CVS commit: src/sys/arch/i386/stand/efiboot/bootia32

2019-09-23 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Tue Sep 24 00:47:46 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot/bootia32: multiboot32.S

Log Message:
Fix multiboot32 argument usage


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S

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



CVS commit: src/sys/arch/i386/stand/efiboot

2019-08-03 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Aug  3 08:13:36 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: version

Log Message:
x86 efiboot: version 1.1.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/version

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



CVS commit: src/sys/arch/i386/stand/efiboot

2019-08-03 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Aug  3 08:13:36 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: version

Log Message:
x86 efiboot: version 1.1.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/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/arch/i386/stand/efiboot/version
diff -u src/sys/arch/i386/stand/efiboot/version:1.1 src/sys/arch/i386/stand/efiboot/version:1.2
--- src/sys/arch/i386/stand/efiboot/version:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/version	Sat Aug  3 08:13:36 2019
@@ -1,7 +1,8 @@
-$NetBSD: version,v 1.1 2017/01/24 11:09:14 nonaka Exp $
+$NetBSD: version,v 1.2 2019/08/03 08:13:36 nonaka 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
 is taken as the current.
 
 1.0:	Initial version.
+1.1:	Add CD/DVD-ROM, serial, PXE boot and UEFI memory map compaction support.



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 12:37:26 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: efiboot.c

Log Message:
Added missing efi_memory_probe() call.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efiboot.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/arch/i386/stand/efiboot/efiboot.c
diff -u src/sys/arch/i386/stand/efiboot/efiboot.c:1.9 src/sys/arch/i386/stand/efiboot/efiboot.c:1.10
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.9	Mon Jul 29 11:28:51 2019
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Mon Jul 29 12:37:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.9 2019/07/29 11:28:51 nonaka Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.10 2019/07/29 12:37:26 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -88,6 +88,7 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS
 		}
 	}
 
+	efi_memory_probe();
 	efi_disk_probe();
 	efi_pxe_probe();
 	efi_net_probe();



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 12:37:26 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: efiboot.c

Log Message:
Added missing efi_memory_probe() call.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efiboot.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 11:33:07 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: efimemory.c

Log Message:
Sync the output of memmap command to the output of stand/efiboot mem command.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/efimemory.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 11:33:07 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: efimemory.c

Log Message:
Sync the output of memmap command to the output of stand/efiboot mem command.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/efimemory.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/arch/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.7 src/sys/arch/i386/stand/efiboot/efimemory.c:1.8
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.7	Mon Jul 29 11:28:51 2019
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Mon Jul 29 11:33:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.7 2019/07/29 11:28:51 nonaka Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.8 2019/07/29 11:33:07 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -30,38 +30,22 @@
 
 #include 
 
-static const char *memtypes[] = {
-	"unknown",
-	"available",
-	"reserved",
-	"ACPI reclaimable",
-	"ACPI NVS",
-	"unusable",
-	"disabled",
-	"Persistent",
-	"undefined (8)",
-	"undefined (9)",
-	"undefined (10)",
-	"undefined (11)",
-	"Persistent (Legacy)"
-};
-
-static const char *efimemtypes[] = {
-	"Reserved",
-	"LoaderCode",
-	"LoaderData",
-	"BootServicesCode",
-	"BootServicesData",
-	"RuntimeServicesCode",
-	"RuntimeServicesData",
-	"ConventionalMemory",
-	"UnusableMemory",
-	"ACPIReclaimMemory",
-	"ACPIMemoryNVS",
-	"MemoryMappedIO",
-	"MemoryMappedIOPortSpace",
-	"PalCode",
-	"PersistentMemory",
+static const char *efi_memory_type[] = {
+	[EfiReservedMemoryType]		= "Reserved Memory Type",
+	[EfiLoaderCode]			= "Loader Code",
+	[EfiLoaderData]			= "Loader Data",
+	[EfiBootServicesCode]		= "Boot Services Code",
+	[EfiBootServicesData]		= "Boot Services Data",
+	[EfiRuntimeServicesCode]	= "Runtime Services Code",
+	[EfiRuntimeServicesData]	= "Runtime Services Data",
+	[EfiConventionalMemory]		= "Conventional Memory",
+	[EfiUnusableMemory]		= "Unusable Memory",
+	[EfiACPIReclaimMemory]		= "ACPI Reclaim Memory",
+	[EfiACPIMemoryNVS]		= "ACPI Memory NVS",
+	[EfiMemoryMappedIO]		= "MMIO",
+	[EfiMemoryMappedIOPortSpace]	= "MMIO (Port Space)",
+	[EfiPalCode]			= "Pal Code",
+	[EfiPersistentMemory]		= "Persistent Memory",
 };
 
 #ifndef KERN_LOADSPACE_SIZE
@@ -355,9 +339,8 @@ efi_memory_show_map(bool sorted, bool co
 	EFI_MEMORY_DESCRIPTOR *mdtop, *md, *next;
 	UINTN i, NoEntries, MapKey, DescriptorSize;
 	UINT32 DescriptorVersion;
-	char memstr[32], efimemstr[32];
-	int memtype;
-	UINTN cols, rows, row = 0;
+	char efimemstr[32];
+	UINTN cols, rows, row;
 
 	status = uefi_call_wrapper(ST->ConOut->QueryMode, 4, ST->ConOut,
 	ST->ConOut->Mode->Mode, , );
@@ -371,24 +354,23 @@ efi_memory_show_map(bool sorted, bool co
 	if (compact)
 		efi_memory_compact_map(mdtop, , DescriptorSize);
 
+	printf("%-22s  %-16s  %-16s  %-16s\n", "Type", "Start", "End", "Attributes");
+	printf("--      \n");
+	row = 2;
+
 	for (i = 0, md = mdtop; i < NoEntries; i++, md = next) {
 		next = NextMemoryDescriptor(md, DescriptorSize);
 
-		memtype = getmemtype(md);
-		if (memtype >= __arraycount(memtypes))
-			snprintf(memstr, sizeof(memstr), "unknown (%d)",
-			memtype);
-		if (md->Type >= __arraycount(efimemtypes))
+		if (md->Type >= __arraycount(efi_memory_type))
 			snprintf(efimemstr, sizeof(efimemstr), "unknown (%d)",
 			md->Type);
-		printf("%016" PRIxMAX "/%016" PRIxMAX ": %s [%s]\n",
+		printf("%-22s  %016" PRIxMAX "  %016" PRIxMAX "  %016" PRIxMAX "\n",
+		md->Type >= __arraycount(efi_memory_type) ?
+		  efimemstr : efi_memory_type[md->Type],
 		(uintmax_t)md->PhysicalStart,
 		(uintmax_t)md->PhysicalStart +
 		  md->NumberOfPages * EFI_PAGE_SIZE - 1,
-		memtype >= __arraycount(memtypes) ?
-		  memstr : memtypes[memtype],
-		md->Type >= __arraycount(efimemtypes) ?
-		  efimemstr : efimemtypes[md->Type]);
+		(uintmax_t)md->Attribute);
 
 		if (++row >= rows) {
 			row = 0;



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 11:28:51 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c efiboot.c efiboot.h efimemory.c

Log Message:
Added BTINFO_EFIMEMMAP compaction support to x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efiboot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/efimemory.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/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.12 src/sys/arch/i386/stand/efiboot/boot.c:1.13
--- src/sys/arch/i386/stand/efiboot/boot.c:1.12	Fri Jul 26 12:09:48 2019
+++ src/sys/arch/i386/stand/efiboot/boot.c	Mon Jul 29 11:28:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.12 2019/07/26 12:09:48 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.13 2019/07/29 11:28:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -351,7 +351,7 @@ command_help(char *arg)
 #if LIBSA_ENABLE_LS_OP
 	   "ls [path]\n"
 #endif
-	   "memmap [{sorted|unsorted}]\n"
+	   "memmap [{sorted|unsorted|compact}]\n"
 #ifndef SMALL
 	   "menu (reenters boot menu, if defined in boot.cfg)\n"
 #endif
@@ -613,18 +613,21 @@ void
 command_memmap(char *arg)
 {
 	bool sorted = true;
+	bool compact = false;
 
 	if (*arg == '\0' || strcmp(arg, "sorted") == 0)
 		/* Already sorted is true. */;
 	else if (strcmp(arg, "unsorted") == 0)
 		sorted = false;
+	else if (strcmp(arg, "compact") == 0)
+		compact = true;
 	else {
 		printf("invalid flag, "
-		"must be 'sorted' or 'unsorted'.\n");
+		"must be 'sorted', 'unsorted' or 'compact'.\n");
 		return;
 	}
 
-	efi_memory_show_map(sorted);
+	efi_memory_show_map(sorted, compact);
 }
 
 void

Index: src/sys/arch/i386/stand/efiboot/efiboot.c
diff -u src/sys/arch/i386/stand/efiboot/efiboot.c:1.8 src/sys/arch/i386/stand/efiboot/efiboot.c:1.9
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.8	Fri Jun  8 11:52:30 2018
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Mon Jul 29 11:28:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.8 2018/06/08 11:52:30 nonaka Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.9 2019/07/29 11:28:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -134,6 +134,7 @@ efi_cleanup(void)
 	}
 	efi_cleanuped = true;
 
+	efi_memory_compact_map(desc, , DescriptorSize);
 	allocsz = sizeof(struct btinfo_efimemmap) - 1
 	+ NoEntries * DescriptorSize;
 	bim = alloc(allocsz);
Index: src/sys/arch/i386/stand/efiboot/efiboot.h
diff -u src/sys/arch/i386/stand/efiboot/efiboot.h:1.8 src/sys/arch/i386/stand/efiboot/efiboot.h:1.9
--- src/sys/arch/i386/stand/efiboot/efiboot.h:1.8	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/efiboot.h	Mon Jul 29 11:28:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.8 2018/04/11 10:32:09 nonaka Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.9 2019/07/29 11:28:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -80,9 +80,11 @@ void efi_disk_show(void);
 
 /* efimemory.c */
 void efi_memory_probe(void);
-void efi_memory_show_map(bool);
+void efi_memory_show_map(bool, bool);
 EFI_MEMORY_DESCRIPTOR *efi_memory_get_map(UINTN *, UINTN *, UINTN *, UINT32 *,
 bool);
+EFI_MEMORY_DESCRIPTOR *efi_memory_compact_map(EFI_MEMORY_DESCRIPTOR *, UINTN *,
+UINTN);
 
 /* efinet.c */
 void efi_net_probe(void);

Index: src/sys/arch/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.6 src/sys/arch/i386/stand/efiboot/efimemory.c:1.7
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.6	Fri Jul 26 12:09:48 2019
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Mon Jul 29 11:28:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.6 2019/07/26 12:09:48 nonaka Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.7 2019/07/29 11:28:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -107,7 +107,7 @@ EFI_MEMORY_DESCRIPTOR *
 efi_memory_get_map(UINTN *NoEntries, UINTN *MapKey, UINTN *DescriptorSize,
 UINT32 *DescriptorVersion, bool sorted)
 {
-	EFI_MEMORY_DESCRIPTOR *desc, *md, *next, *target, tmp;
+	EFI_MEMORY_DESCRIPTOR *desc, *md, *next, *target, *tmp;
 	UINTN i, j;
 
 	*NoEntries = 0;
@@ -119,17 +119,93 @@ efi_memory_get_map(UINTN *NoEntries, UIN
 	if (!sorted)
 		return desc;
 
+	tmp = alloc(*DescriptorSize);
+	if (tmp == NULL)
+		return desc;
+
 	for (i = 0, md = desc; i < *NoEntries - 1; i++, md = next) {
 		target = next = NextMemoryDescriptor(md, *DescriptorSize);
 		for (j = i + 1; j < *NoEntries; j++) {
 			if (md->PhysicalStart > target->PhysicalStart) {
-CopyMem(, md, sizeof(*md));
-CopyMem(md, target, sizeof(*md));
-CopyMem(target, , sizeof(*md));
+CopyMem(tmp, md, *DescriptorSize);
+CopyMem(md, target, *DescriptorSize);
+CopyMem(target, tmp, 

CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 11:28:51 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c efiboot.c efiboot.h efimemory.c

Log Message:
Added BTINFO_EFIMEMMAP compaction support to x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efiboot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/efimemory.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jul 26 11:30:31 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot dev_net.c

Log Message:
Added tftp support to x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/dev_net.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/arch/i386/stand/efiboot/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.14 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.15
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.14	Wed Jul 25 23:45:32 2018
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Fri Jul 26 11:30:31 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.14 2018/07/25 23:45:32 kamil Exp $
+# $NetBSD: Makefile.efiboot,v 1.15 2019/07/26 11:30:31 nonaka Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -18,7 +18,9 @@ SOURCES+= efidisk.c efidisk_ll.c efigets
 SOURCES+= efinet.c efipxe.c
 LIBI386SRCS= biosdisk.c bootinfo.c bootinfo_biosgeom.c bootmenu.c
 LIBI386SRCS+= diskbuf.c exec.c menuutils.c parseutils.c pread.c
-SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS}
+# use our own nfs implementation
+LIBSASRCS+= nfs.c
+SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS} ${LIBSASRCS}
 
 .include 
 
@@ -35,6 +37,7 @@ BINMODE=444
 
 .PATH:	${.CURDIR} ${.CURDIR}/..
 .PATH:	${.CURDIR}/../../lib
+.PATH:	${.CURDIR}/../../libsa
 
 LDSCRIPT?= ${.CURDIR}/ldscript
 LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared -nocombreloc
@@ -60,7 +63,7 @@ CPPFLAGS+= -DSUPPORT_EXT2FS
 CPPFLAGS+= -DSUPPORT_BOOTP
 CPPFLAGS+= -DSUPPORT_DHCP
 CPPFLAGS+= -DSUPPORT_NFS
-#CPPFLAGS+= -DSUPPORT_TFTP
+CPPFLAGS+= -DSUPPORT_TFTP
 CPPFLAGS+= -DPASS_BIOSGEOM
 CPPFLAGS+= -DBIOSDISK_DEFAULT_SECSIZE=2048	# for bootinfo_biosgeom.c
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP

Index: src/sys/arch/i386/stand/efiboot/dev_net.c
diff -u src/sys/arch/i386/stand/efiboot/dev_net.c:1.1 src/sys/arch/i386/stand/efiboot/dev_net.c:1.2
--- src/sys/arch/i386/stand/efiboot/dev_net.c:1.1	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/dev_net.c	Fri Jul 26 11:30:31 2019
@@ -1,3 +1,256 @@
-/*	$NetBSD: dev_net.c,v 1.1 2018/04/11 10:32:09 nonaka Exp $	*/
+/*	$NetBSD: dev_net.c,v 1.2 2019/07/26 11:30:31 nonaka Exp $	*/
 
-#include 
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gordon W. Ross.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This module implements a "raw device" interface suitable for
+ * use by the stand-alone I/O library NFS code.  This interface
+ * does not support any "block" access, and exists only for the
+ * purpose of initializing the network interface, getting boot
+ * parameters, and performing the NFS mount.
+ *
+ * At open time, this does:
+ *
+ * find interface  - netif_open()
+ * RARP for IP address - rarp_getipaddress()
+ * RPC/bootparams  - callrpc(d, RPC_BOOTPARAMS, ...)
+ * RPC/mountd  - nfs_mount(sock, ip, path)
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "stand.h"
+#include "net.h"
+#include "netif.h"
+#include "nfs.h"
+#include "bootparam.h"
+#include "dev_net.h"
+#ifdef SUPPORT_BOOTP
+#include "bootp.h"
+#endif
+
+static int netdev_sock = -1;
+static int netdev_opens;
+
+static int net_getparams(int);
+
+/*
+ * Called by devopen after it sets f->f_dev to our devsw entry.
+ * This opens the low-level device and sets f->f_devdata.
+ * This is 

CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jul 26 11:30:31 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot dev_net.c

Log Message:
Added tftp support to x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/dev_net.c

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



Re: CVS commit: src/sys/arch/i386/stand/efiboot

2017-02-06 Thread Joerg Sonnenberger
On Mon, Feb 06, 2017 at 10:32:35AM +, NONAKA Kimihiro wrote:
> Module Name:  src
> Committed By: nonaka
> Date: Mon Feb  6 10:32:35 UTC 2017
> 
> Modified Files:
>   src/sys/arch/i386/stand/efiboot: Makefile.efiboot
> 
> Log Message:
> Remove unnecessary flag.

Thanks.

Joerg


Re: CVS commit: src/sys/arch/i386/stand/efiboot

2017-02-03 Thread Joerg Sonnenberger
On Fri, Feb 03, 2017 at 05:24:43PM +, Roy Marples wrote:
> Module Name:  src
> Committed By: roy
> Date: Fri Feb  3 17:24:43 UTC 2017
> 
> Modified Files:
>   src/sys/arch/i386/stand/efiboot: Makefile.efiboot
> 
> Log Message:
> Fix build with clang.

Instead of disabling the noreturn validation, please mark reboot
properly as dead, with a __builtin_unreachable() at the end if
necessary.

Joerg


Re: CVS commit: src/sys/arch/i386/stand/efiboot

2017-02-03 Thread Joerg Sonnenberger
On Fri, Feb 03, 2017 at 05:24:43PM +, Roy Marples wrote:
> Module Name:  src
> Committed By: roy
> Date: Fri Feb  3 17:24:43 UTC 2017
> 
> Modified Files:
>   src/sys/arch/i386/stand/efiboot: Makefile.efiboot
> 
> Log Message:
> Fix build with clang.

Nonaka-san, can you comment on why the flag is useful in first place?

Joerg