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

2021-06-23 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu Jun 24 01:23:17 UTC 2021

Modified Files:
src/sys/arch/i386/stand/bootxx: boot1.c

Log Message:
boot1.c: remove a comment that's no longer relevant/correct

In r. 1.13, a check of the return value in fd was removed, and a comment
about this ("...so keep going") added. Then in r. 1.19, the fd return
value check was reinstated (as the true underlying errno could be masked
by the fstat() call), so there is no "keep going" happening anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/bootxx/boot1.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/bootxx/boot1.c
diff -u src/sys/arch/i386/stand/bootxx/boot1.c:1.20 src/sys/arch/i386/stand/bootxx/boot1.c:1.21
--- src/sys/arch/i386/stand/bootxx/boot1.c:1.20	Thu Jan  6 01:08:48 2011
+++ src/sys/arch/i386/stand/bootxx/boot1.c	Thu Jun 24 01:23:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot1.c,v 1.20 2011/01/06 01:08:48 jakllsch Exp $	*/
+/*	$NetBSD: boot1.c,v 1.21 2021/06/24 01:23:16 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: boot1.c,v 1.20 2011/01/06 01:08:48 jakllsch Exp $");
+__RCSID("$NetBSD: boot1.c,v 1.21 2021/06/24 01:23:16 gutteridge Exp $");
 
 #include 
 #include 
@@ -106,7 +106,6 @@ boot1(uint32_t biosdev, uint64_t *sector
 	fd = ob();
 
 done:
-	/* if we fail here, so will fstat, so keep going */
 	if (fd == -1 || fstat(fd, ) == -1)
 		return "Can't open /boot\r\n";
 



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

2021-06-22 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Jun 22 19:53:58 UTC 2021

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

Log Message:
efiboot (x86): add ASCII art


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/efiboot/boot.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.18 src/sys/arch/i386/stand/efiboot/boot.c:1.19
--- src/sys/arch/i386/stand/efiboot/boot.c:1.18	Sun May 30 05:59:22 2021
+++ src/sys/arch/i386/stand/efiboot/boot.c	Tue Jun 22 19:53:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.18 2021/05/30 05:59:22 mlelstv Exp $	*/
+/*	$NetBSD: boot.c,v 1.19 2021/06/22 19:53:58 nia Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -287,8 +287,19 @@ print_banner(void)
 		for (n = 0; n < BOOTCFG_MAXBANNER && bootcfg_info.banner[n];
 		n++)
 			printf("%s\n", bootcfg_info.banner[n]);
-	} else
-		command_version("short");
+	} else {
+		printf("\n"
+		   "  \\-__,--,___.\n"
+		   "   \\__,---`  %s (from NetBSD %s)\n"
+		   "\\   `---,_.  Revision %s\n"
+		   " \\-,_,.---`  Memory: %d/%d k\n"
+		   "  \\\n"  
+		   "   \\\n"
+		   "\\\n",
+		   bootprog_name, bootprog_kernrev,
+		   bootprog_rev,   
+		   getbasemem(), getextmem());
+	}
 }
 
 void



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

2021-06-21 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Jun 21 19:52:17 UTC 2021

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
use a single printf call for readability


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.76 src/sys/arch/i386/stand/boot/boot2.c:1.77
--- src/sys/arch/i386/stand/boot/boot2.c:1.76	Mon Jun 21 19:43:17 2021
+++ src/sys/arch/i386/stand/boot/boot2.c	Mon Jun 21 19:52:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.76 2021/06/21 19:43:17 nia Exp $	*/
+/*	$NetBSD: boot2.c,v 1.77 2021/06/21 19:52:17 nia Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -311,16 +311,17 @@ print_banner(void)
 			printf("%s\n", bootcfg_info.banner[n]);
 	} else {
 #endif /* !SMALL */
-		printf("\n");
-		printf("  \\-__,--,___.\n");
-		printf("   \\__,---`  %s (from NetBSD %s)\n",
-		bootprog_name, bootprog_kernrev);
-		printf("\\   `---,_.  Revision %s\n", bootprog_rev);
-		printf(" \\-,_,.---`  Memory: %d/%d k\n",
-		getbasemem(), getextmem());
-		printf("  \\\n");
-		printf("   \\\n");
-		printf("\\\n");
+		printf("\n"
+		   "  \\-__,--,___.\n"
+		   "   \\__,---`  %s (from NetBSD %s)\n"
+		   "\\   `---,_.  Revision %s\n"
+		   " \\-,_,.---`  Memory: %d/%d k\n"
+		   "  \\\n"
+		   "   \\\n"
+		   "\\\n",
+		   bootprog_name, bootprog_kernrev,
+		   bootprog_rev,
+		   getbasemem(), getextmem());
 #ifndef SMALL
 	}
 #endif /* !SMALL */



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

2021-06-21 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Jun 21 19:43:17 UTC 2021

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
biosboot: Add ASCII art.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.75 src/sys/arch/i386/stand/boot/boot2.c:1.76
--- src/sys/arch/i386/stand/boot/boot2.c:1.75	Sun May 30 05:59:22 2021
+++ src/sys/arch/i386/stand/boot/boot2.c	Mon Jun 21 19:43:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.75 2021/05/30 05:59:22 mlelstv Exp $	*/
+/*	$NetBSD: boot2.c,v 1.76 2021/06/21 19:43:17 nia Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -311,12 +311,16 @@ print_banner(void)
 			printf("%s\n", bootcfg_info.banner[n]);
 	} else {
 #endif /* !SMALL */
-		printf("\n"
-		   ">> %s, Revision %s (from NetBSD %s)\n"
-		   ">> Memory: %d/%d k\n",
-		   bootprog_name, bootprog_rev, bootprog_kernrev,
-		   getbasemem(), getextmem());
-
+		printf("\n");
+		printf("  \\-__,--,___.\n");
+		printf("   \\__,---`  %s (from NetBSD %s)\n",
+		bootprog_name, bootprog_kernrev);
+		printf("\\   `---,_.  Revision %s\n", bootprog_rev);
+		printf(" \\-,_,.---`  Memory: %d/%d k\n",
+		getbasemem(), getextmem());
+		printf("  \\\n");
+		printf("   \\\n");
+		printf("\\\n");
 #ifndef SMALL
 	}
 #endif /* !SMALL */



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

2020-07-15 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Wed Jul 15 12:36:30 UTC 2020

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Let consdev command also set speed

Adapted from PR install/55490 by Sunil Nimmagadda


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.73 src/sys/arch/i386/stand/boot/boot2.c:1.74
--- src/sys/arch/i386/stand/boot/boot2.c:1.73	Sat Apr  4 19:50:54 2020
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Jul 15 12:36:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.73 2020/04/04 19:50:54 christos Exp $	*/
+/*	$NetBSD: boot2.c,v 1.74 2020/07/15 12:36:30 kim Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -449,7 +449,7 @@ command_help(char *arg)
 	   "ls [dev:][path]\n"
 #endif
 	   "dev [dev:]\n"
-	   "consdev {pc|com[0123]|com[0123]kbd|auto}\n"
+	   "consdev {pc|{com[0123]|com[0123]kbd|auto}[,{speed}]}\n"
 	   "vesa {modenum|on|off|enabled|disabled|list}\n"
 #ifndef SMALL
 	   "menu (reenters boot menu, if defined in boot.cfg)\n"
@@ -581,14 +581,32 @@ void
 command_consdev(char *arg)
 {
 	const struct cons_devs *cdp;
+	char *sep;
+	int speed;
+
+	sep = strchr(arg, ',');
+	if (sep != NULL)
+		*sep++ = '\0';
 
 	for (cdp = cons_devs; cdp->name; cdp++) {
-		if (strcmp(arg, cdp->name) == 0) {
-			initio(cdp->tag);
-			print_banner();
-			return;
+		if (strcmp(arg, cdp->name) != 0)
+			continue;
+
+		if (sep != NULL) {
+			if (cdp->tag == CONSDEV_PC)
+goto error;
+
+			speed = atoi(sep);
+			if (speed < 0)
+goto error;
+			boot_params.bp_conspeed = speed;
 		}
+
+		initio(cdp->tag);
+		print_banner();
+		return;
 	}
+error:
 	printf("invalid console device.\n");
 }
 



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

2020-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:30:46 UTC 2020

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

Log Message:
Add --noinhibit-exec and --no-dynamic-linker


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 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.16 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.17
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.16	Thu Sep 12 22:19:45 2019
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Sat Apr  4 11:30:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.16 2019/09/13 02:19:45 manu Exp $
+# $NetBSD: Makefile.efiboot,v 1.17 2020/04/04 15:30:46 christos Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -41,6 +41,7 @@ BINMODE=444
 .PATH:	${.CURDIR}/../../libsa
 
 LDSCRIPT?= ${.CURDIR}/ldscript
+LDFLAGS+= --no-dynamic-linker --noinhibit-exec
 LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared -nocombreloc
 CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR}/.. -I$S/lib/libsa
 CPPFLAGS+= -I${.OBJDIR}



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

2020-03-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 21 18:43:47 UTC 2020

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

Log Message:
Fix clang build after packed lfs64 accessor change.


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

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/bootx64/Makefile
diff -u src/sys/arch/i386/stand/efiboot/bootx64/Makefile:1.2 src/sys/arch/i386/stand/efiboot/bootx64/Makefile:1.3
--- src/sys/arch/i386/stand/efiboot/bootx64/Makefile:1.2	Fri Sep 13 02:19:46 2019
+++ src/sys/arch/i386/stand/efiboot/bootx64/Makefile	Sat Mar 21 18:43:47 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2019/09/13 02:19:46 manu Exp $
+#	$NetBSD: Makefile,v 1.3 2020/03/21 18:43:47 riastradh Exp $
 
 PROG=		bootx64.efi
 OBJFMT=		pei-x86-64
@@ -9,4 +9,9 @@ EXTRA_SOURCES=	efibootx64.c startprog64.
 COPTS+=		-mno-red-zone
 CPPFLAGS+=	-DEFI_FUNCTION_WRAPPER
 
+# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
+# accessors -- they don't actually dereference the resulting pointer,
+# just use it for type-checking.
+CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
+
 .include "${.CURDIR}/../Makefile.efiboot"



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

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 10:30:37 UTC 2020

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

Log Message:
Remove check for bestmode==-1 (shouldn't happen)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/arch/i386/stand/efiboot/eficons.c:1.11
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.10	Sat Feb 22 09:34:26 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Sat Feb 22 10:30:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.10 2020/02/22 09:34:26 jmcneill Exp $	*/
+/*	$NetBSD: eficons.c,v 1.11 2020/02/22 10:30:37 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -421,7 +421,7 @@ bi_framebuffer(void)
 	EFI_STATUS status;
 	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
 	struct btinfo_framebuffer fb;
-	INT32 bestmode = -1;
+	INT32 bestmode;
 	UINTN sz;
 
 	if (efi_gop == NULL)
@@ -435,8 +435,6 @@ bi_framebuffer(void)
 		if (bestmode == -1)
 			bestmode = FALLBACK_GOP_MODE;
 	}
-	if (bestmode == -1)
-		goto nofb;
 
 	status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,
 	bestmode);



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

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 09:34:26 UTC 2020

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

Log Message:
If the default GOP mode is unavailable, fallback to the first mode defined.
PR# port-amd64/55000


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/arch/i386/stand/efiboot/eficons.c:1.10
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.9	Tue Feb 11 11:01:10 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Sat Feb 22 09:34:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.9 2020/02/11 11:01:10 jmcneill Exp $	*/
+/*	$NetBSD: eficons.c,v 1.10 2020/02/22 09:34:26 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -37,6 +37,7 @@
 #ifndef DEFAULT_GOP_MODE
 #define DEFAULT_GOP_MODE	"1024x768"
 #endif
+#define FALLBACK_GOP_MODE	0
 
 extern struct x86_boot_params boot_params;
 
@@ -431,6 +432,8 @@ bi_framebuffer(void)
 	} 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;
 	}
 	if (bestmode == -1)
 		goto nofb;



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

2020-02-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Feb 11 11:01:10 UTC 2020

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

Log Message:
Use 1024x768 as the default GOP mode. It is the only option available for
Hyper-V Gen.2 VMs and it seems to be the de facto standard and part of
WHQL requirements.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/arch/i386/stand/efiboot/eficons.c:1.9
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.8	Sat Feb  8 14:35:47 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Tue Feb 11 11:01:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.8 2020/02/08 14:35:47 jmcneill Exp $	*/
+/*	$NetBSD: eficons.c,v 1.9 2020/02/11 11:01:10 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -35,7 +35,7 @@
 #include "vbe.h"
 
 #ifndef DEFAULT_GOP_MODE
-#define DEFAULT_GOP_MODE	"800x600"
+#define DEFAULT_GOP_MODE	"1024x768"
 #endif
 
 extern struct x86_boot_params boot_params;



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

2020-02-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  9 12:13:39 UTC 2020

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

Log Message:
Do not clear the screen before exiting boot services as this may cause an
undesired display mode switch. PR# 54615


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/arch/i386/stand/efiboot/efiboot.c:1.12
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.11	Fri Sep 13 02:19:45 2019
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Sun Feb  9 12:13:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.11 2019/09/13 02:19:45 manu Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.12 2020/02/09 12:13:39 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -112,8 +112,6 @@ efi_cleanup(void)
 	UINT32 DescriptorVersion;
 	size_t allocsz;
 
-	clearit();
-
 	memset(_efi, 0, sizeof(btinfo_efi));
 	btinfo_efi.systblpa = (intptr_t)ST;
 #ifdef	__i386__	/* bootia32.efi */



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

2020-02-08 Thread Jared D. McNeill
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.

Modified files:

Index: src/sys/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.7 src/sys/arch/i386/stand/efiboot/eficons.c:1.8
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.7	Fri Sep 13 02:19:45 2019
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Sat Feb  8 14:35:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.7 2019/09/13 02:19:45 manu Exp $	*/
+/*	$NetBSD: eficons.c,v 1.8 2020/02/08 14:35:47 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -34,6 +34,10 @@
 #include "bootinfo.h"
 #include "vbe.h"
 
+#ifndef DEFAULT_GOP_MODE
+#define DEFAULT_GOP_MODE	"800x600"
+#endif
+
 extern struct x86_boot_params boot_params;
 
 struct btinfo_console btinfo_console;
@@ -71,6 +75,8 @@ static int efi_com_putc(int);
 static int efi_com_status(int);
 static int efi_com_waitforinputevent(uint64_t);
 
+static int efi_find_gop_mode(char *);
+
 static int iodev;
 static int (*internal_getchar)(void) = efi_cons_getc;
 static int (*internal_putchar)(int) = efi_cons_putc;
@@ -415,46 +421,36 @@ bi_framebuffer(void)
 	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
 	struct btinfo_framebuffer fb;
 	INT32 bestmode = -1;
+	UINTN sz;
 
-	if (efi_gop == NULL) {
-		framebuffer_configure(NULL);
-		return;
-	}
+	if (efi_gop == NULL)
+		goto nofb;
 
 	if (efi_gop_mode >= 0) {
 		bestmode = efi_gop_mode;
 	} else {
-#if 0
-		UINT64 res, bestres = 0;
-		UINTN sz;
-		UINT32 i;
-
-		/* XXX EDID? EFI_EDID_DISCOVERED_PROTOCOL */
-		for (i = 0; i < efi_gop->Mode->MaxMode; i++) {
-			status = uefi_call_wrapper(efi_gop->QueryMode, 4,
-			efi_gop, i, , );
-			if (EFI_ERROR(status))
-continue;
+		/* If a mode has not been selected, choose a default */
+		bestmode = efi_find_gop_mode(DEFAULT_GOP_MODE);
+	}
+	if (bestmode == -1)
+		goto nofb;
 
-			res = (UINT64)info->HorizontalResolution *
-			(UINT64)info->VerticalResolution *
-			(UINT64)getdepth(info);
-			if (res > bestres) {
-bestmode = i;
-bestres = res;
-			}
-		}
-#endif
+	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 (bestmode >= 0) {
-		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);
+
+	status = uefi_call_wrapper(efi_gop->QueryMode, 4,
+	efi_gop, bestmode, , );
+	if (EFI_ERROR(status)) {
+		printf("GOP querymode failed: %" PRIxMAX "\n",
+		(uintmax_t)status);
+		goto nofb;
 	}
 
-	info = efi_gop->Mode->Info;
 	memset(, 0, sizeof(fb));
 	fb.physaddr = efi_gop->Mode->FrameBufferBase;
 	fb.flags = 0;
@@ -499,6 +495,10 @@ bi_framebuffer(void)
 	}
 
 	framebuffer_configure();
+	return;
+
+nofb:
+	framebuffer_configure(NULL);
 }
 
 int
@@ -658,10 +658,16 @@ efi_find_gop_mode(char *arg)
 
 		snprintf(mode, sizeof(mode), "%lux%lux%u",
 		(long)info->HorizontalResolution,
-		(long)info->HorizontalResolution,
+		(long)info->VerticalResolution,
 		depth);
 		if (strcmp(arg, mode) == 0)
 			return i;
+
+		snprintf(mode, sizeof(mode), "%lux%lu",
+		(long)info->HorizontalResolution,
+		(long)info->VerticalResolution);
+		if (strcmp(arg, mode) == 0)
+			return i;
 	}
 	return -1;
 }



CVS commit: src/sys/arch/i386/stand/bootxx/bootxx_msdos

2020-01-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan 22 06:13:18 UTC 2020

Modified Files:
src/sys/arch/i386/stand/bootxx/bootxx_msdos: Makefile

Log Message:
Clamp FAT partition size to 32 bit byte offsets to make the code small
enough to fit.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile

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/bootxx/bootxx_msdos/Makefile
diff -u src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile:1.3 src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile:1.4
--- src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile:1.3	Sun Dec 11 12:17:48 2005
+++ src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile	Wed Jan 22 06:13:18 2020
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.3 2005/12/11 12:17:48 christos Exp $
+# $NetBSD: Makefile,v 1.4 2020/01/22 06:13:18 martin Exp $
 
 PROG=	bootxx_msdos
 FS=	dosfs
-CPPFLAGS=-DBOOT_FROM_FAT -DTERSE_ERROR
+CPPFLAGS=-DBOOT_FROM_FAT -DTERSE_ERROR -DSA_DOSFS_NO_BIG_PART_SUPPORT
 
 .include <../Makefile.bootxx>



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

2020-01-18 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jan 18 19:25:58 UTC 2020

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

Log Message:
x86 efiboot: Fixed the problem that /EFI/NetBSD/boot.cfg could not be loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/arch/i386/stand/efiboot/devopen.c:1.11
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.10	Sat Jan 18 19:20:23 2020
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Sat Jan 18 19:25:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.10 2020/01/18 19:20:23 nonaka Exp $	 */
+/*	$NetBSD: devopen.c,v 1.11 2020/01/18 19:25:58 nonaka Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@ bios2dev(int biosdev, daddr_t sector, ch
 		*devname = "hd";
 
 	(void)biosdisk_findpartition(biosdev, sector, partition, part_name);
-	if (*part_name != NULL) {
+	if (part_name != NULL && *part_name != NULL) {
 		snprintf(savedevname, sizeof(savedevname),
 		"NAME=%s", *part_name);
 		*devname = savedevname;



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

2020-01-18 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jan 18 19:20:23 UTC 2020

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

Log Message:
fix indent.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/arch/i386/stand/efiboot/devopen.c:1.10
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.9	Tue Dec 10 02:02:47 2019
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Sat Jan 18 19:20:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.9 2019/12/10 02:02:47 manu Exp $	 */
+/*	$NetBSD: devopen.c,v 1.10 2020/01/18 19:20:23 nonaka Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@ bios2dev(int biosdev, daddr_t sector, ch
 	if (*part_name != NULL) {
 		snprintf(savedevname, sizeof(savedevname),
 		"NAME=%s", *part_name);
-			*devname = savedevname;
+		*devname = savedevname;
 	}
 }
 



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

2019-12-16 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Tue Dec 17 01:37:53 UTC 2019

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

Log Message:
Do not use NAME=label syntax when label are empty

When booting sysinst from UEFI, it defaults to a GPT installation
where partition have no labels. Bootstrap used the NAME=label partition
anyway, with the result that both EFI and FFS root partition had
the same name "NAME=" and could not be distinguished. The first matching
partition for the name was used, and bootstrap looked for the kernel
in the EFI partition.

We fix that by not using NAME=label names for partition when label
is empty. In that case we revert to old syntax such as hd0b


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efidisk.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/i386/stand/lib/biosdisk.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/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.8 src/sys/arch/i386/stand/efiboot/efidisk.c:1.9
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.8	Sun Aug 18 02:18:24 2019
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Tue Dec 17 01:37:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.8 2019/08/18 02:18:24 manu Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.9 2019/12/17 01:37:52 manu Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -253,7 +253,7 @@ efi_disk_show(void)
 printf(" ");
 first = false;
 			}
-			if (part[i].part_name != NULL)
+			if (part[i].part_name && part[i].part_name[0])
 printf(" NAME=%s(", part[i].part_name);
 			else
 printf(" hd%d%c(", edi->dev & 0x7f, i + 'a');
@@ -308,7 +308,7 @@ efi_disk_show(void)
 printf(" ");
 first = 0;
 			}
-			if (part[j].part_name != NULL)
+			if (part[j].part_name && part[j].part_name[0])
 printf(" NAME=%s(", part[j].part_name);
 			else
 printf(" raid%d%c(",

Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.53 src/sys/arch/i386/stand/lib/biosdisk.c:1.54
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.53	Tue Dec 10 02:02:47 2019
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Dec 17 01:37:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.53 2019/12/10 02:02:47 manu Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.54 2019/12/17 01:37:53 manu Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -908,7 +908,8 @@ biosdisk_probe(void)
 first = 0;
 			}
 #ifndef NO_GPT
-			if (d->part[part].part_name != NULL)
+			if (d->part[part].part_name &&
+			d->part[part].part_name[0])
 printf(" NAME=%s(", d->part[part].part_name);
 			else
 #endif
@@ -987,7 +988,8 @@ next_disk:
 first = 0;
 			}
 #ifndef NO_GPT
-			if (d->part[part].part_name != NULL)
+			if (d->part[part].part_name &&
+			d->part[part].part_name[0])
 printf(" NAME=%s(", d->part[part].part_name);
 			else
 #endif
@@ -1095,7 +1097,9 @@ biosdisk_findpartition(int biosdev, dadd
 
 		*partition = boot_part;
 #ifndef NO_GPT
-		if (part_name && d->part[boot_part].part_name) {
+		if (part_name &&
+		d->part[boot_part].part_name &&
+		d->part[boot_part].part_name[0]) {
 			strlcpy(namebuf, d->part[boot_part].part_name,
 BIOSDISK_PART_NAME_LEN);
 			*part_name = namebuf;



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

2019-12-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 15 03:38:17 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: vbe.c

Log Message:
PR/54767: elo: fix incorrect test (mlelstv)
Add symbolic constants and reference to the standard.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/lib/vbe.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/lib/vbe.c
diff -u src/sys/arch/i386/stand/lib/vbe.c:1.9 src/sys/arch/i386/stand/lib/vbe.c:1.10
--- src/sys/arch/i386/stand/lib/vbe.c:1.9	Tue Jan 24 06:09:14 2017
+++ src/sys/arch/i386/stand/lib/vbe.c	Sat Dec 14 22:38:17 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: vbe.c,v 1.9 2017/01/24 11:09:14 nonaka Exp $ */
+/* $NetBSD: vbe.c,v 1.10 2019/12/15 03:38:17 christos Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -45,19 +45,57 @@ static struct _vbestate {
 	int		modenum;
 } vbestate;
 
+/*
+ * https://pdos.csail.mit.edu/6.828/2018/readings/hardware/vbe3.pdf
+ * p32
+ */
+#define	VBE_MODEATTR_MODE_HARDWARE_SUPPORTED		0x0001u
+#define	VBE_MODEATTR_RESERVED_10x0002u
+#define	VBE_MODEATTR_TTY_OUTPUT_FUNCTIONS_SUPPORTED	0x0004u
+#define	VBE_MODEATTR_COLOR_MODE0x0008u
+#define	VBE_MODEATTR_GRAPHICS_MODE			0x0010u
+#define	VBE_MODEATTR_VGA_COMPATIBLE_MODE		0x0020u
+#define	VBE_MODEATTR_VGA_COMPATIBLE_WINDOWD_MEMORY_MODE	0x0040u
+#define	VBE_MODEATTR_LINEAR_FRAME_BUFFER_MODE		0x0080u
+#define	VBE_MODEATTR_DOUBLE_SCAN_MODE			0x0100u
+#define	VBE_MODEATTR_INTERLACED_MODE			0x0200u
+#define	VBE_MODEATTR_HARDWARE_TRIPPLE_BUFFERING_SUPPORT	0x0400u
+#define	VBE_MODEATTR_HARDWARE_STEREOSCOPIC_SUPPORT	0x0800u
+#define	VBE_MODEATTR_DUAL_DISPLAY_START_ADDRESS_SUPPORT	0x1000u
+#define	VBE_MODEATTR_RESERVED_20x2000u
+#define	VBE_MODEATTR_RESERVED_30x4000u
+#define	VBE_MODEATTR_RESERVED_40x8000u
+
+/*
+ * p36
+ */
+#define VBE_MEMMODEL_TEXT		0x00u
+#define	VBE_MEMMODEL_CGA		0x01u
+#define	VBE_MEMMODEL_HERCULES		0x02u
+#define	VBE_MEMMODEL_PLANAR		0x03u
+#define	VBE_MEMMODEL_PACKED_PIXEL	0x04u
+#define	VBE_MEMMODEL_NON_CHAIN_4_256	0x05u
+#define	VBE_MEMMODEL_DIRECT_COLOR	0x06u
+#define	VBE_MEMMODEL_YUV		0x07u
+/* VESA Reserved 			0x08u-0x0fu */
+/* OEM Reserved0x10u-0xffU */
+
+
 static int
 vbe_mode_is_supported(struct modeinfoblock *mi)
 {
-	if ((mi->ModeAttributes & 0x01) == 0)
+	if ((mi->ModeAttributes & VBE_MODEATTR_MODE_HARDWARE_SUPPORTED) == 0)
 		return 0;	/* mode not supported by hardware */
-	if ((mi->ModeAttributes & 0x08) == 0)
-		return 0;	/* linear fb not available */
-	if ((mi->ModeAttributes & 0x10) == 0)
+	if ((mi->ModeAttributes & VBE_MODEATTR_COLOR_MODE) == 0)
+		return 0;	/* only color modes are supported */
+	if ((mi->ModeAttributes & VBE_MODEATTR_GRAPHICS_MODE) == 0)
 		return 0;	/* text mode */
+	if ((mi->ModeAttributes & VBE_MODEATTR_LINEAR_FRAME_BUFFER_MODE) == 0)
+		return 0;	/* linear fb not available */
 	if (mi->NumberOfPlanes != 1)
 		return 0;	/* planar mode not supported */
-	if (mi->MemoryModel != 0x04 /* Packed pixel */ &&
-	mi->MemoryModel != 0x06 /* Direct Color */)
+	if (mi->MemoryModel != VBE_MEMMODEL_PACKED_PIXEL /* Packed pixel */ &&
+	mi->MemoryModel != VBE_MEMMODEL_DIRECT_COLOR /* Direct Color */)
 		return 0;	/* unsupported pixel format */
 	return 1;
 }



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

2019-12-09 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Tue Dec 10 02:02:48 UTC 2019

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

Log Message:
In-RAID partitions with no name can be candidate for booting

The code to select boot partition in RAID assumed thet had a name,
which is true when there is a GPT inside the RAID, but not when there
is a disklabel inside the RAID. This caused a regression from behavior
of NetBSD 8.1.

We fix this by allowing nameless partition to be boot candidates.
This fixes misc/54748

While there, let raid device be used in the boot specification, like
raid0a:/netbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/boot/devopen.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/devopen.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/i386/stand/lib/biosdisk.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/boot/devopen.c
diff -u src/sys/arch/i386/stand/boot/devopen.c:1.9 src/sys/arch/i386/stand/boot/devopen.c:1.10
--- src/sys/arch/i386/stand/boot/devopen.c:1.9	Sun Aug 18 02:18:24 2019
+++ src/sys/arch/i386/stand/boot/devopen.c	Tue Dec 10 02:02:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.9 2019/08/18 02:18:24 manu Exp $	 */
+/*	$NetBSD: devopen.c,v 1.10 2019/12/10 02:02:47 manu Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@ devopen(struct open_file *f, const char 
 	if (strstr(devname, "raid") == devname) {
 		f->f_dev = [0];		/* must be biosdisk */
 
-		return biosdisk_open_name(f, devname);
+		return biosdisk_open_name(f, fname);
 	}
 #endif
 

Index: src/sys/arch/i386/stand/efiboot/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.8 src/sys/arch/i386/stand/efiboot/devopen.c:1.9
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.8	Thu Sep 26 12:21:03 2019
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Tue Dec 10 02:02:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.8 2019/09/26 12:21:03 nonaka Exp $	 */
+/*	$NetBSD: devopen.c,v 1.9 2019/12/10 02:02:47 manu Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -151,6 +151,7 @@ int
 devopen(struct open_file *f, const char *fname, char **file)
 {
 	char *fsname, *devname;
+	const char *xname = NULL;
 	int unit, partition;
 	int biosdev;
 	int i, error;
@@ -172,8 +173,12 @@ devopen(struct open_file *f, const char 
 	nfsys = nfsys_disk;
 
 	/* Search by GPT label or raidframe name */
-	if ((strstr(devname, "NAME=") == devname) ||
-	(strstr(devname, "raid") == devname)) {
+	if (strstr(devname, "NAME=") == devname)
+		xname = devname;
+	if (strstr(devname, "raid") == devname)
+		xname = fname;
+
+	if (xname != NULL) {
 		f->f_dev = [0];		/* must be biosdisk */
 
 		if (!kernel_loaded) {
@@ -181,7 +186,7 @@ devopen(struct open_file *f, const char 
 			BI_ADD(, BTINFO_BOOTPATH, sizeof(bibp));
 		}
 
-		error = biosdisk_open_name(f, devname);
+		error = biosdisk_open_name(f, xname);
 		return error;
 	}
 

Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.52 src/sys/arch/i386/stand/lib/biosdisk.c:1.53
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.52	Fri Sep 13 02:19:46 2019
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Dec 10 02:02:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.52 2019/09/13 02:19:46 manu Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.53 2019/12/10 02:02:47 manu Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -1401,9 +1401,9 @@ next_disk:
 continue;
 			if (d->part[part].fstype == FS_UNUSED)
 continue;
-			if (d->part[part].part_name == NULL)
-continue;
-			if (strcmp(d->part[part].part_name, name) == 0) {
+
+			if (d->part[part].part_name != NULL &&
+			strcmp(d->part[part].part_name, name) == 0) {
 *biosdev = raidframe[i].biosdev;
 *offset = raidframe[i].offset
 	+ RF_PROTECTED_SECTORS



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

2019-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec  7 02:29:03 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
loadfile sets errno, return the correct error, not EIO.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/stand/lib/exec.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/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.74 src/sys/arch/i386/stand/lib/exec.c:1.75
--- src/sys/arch/i386/stand/lib/exec.c:1.74	Thu Sep 12 22:19:46 2019
+++ src/sys/arch/i386/stand/lib/exec.c	Fri Dec  6 21:29:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.74 2019/09/13 02:19:46 manu Exp $	 */
+/*	$NetBSD: exec.c,v 1.75 2019/12/07 02:29:03 christos Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -321,7 +321,7 @@ common_load_prekern(const char *file, u_
 	/* Load the prekern (static) */
 	flags = LOAD_KERNEL & ~(LOAD_HDR|LOAD_SYM);
 	if ((fd = loadfile(prekernpath, marks, flags)) == -1)
-		return EIO;
+		return errno;
 	close(fd);
 
 	prekern_start = marks[MARK_START];
@@ -334,7 +334,7 @@ common_load_prekern(const char *file, u_
 	/* Load the kernel (dynamic) */
 	flags = (LOAD_KERNEL | LOAD_DYN) & ~(floppy ? LOAD_BACKWARDS : 0);
 	if ((fd = loadfile(file, marks, flags)) == -1)
-		return EIO;
+		return errno;
 	close(fd);
 
 	kernpa_end = marks[MARK_END] - loadaddr;
@@ -399,7 +399,7 @@ common_load_kernel(const char *file, u_l
 		 */
 		marks[MARK_START] = loadaddr;
 		if ((fd = loadfile(file, marks, COUNT_KERNEL)) == -1)
-			return EIO;
+			return errno;
 		close(fd);
 
 		kernsize = marks[MARK_END];
@@ -413,7 +413,7 @@ common_load_kernel(const char *file, u_l
 	marks[MARK_START] = loadaddr;
 	if ((fd = loadfile(file, marks,
 	LOAD_KERNEL & ~(floppy ? LOAD_BACKWARDS : 0))) == -1)
-		return EIO;
+		return errno;
 
 	close(fd);
 



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

2019-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Apr 17 06:50:34 UTC 2019

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

Log Message:
efiboot: Don't panic when BLOCK_IO_PROTOCOL is not found.

It has been reported that there is a machine where BLOCK_IO_PROTOCOL
can not be found when network boot without disk.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/efidisk.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/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.6 src/sys/arch/i386/stand/efiboot/efidisk.c:1.7
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.6	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Wed Apr 17 06:50:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.6 2018/04/11 10:32:09 nonaka Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.7 2019/04/17 06:50:34 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -57,8 +57,7 @@ efi_disk_probe(void)
 	status = LibLocateHandle(ByProtocol, , NULL,
 	, );
 	if (EFI_ERROR(status))
-		panic("LocateHandle(BlockIoProtocol): %" PRIxMAX,
-		(uintmax_t)status);
+		return;
 
 	if (efi_bootdp != NULL)
 		depth = efi_device_path_depth(efi_bootdp, MEDIA_DEVICE_PATH);
@@ -76,8 +75,7 @@ efi_disk_probe(void)
 		status = uefi_call_wrapper(BS->HandleProtocol, 3, handles[i],
 		, (void **));
 		if (EFI_ERROR(status))
-			panic("HandleProtocol(BlockIoProtocol): %" PRIxMAX,
-			(uintmax_t)status);
+			continue;
 
 		media = bio->Media;
 		if (media->LogicalPartition || !media->MediaPresent)



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

2019-01-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 04:56:46 UTC 2019

Modified Files:
src/sys/arch/i386/stand: Makefile.inc
src/sys/arch/i386/stand/genprom: Makefile
src/sys/arch/i386/stand/misc: Makefile

Log Message:
fix duplicated chunk from merge


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/stand/Makefile.inc
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/genprom/Makefile
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/misc/Makefile

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/Makefile.inc
diff -u src/sys/arch/i386/stand/Makefile.inc:1.17 src/sys/arch/i386/stand/Makefile.inc:1.18
--- src/sys/arch/i386/stand/Makefile.inc:1.17	Sun Jan 27 02:08:38 2019
+++ src/sys/arch/i386/stand/Makefile.inc	Sun Jan 27 04:56:46 2019
@@ -1,9 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.17 2019/01/27 02:08:38 pgoyette Exp $
-
-NOLIBCSANITIZER=
-NOSANITIZER=
-NOPIE=
-NOMAN=
+#	$NetBSD: Makefile.inc,v 1.18 2019/01/27 04:56:46 dholland Exp $
 
 NOLIBCSANITIZER=
 NOSANITIZER=

Index: src/sys/arch/i386/stand/genprom/Makefile
diff -u src/sys/arch/i386/stand/genprom/Makefile:1.9 src/sys/arch/i386/stand/genprom/Makefile:1.10
--- src/sys/arch/i386/stand/genprom/Makefile:1.9	Sun Jan 27 02:08:38 2019
+++ src/sys/arch/i386/stand/genprom/Makefile	Sun Jan 27 04:56:46 2019
@@ -1,6 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2019/01/27 02:08:38 pgoyette Exp $
-
-.include 
+#	$NetBSD: Makefile,v 1.10 2019/01/27 04:56:46 dholland Exp $
 
 .include 
 

Index: src/sys/arch/i386/stand/misc/Makefile
diff -u src/sys/arch/i386/stand/misc/Makefile:1.10 src/sys/arch/i386/stand/misc/Makefile:1.11
--- src/sys/arch/i386/stand/misc/Makefile:1.10	Sun Jan 27 02:08:38 2019
+++ src/sys/arch/i386/stand/misc/Makefile	Sun Jan 27 04:56:46 2019
@@ -1,6 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2019/01/27 02:08:38 pgoyette Exp $
-
-.include 
+#	$NetBSD: Makefile,v 1.11 2019/01/27 04:56:46 dholland Exp $
 
 .include 
 



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

2018-12-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 24 18:21:50 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot/bootia32: ldscript
src/sys/arch/i386/stand/efiboot/bootx64: ldscript

Log Message:
Avoid error with new binutils:
error: PHDR segment not covered by LOAD segment


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

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/ldscript
diff -u src/sys/arch/i386/stand/efiboot/bootia32/ldscript:1.1 src/sys/arch/i386/stand/efiboot/bootia32/ldscript:1.2
--- src/sys/arch/i386/stand/efiboot/bootia32/ldscript:1.1	Tue Jan 24 06:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/bootia32/ldscript	Mon Dec 24 13:21:50 2018
@@ -1,7 +1,14 @@
-/*	$NetBSD: ldscript,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: ldscript,v 1.2 2018/12/24 18:21:50 christos Exp $	*/
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
 ENTRY(_start)
+
+PHDRS
+{
+  text PT_LOAD;
+  headers PT_PHDR FILEHDR PHDRS;
+}
+
 SECTIONS
 {
   . = 0;
@@ -13,7 +20,7 @@ SECTIONS
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
-  }
+  } :text
   . = ALIGN(4096);
   .sdata :
   {

Index: src/sys/arch/i386/stand/efiboot/bootx64/ldscript
diff -u src/sys/arch/i386/stand/efiboot/bootx64/ldscript:1.1 src/sys/arch/i386/stand/efiboot/bootx64/ldscript:1.2
--- src/sys/arch/i386/stand/efiboot/bootx64/ldscript:1.1	Tue Jan 24 06:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/bootx64/ldscript	Mon Dec 24 13:21:50 2018
@@ -1,8 +1,15 @@
-/*	$NetBSD: ldscript,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: ldscript,v 1.2 2018/12/24 18:21:50 christos Exp $	*/
 /* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
 OUTPUT_ARCH(i386:x86-64)
 ENTRY(_start)
+
+PHDRS
+{
+  text PT_LOAD;
+  headers PT_PHDR FILEHDR PHDRS;
+}
+
 SECTIONS
 {
   . = 0;
@@ -19,7 +26,7 @@ SECTIONS
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
-  }
+  } :text
   . = ALIGN(4096);
   .reloc :
   {



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

2018-11-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  8 23:20:52 UTC 2018

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

Log Message:
revert previous; does not fix the issue


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

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
diff -u src/sys/arch/i386/stand/efiboot/Makefile:1.4 src/sys/arch/i386/stand/efiboot/Makefile:1.5
--- src/sys/arch/i386/stand/efiboot/Makefile:1.4	Thu Nov  8 16:47:04 2018
+++ src/sys/arch/i386/stand/efiboot/Makefile	Thu Nov  8 18:20:52 2018
@@ -1,6 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2018/11/08 21:47:04 christos Exp $
-
-.include 
+#	$NetBSD: Makefile,v 1.5 2018/11/08 23:20:52 christos Exp $
 
 SUBDIR=	bootia32
 .if ${MACHINE} == "amd64"



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

2018-11-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  8 21:47:04 UTC 2018

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

Log Message:
Don't build this as a PIE binary, PIE binaries need PHDR and this barfs
under the new binutils: error: PHDR segment not covered by LOAD segment
[including bsd.init.mk includes ../Makefile.inc which disables PIE like
 all the other bootloaders do]


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

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
diff -u src/sys/arch/i386/stand/efiboot/Makefile:1.3 src/sys/arch/i386/stand/efiboot/Makefile:1.4
--- src/sys/arch/i386/stand/efiboot/Makefile:1.3	Sun Jul  8 13:01:02 2018
+++ src/sys/arch/i386/stand/efiboot/Makefile	Thu Nov  8 16:47:04 2018
@@ -1,4 +1,6 @@
-#	$NetBSD: Makefile,v 1.3 2018/07/08 17:01:02 christos Exp $
+#	$NetBSD: Makefile,v 1.4 2018/11/08 21:47:04 christos Exp $
+
+.include 
 
 SUBDIR=	bootia32
 .if ${MACHINE} == "amd64"



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

2018-08-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Aug 17 04:59:34 UTC 2018

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

Log Message:
Deal with gnu-efi upgrade - "efilib.h" now provides a prototype
for VPrint() so it is no longer needed here, particularly not a
slightly different prototype.   Fixes the amd64 i386 & ia64 builds.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/panic.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/panic.c
diff -u src/sys/arch/i386/stand/efiboot/panic.c:1.4 src/sys/arch/i386/stand/efiboot/panic.c:1.5
--- src/sys/arch/i386/stand/efiboot/panic.c:1.4	Sat Feb 11 10:15:55 2017
+++ src/sys/arch/i386/stand/efiboot/panic.c	Fri Aug 17 04:59:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: panic.c,v 1.4 2017/02/11 10:15:55 nonaka Exp $	*/
+/*	$NetBSD: panic.c,v 1.5 2018/08/17 04:59:34 kre Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -30,9 +30,6 @@
 
 #include 
 
-/* from sys/external/bsd/gnu-efi/dist/lib/print.c */
-UINTN VPrint (IN CHAR16 *, va_list);
-
 __dead VOID
 Panic(
 IN CHAR16 *fmt,



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

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 17:01:02 UTC 2018

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

Log Message:
use += :-)


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

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
diff -u src/sys/arch/i386/stand/efiboot/Makefile:1.2 src/sys/arch/i386/stand/efiboot/Makefile:1.3
--- src/sys/arch/i386/stand/efiboot/Makefile:1.2	Sun Jul  8 12:50:28 2018
+++ src/sys/arch/i386/stand/efiboot/Makefile	Sun Jul  8 13:01:02 2018
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.2 2018/07/08 16:50:28 christos Exp $
+#	$NetBSD: Makefile,v 1.3 2018/07/08 17:01:02 christos Exp $
 
 SUBDIR=	bootia32
 .if ${MACHINE} == "amd64"
-SUBDIR=		bootx64
+SUBDIR+=	bootx64
 .endif
 
 .include 



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

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 16:50:28 UTC 2018

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

Log Message:
Enable efiboot on i386, for 32 bit bootblocks


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

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/Makefile
diff -u src/sys/arch/i386/stand/Makefile:1.28 src/sys/arch/i386/stand/Makefile:1.29
--- src/sys/arch/i386/stand/Makefile:1.28	Tue Jan 24 06:09:14 2017
+++ src/sys/arch/i386/stand/Makefile	Sun Jul  8 12:50:27 2018
@@ -1,11 +1,9 @@
-#	$NetBSD: Makefile,v 1.28 2017/01/24 11:09:14 nonaka Exp $
+#	$NetBSD: Makefile,v 1.29 2018/07/08 16:50:27 christos Exp $
 
 SUBDIR=		mbr boot
 SUBDIR+=	bootxx cdboot fatboot
 SUBDIR+=	dosboot misc
 SUBDIR+=	pxeboot
-.if ${MACHINE} == "amd64"
 SUBDIR+=	efiboot
-.endif
 
 .include 

Index: src/sys/arch/i386/stand/efiboot/Makefile
diff -u src/sys/arch/i386/stand/efiboot/Makefile:1.1 src/sys/arch/i386/stand/efiboot/Makefile:1.2
--- src/sys/arch/i386/stand/efiboot/Makefile:1.1	Tue Jan 24 06:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile	Sun Jul  8 12:50:28 2018
@@ -1,6 +1,8 @@
-#	$NetBSD: Makefile,v 1.1 2017/01/24 11:09:14 nonaka Exp $
+#	$NetBSD: Makefile,v 1.2 2018/07/08 16:50:28 christos Exp $
 
+SUBDIR=	bootia32
+.if ${MACHINE} == "amd64"
 SUBDIR=		bootx64
-SUBDIR+=	bootia32
+.endif
 
 .include 



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

2018-06-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jun 26 10:15:37 UTC 2018

Modified Files:
src/sys/arch/i386/stand/misc: Makefile
Removed Files:
src/sys/arch/i386/stand/misc: rawr32.exe.uue

Log Message:
Remove Rawrite32 installer - no point having an outdated version on
some install media, the windows machine it needs to run on will
have internet and can easily download it.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/misc/Makefile
cvs rdiff -u -r1.7 -r0 src/sys/arch/i386/stand/misc/rawr32.exe.uue

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/misc/Makefile
diff -u src/sys/arch/i386/stand/misc/Makefile:1.8 src/sys/arch/i386/stand/misc/Makefile:1.9
--- src/sys/arch/i386/stand/misc/Makefile:1.8	Tue May  1 19:59:45 2018
+++ src/sys/arch/i386/stand/misc/Makefile	Tue Jun 26 10:15:36 2018
@@ -1,10 +1,9 @@
-#	$NetBSD: Makefile,v 1.8 2018/05/01 19:59:45 christos Exp $
+#	$NetBSD: Makefile,v 1.9 2018/06/26 10:15:36 martin Exp $
 
 .include 
 
 MISC_FILES=	rawrite.c
 UUDECODE_FILES=	pfdisk.doc pfdisk.exe pfdisktc.zip \
-		rawr32.exe \
 		rawrite.doc rawrite.exe
 
 .include 



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

2018-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 13 16:03:10 UTC 2018

Modified Files:
src/sys/arch/i386/stand/lib: Makefile.inc

Log Message:
revert previous MAKEOBJDIRPREFIX massaging


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

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/lib/Makefile.inc
diff -u src/sys/arch/i386/stand/lib/Makefile.inc:1.18 src/sys/arch/i386/stand/lib/Makefile.inc:1.19
--- src/sys/arch/i386/stand/lib/Makefile.inc:1.18	Mon Jun 11 17:35:13 2018
+++ src/sys/arch/i386/stand/lib/Makefile.inc	Wed Jun 13 12:03:10 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.18 2018/06/11 21:35:13 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.19 2018/06/13 16:03:10 christos Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -24,7 +24,7 @@ CWARNFLAGS.clang+=	-Wno-tautological-com
 I386MAKE= \
 	cd ${I386DIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
 	MAKEOBJDIR=${I386DST} ${MAKE} \
-	CC=${CC:q} CFLAGS=${CFLAGS:S/MAKEOBJDIRPREFIX/MAKEOBJDIR/:q} \
+	CC=${CC:q} CFLAGS=${CFLAGS:q} \
 	AS=${AS:q} AFLAGS=${AFLAGS:q} \
 	LD=${LD:q} STRIP=${STRIP:q} \
 	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \



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

2018-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 12 21:35:17 UTC 2018

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

Log Message:
Set NOSANITIZER in i386 mbr files

This is required to build these files and keep then functional with
enabled MKSANITIZER.

Sponsored by 


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

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/mbr/Makefile.mbr
diff -u src/sys/arch/i386/stand/mbr/Makefile.mbr:1.19 src/sys/arch/i386/stand/mbr/Makefile.mbr:1.20
--- src/sys/arch/i386/stand/mbr/Makefile.mbr:1.19	Sun Jan 12 15:26:29 2014
+++ src/sys/arch/i386/stand/mbr/Makefile.mbr	Tue Jun 12 21:35:17 2018
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile.mbr,v 1.19 2014/01/12 15:26:29 tsutsui Exp $
+#	$NetBSD: Makefile.mbr,v 1.20 2018/06/12 21:35:17 kamil Exp $
 
 S=		${.CURDIR}/../../../../..
 
+NOSANITIZER=	# defined
 NOMAN=		# defined
 
 LIBCRT0=	# nothing



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

2018-06-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 11 21:35:13 UTC 2018

Modified Files:
src/sys/arch/i386/stand/lib: Makefile.inc

Log Message:
switch CFLAGS from using MAKEOBJDIRPREFIX to MAKEOBJDIR. This whole thing
is disgusting, but fixing it properly. requires restructuring


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

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/lib/Makefile.inc
diff -u src/sys/arch/i386/stand/lib/Makefile.inc:1.17 src/sys/arch/i386/stand/lib/Makefile.inc:1.18
--- src/sys/arch/i386/stand/lib/Makefile.inc:1.17	Sat May 26 21:14:50 2018
+++ src/sys/arch/i386/stand/lib/Makefile.inc	Mon Jun 11 17:35:13 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.17 2018/05/27 01:14:50 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.18 2018/06/11 21:35:13 christos Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -24,7 +24,7 @@ CWARNFLAGS.clang+=	-Wno-tautological-com
 I386MAKE= \
 	cd ${I386DIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
 	MAKEOBJDIR=${I386DST} ${MAKE} \
-	CC=${CC:q} CFLAGS=${CFLAGS:q} \
+	CC=${CC:q} CFLAGS=${CFLAGS:S/MAKEOBJDIRPREFIX/MAKEOBJDIR/:q} \
 	AS=${AS:q} AFLAGS=${AFLAGS:q} \
 	LD=${LD:q} STRIP=${STRIP:q} \
 	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \



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

2018-06-08 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jun  8 11:52:30 UTC 2018

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

Log Message:
Remove unused include.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/arch/i386/stand/efiboot/efiboot.c:1.8
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.7	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Fri Jun  8 11:52:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.7 2018/04/11 10:32:09 nonaka Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.8 2018/06/08 11:52:30 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -28,7 +28,6 @@
 
 #include "efiboot.h"
 
-#include "biosdisk_ll.h"
 #include "bootinfo.h"
 #include "devopen.h"
 



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

2018-06-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun  2 14:30:07 UTC 2018

Modified Files:
src/sys/arch/i386/stand: Makefile.booters Makefile.inc
src/sys/arch/i386/stand/boot: Makefile.boot
src/sys/arch/i386/stand/bootxx: Makefile.bootxx
src/sys/arch/i386/stand/cdboot: Makefile
src/sys/arch/i386/stand/dosboot: Makefile
src/sys/arch/i386/stand/efiboot: Makefile.efiboot
src/sys/arch/i386/stand/fatboot: Makefile.fat
src/sys/arch/i386/stand/pxeboot: Makefile

Log Message:
- Disable MKSANITIZER
- Redo using NOPIE
- Add NORELRO


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/i386/stand/Makefile.booters
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/Makefile.inc
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/i386/stand/boot/Makefile.boot
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/stand/bootxx/Makefile.bootxx
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/cdboot/Makefile
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/i386/stand/dosboot/Makefile
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/fatboot/Makefile.fat
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/i386/stand/pxeboot/Makefile

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/Makefile.booters
diff -u src/sys/arch/i386/stand/Makefile.booters:1.91 src/sys/arch/i386/stand/Makefile.booters:1.92
--- src/sys/arch/i386/stand/Makefile.booters:1.91	Sat Apr  8 15:53:21 2017
+++ src/sys/arch/i386/stand/Makefile.booters	Sat Jun  2 10:30:06 2018
@@ -1,5 +1,6 @@
-#	$NetBSD: Makefile.booters,v 1.91 2017/04/08 19:53:21 christos Exp $
+#	$NetBSD: Makefile.booters,v 1.92 2018/06/02 14:30:06 christos Exp $
 
+NOSANITIZER=
 .include 
 
 STRIPFLAG=

Index: src/sys/arch/i386/stand/Makefile.inc
diff -u src/sys/arch/i386/stand/Makefile.inc:1.14 src/sys/arch/i386/stand/Makefile.inc:1.15
--- src/sys/arch/i386/stand/Makefile.inc:1.14	Wed Feb 21 20:37:04 2018
+++ src/sys/arch/i386/stand/Makefile.inc	Sat Jun  2 10:30:06 2018
@@ -1,4 +1,8 @@
-#	$NetBSD: Makefile.inc,v 1.14 2018/02/22 01:37:04 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2018/06/02 14:30:06 christos Exp $
+
+NOSANITIZER=
+NOPIE=
+NOMAN=
 
 .include 
 

Index: src/sys/arch/i386/stand/boot/Makefile.boot
diff -u src/sys/arch/i386/stand/boot/Makefile.boot:1.70 src/sys/arch/i386/stand/boot/Makefile.boot:1.71
--- src/sys/arch/i386/stand/boot/Makefile.boot:1.70	Sat Apr  8 15:53:21 2017
+++ src/sys/arch/i386/stand/boot/Makefile.boot	Sat Jun  2 10:30:06 2018
@@ -1,8 +1,10 @@
-# $NetBSD: Makefile.boot,v 1.70 2017/04/08 19:53:21 christos Exp $
+# $NetBSD: Makefile.boot,v 1.71 2018/06/02 14:30:06 christos Exp $
 
 S=	${.CURDIR}/../../../../..
 
 NOMAN=
+NOSANITIZER=
+NOPIE=
 PROG?= boot
 NEWVERSWHAT?= "BIOS Boot"
 
@@ -11,11 +13,7 @@ AFLAGS.biosboot.S= ${${ACTIVE_CC} == "cl
 SOURCES?= biosboot.S boot2.c conf.c devopen.c exec.c
 SRCS= ${SOURCES}
 
-PIE_CFLAGS=
-PIE_AFLAGS=
-PIE_LDFLAGS=
-
-.include 
+.include 
 
 STRIPFLAG=	# nothing
 

Index: src/sys/arch/i386/stand/bootxx/Makefile.bootxx
diff -u src/sys/arch/i386/stand/bootxx/Makefile.bootxx:1.49 src/sys/arch/i386/stand/bootxx/Makefile.bootxx:1.50
--- src/sys/arch/i386/stand/bootxx/Makefile.bootxx:1.49	Thu Aug 20 07:38:27 2015
+++ src/sys/arch/i386/stand/bootxx/Makefile.bootxx	Sat Jun  2 10:30:07 2018
@@ -1,14 +1,13 @@
-# $NetBSD: Makefile.bootxx,v 1.49 2015/08/20 11:38:27 uebayasi Exp $
+# $NetBSD: Makefile.bootxx,v 1.50 2018/06/02 14:30:07 christos Exp $
 
 S=	${.CURDIR}/../../../../..
 
 AFLAGS.bootxx.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
 AFLAGS.pbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
 
-PIE_CFLAGS=
-PIE_LDFLAGS=
-PIE_AFLAGS=
+NOPIE=
 NOMAN=
+NOSANITIZER=
 PROG?= bootxx_${FS}
 BINDIR= /usr/mdec
 BINMODE= 0444
@@ -23,7 +22,7 @@ BOOTXX_MAXSIZE?= $$(( ${BOOTXX_SECTORS} 
 
 SRCS= pbr.S label.S bootxx.S boot1.c
 
-.include 
+.include 
 
 STRIPFLAG=	# nothing
 

Index: src/sys/arch/i386/stand/cdboot/Makefile
diff -u src/sys/arch/i386/stand/cdboot/Makefile:1.14 src/sys/arch/i386/stand/cdboot/Makefile:1.15
--- src/sys/arch/i386/stand/cdboot/Makefile:1.14	Sun Jan 12 10:26:29 2014
+++ src/sys/arch/i386/stand/cdboot/Makefile	Sat Jun  2 10:30:07 2018
@@ -1,15 +1,10 @@
-#	$NetBSD: Makefile,v 1.14 2014/01/12 15:26:29 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.15 2018/06/02 14:30:07 christos Exp $
 
 S=		${.CURDIR}/../../../..
 
 AFLAGS.cdboot.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
 
-PIE_CFLAGS=
-PIE_LDFLAGS=
-PIE_AFLAGS=
-
-NOMAN=		# defined
-.include 
+.include 
 
 STRIPFLAG=	# nothing
 

Index: src/sys/arch/i386/stand/dosboot/Makefile
diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.30 src/sys/arch/i386/stand/dosboot/Makefile:1.31
--- src/sys/arch/i386/stand/dosboot/Makefile:1.30	Sat Jan 23 17:29:29 2016
+++ src/sys/arch/i386/stand/dosboot/Makefile	Sat Jun  2 10:30:07 

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

2018-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 19 18:19:37 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gpt.S

Log Message:
Fix some whitespace style issues.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/mbr/gpt.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/mbr/gpt.S
diff -u src/sys/arch/i386/stand/mbr/gpt.S:1.2 src/sys/arch/i386/stand/mbr/gpt.S:1.3
--- src/sys/arch/i386/stand/mbr/gpt.S:1.2	Sat May 19 18:18:16 2018
+++ src/sys/arch/i386/stand/mbr/gpt.S	Sat May 19 18:19:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.S,v 1.2 2018/05/19 18:18:16 jakllsch Exp $ */
+/*	$NetBSD: gpt.S,v 1.3 2018/05/19 18:19:37 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  *
  * NO_LBA_CHECK	- no check if bios supports LBA reads
  * NO_CRC_CHECK	- disable crc checks for GPT
- * NO_BANNER- do not output title line 'banner'
+ * NO_BANNER	- do not output title line 'banner'
  */
 
 #ifdef COM_PORT
@@ -143,7 +143,7 @@ ENTRY(start)
 	mov	%ax, %es
 	mov	%ax, %ds
 	movw	$mbr, %di
-	mov $BOOTADDR + (mbr - start), %si
+	mov	$BOOTADDR + (mbr - start), %si
 	push	%ax			/* zero for %cs of lret */
 	push	%di
 	movw	$(bss_start - mbr), %cx



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

2018-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 19 18:18:16 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gpt.S

Log Message:
Compact crc32 code by 12 bytes of text.

>From dave0 in #NetBSD on Freenode circa December 2017.

Tested in a 32-bit userland harness to produce identical results as old
code for one set of inputs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/mbr/gpt.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/mbr/gpt.S
diff -u src/sys/arch/i386/stand/mbr/gpt.S:1.1 src/sys/arch/i386/stand/mbr/gpt.S:1.2
--- src/sys/arch/i386/stand/mbr/gpt.S:1.1	Thu Jan  6 01:08:49 2011
+++ src/sys/arch/i386/stand/mbr/gpt.S	Sat May 19 18:18:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.S,v 1.1 2011/01/06 01:08:49 jakllsch Exp $ */
+/*	$NetBSD: gpt.S,v 1.2 2018/05/19 18:18:16 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -428,21 +428,14 @@ message_1:
  * %ebx		crc (returned)
  */
 crc32:
-	push	%dx			/* preserve drive number */
-	push	%ax			/* preserve original CRC */
-
-	xorl	%ebx, %ebx
-	decl	%ebx			/* init value */
+	orl	 $-1, %ebx		/* init value */
 1:
-	lodsb/* load next message byte to %al */
+	xorb	(%si), %bl		/* xoring next message byte with previous result */
+	inc	%si
 	movb	$8, %cl			/* set bit counter */
 2:
-	movb	%al, %dl
-	xorb	%bl, %dl		/* xoring with previous result */
 	shrl	$1, %ebx
-	shrb	$1, %al
-	testb	$1, %dl
-	jz	3f
+	jnc	3f
 crc32_poly = . + 3			/* gross, but saves a few bytes */
 	xorl	$0xedb88320, %ebx	/* EFI CRC32 Polynomial */
 3:
@@ -451,8 +444,6 @@ crc32_poly = . + 3			/* gross, but saves
 	jne	1b
 	notl	%ebx			/* result correction */
 
-	pop	%ax
-	pop	%dx
 	ret
 #endif
 



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

2018-05-16 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May 16 19:53:54 UTC 2018

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

Log Message:
During awaitkey(), move the cursor back to the beginning of the
countdown with '\b' only after waiting.

Some UEFI implementations have a destructive/erasing backspace,
and will not show the countdown if we move the cursor back before the
wait.

My ThinkPad T430 w/ Lenovo's UEFI exhibited this whiteout-backspace,
while my Gigabyte Brix GB-BXBT-2807 did not.

Should fix PR #53292.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/arch/i386/stand/efiboot/eficons.c:1.6
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.5	Tue Mar 27 14:15:05 2018
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Wed May 16 19:53:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.5 2018/03/27 14:15:05 nonaka Exp $	*/
+/*	$NetBSD: eficons.c,v 1.6 2018/05/16 19:53:54 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -328,10 +328,10 @@ awaitkey(int timeout, int tell)
 	char c = 0;
 
 	for (;;) {
-		if (tell && timeout) {
-			char numbuf[32];
-			int len;
+		char numbuf[32];
+		int len;
 
+		if (tell && timeout) {
 			len = snprintf(numbuf, sizeof(numbuf), "%d seconds. ",
 			timeout);
 			if (len > 0 && len < sizeof(numbuf)) {
@@ -340,7 +340,6 @@ awaitkey(int timeout, int tell)
 printf("%s", numbuf);
 while (*p)
 	*p++ = '\b';
-printf("%s", numbuf);
 			}
 		}
 		if (iskey(1)) {
@@ -355,6 +354,8 @@ awaitkey(int timeout, int tell)
 			internal_waitforinputevent(1000);
 		else
 			break;
+		if (tell)
+			printf("%s", numbuf);
 	}
 
 out:



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

2018-04-11 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Apr 11 10:32:10 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot boot.c conf.c
devopen.c devopen.h efiboot.c efiboot.h efidisk.c
Added Files:
src/sys/arch/i386/stand/efiboot: dev_net.c efinet.c efinet.h efipxe.c

Log Message:
efiboot: Added network boot support.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/conf.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/dev_net.c \
src/sys/arch/i386/stand/efiboot/efinet.c \
src/sys/arch/i386/stand/efiboot/efinet.h \
src/sys/arch/i386/stand/efiboot/efipxe.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/devopen.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/devopen.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/efiboot.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/efidisk.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.11 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.12
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.11	Tue Mar 27 14:15:05 2018
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Wed Apr 11 10:32:09 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.11 2018/03/27 14:15:05 nonaka Exp $
+# $NetBSD: Makefile.efiboot,v 1.12 2018/04/11 10:32:09 nonaka Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -8,12 +8,12 @@ NEWVERSWHAT?=	"EFI Boot"
 
 AFLAGS.start.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
 
-SOURCES?= start.S conf.c devopen.c efiboot.c self_reloc.c
-LIBI386SRCS= boot.c biosdisk.c bootinfo.c bootinfo_biosgeom.c
-LIBI386SRCS+= bootmenu.c diskbuf.c exec.c menuutils.c
-LIBI386SRCS+= panic.c parseutils.c pread.c
-LIBI386SRCS+= efichar.c eficons.c efidelay.c efidev.c efidisk.c efidisk_ll.c
-LIBI386SRCS+= efigetsecs.c efimemory.c
+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+= 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+= diskbuf.c exec.c menuutils.c parseutils.c pread.c
 SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS}
 
 PIE_CFLAGS=
@@ -57,10 +57,22 @@ CPPFLAGS+= -DSUPPORT_CD9660
 CPPFLAGS+= -D"devb2cdb(bno)=(bno)"
 CPPFLAGS+= -DSUPPORT_DOSFS
 CPPFLAGS+= -DSUPPORT_EXT2FS
+CPPFLAGS+= -DSUPPORT_BOOTP
+CPPFLAGS+= -DSUPPORT_DHCP
+CPPFLAGS+= -DSUPPORT_NFS
+#CPPFLAGS+= -DSUPPORT_TFTP
 CPPFLAGS+= -DPASS_BIOSGEOM
 CPPFLAGS+= -DBIOSDISK_DEFAULT_SECSIZE=2048	# for bootinfo_biosgeom.c
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
 
+#CPPFLAGS+= -DARP_DEBUG
+#CPPFLAGS+= -DBOOTP_DEBUG
+#CPPFLAGS+= -DNET_DEBUG
+#CPPFLAGS+= -DNETIF_DEBUG
+#CPPFLAGS+= -DNFS_DEBUG
+#CPPFLAGS+= -DRARP_DEBUG
+#CPPFLAGS+= -DRPC_DEBUG
+
 EFIDIR= ${S}/external/bsd/gnu-efi/dist
 GNUEFIARCH?= ${MACHINE_CPU}
 CPPFLAGS+= -I${EFIDIR}/inc -I${EFIDIR}/inc/${GNUEFIARCH}
@@ -69,12 +81,12 @@ CPPFLAGS+= -I${EFIDIR}/inc/protocol
 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT
 SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)"
-SAMISCMAKEFLAGS+= SA_USE_CREAD=yes  # Read compressed kernels
-SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no # Netboot via TFTP, NFS
 
 ### find out what to use for libsa
 SA_AS= library
 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
+SAMISCMAKEFLAGS+="SA_USE_CREAD=yes"
+SAMISCMAKEFLAGS+="SA_INCLUDE_NET=yes"
 SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA= ${SALIB}

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.9 src/sys/arch/i386/stand/efiboot/boot.c:1.10
--- src/sys/arch/i386/stand/efiboot/boot.c:1.9	Mon Apr  2 09:44:18 2018
+++ src/sys/arch/i386/stand/efiboot/boot.c	Wed Apr 11 10:32:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.9 2018/04/02 09:44:18 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.10 2018/04/11 10:32:09 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -182,6 +182,21 @@ parsebootfile(const char *fname, char **
 }
 
 static char *
+snprint_bootdev(char *buf, size_t bufsize, const char *devname, int unit,
+int partition)
+{
+	static const char *no_partition_devs[] = { "esp", "net", "nfs", "tftp" };
+	int i;
+
+	for (i = 0; i < __arraycount(no_partition_devs); i++)
+		if (strcmp(devname, no_partition_devs[i]) == 0)
+			break;
+	snprintf(buf, bufsize, "%s%d%c", devname, unit,
+	i < __arraycount(no_partition_devs) ? '\0' : 'a' + partition);
+	return buf;
+}
+
+static char *
 

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

2018-03-27 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 27 14:15:05 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot boot.c efiboot.c
efiboot.h eficons.c efidelay.c efidisk.c efimemory.c
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c
src/sys/arch/i386/stand/efiboot/bootx64: efibootx64.c
Added Files:
src/sys/arch/i386/stand/efiboot: efichar.c

Log Message:
efiboot: Added serial console support.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/efiboot.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/efichar.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/eficons.c \
src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/efidelay.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/efidisk.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.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.10 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.11
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.10	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Tue Mar 27 14:15:05 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.10 2018/03/08 10:34:33 nonaka Exp $
+# $NetBSD: Makefile.efiboot,v 1.11 2018/03/27 14:15:05 nonaka Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -12,7 +12,7 @@ SOURCES?= start.S conf.c devopen.c efibo
 LIBI386SRCS= boot.c biosdisk.c bootinfo.c bootinfo_biosgeom.c
 LIBI386SRCS+= bootmenu.c diskbuf.c exec.c menuutils.c
 LIBI386SRCS+= panic.c parseutils.c pread.c
-LIBI386SRCS+= eficons.c efidelay.c efidev.c efidisk.c efidisk_ll.c
+LIBI386SRCS+= efichar.c eficons.c efidelay.c efidev.c efidisk.c efidisk_ll.c
 LIBI386SRCS+= efigetsecs.c efimemory.c
 SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS}
 

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.7 src/sys/arch/i386/stand/efiboot/boot.c:1.8
--- src/sys/arch/i386/stand/efiboot/boot.c:1.7	Tue Mar 20 10:18:10 2018
+++ src/sys/arch/i386/stand/efiboot/boot.c	Tue Mar 27 14:15:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.7 2018/03/20 10:18:10 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.8 2018/03/27 14:15:05 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -463,11 +463,16 @@ command_consdev(char *arg)
 	char *sep, *sep2 = NULL;
 	int ioport, speed = 0;
 
+	if (*arg == '\0') {
+		efi_cons_show();
+		return;
+	}
+
 	sep = strchr(arg, ',');
 	if (sep != NULL) {
 		*sep++ = '\0';
 		sep2 = strchr(sep, ',');
-		if (sep != NULL)
+		if (sep2 != NULL)
 			*sep2++ = '\0';
 	}
 
@@ -555,6 +560,8 @@ void
 command_version(char *arg)
 {
 	CHAR16 *path;
+	char *upath, *ufirmware;
+	int rv;
 
 	if (strcmp(arg, "full") == 0) {
 		printf("ImageBase: 0x%" PRIxPTR "\n",
@@ -562,12 +569,24 @@ command_version(char *arg)
 		printf("Stack: 0x%" PRIxPTR "\n", efi_main_sp);
 		printf("EFI version: %d.%02d\n",
 		ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0x);
-		Print(L"EFI Firmware: %s (rev %d.%02d)\n", ST->FirmwareVendor,
-		ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0x);
+		ufirmware = NULL;
+		rv = ucs2_to_utf8(ST->FirmwareVendor, );
+		if (rv == 0) {
+			printf("EFI Firmware: %s (rev %d.%02d)\n", ufirmware,
+			ST->FirmwareRevision >> 16,
+			ST->FirmwareRevision & 0x);
+			FreePool(ufirmware);
+		}
 		path = DevicePathToStr(efi_bootdp);
-		Print(L"Boot DevicePath: %d:%d:%s\n", DevicePathType(efi_bootdp),
-		DevicePathSubType(efi_bootdp), path);
+		upath = NULL;
+		rv = ucs2_to_utf8(path, );
 		FreePool(path);
+		if (rv == 0) {
+			printf("Boot DevicePath: %d:%d:%s\n",
+			DevicePathType(efi_bootdp),
+			DevicePathSubType(efi_bootdp), upath);
+			FreePool(upath);
+		}
 	}
 
 	printf("\n"
@@ -603,7 +622,9 @@ command_devpath(char *arg)
 	EFI_HANDLE *handles;
 	EFI_DEVICE_PATH *dp0, *dp;
 	CHAR16 *path;
+	char *upath;
 	UINTN cols, rows, row = 0;
+	int rv;
 
 	status = uefi_call_wrapper(ST->ConOut->QueryMode, 4, ST->ConOut,
 	ST->ConOut->Mode->Mode, , );
@@ -626,41 +647,54 @@ command_devpath(char *arg)
 		if (EFI_ERROR(status))
 			break;
 
-		Print(L"DevicePathType %d\n", DevicePathType(dp0));
+		printf("DevicePathType %d\n", DevicePathType(dp0));
 		if (++row >= rows) {
 			row = 0;
-			Print(L"Press Any Key to continue :");
+			printf("Press Any Key to continue :");
 			(void) awaitkey(-1, 0);
-			

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

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 10:21:01 UTC 2018

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
efiboot: fix to find boot partition process.

NetBSD related partitions with no bootme flag set are also candidates
for boot partition.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/stand/lib/biosdisk.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/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.47 src/sys/arch/i386/stand/lib/biosdisk.c:1.48
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.47	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Mar 20 10:21:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.47 2018/03/08 10:34:33 nonaka Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.48 2018/03/20 10:21:01 nonaka Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -802,20 +802,21 @@ biosdisk_findpartition(int biosdev, dadd
 			if (d->part[partition].fstype == FS_UNUSED)
 continue;
 #ifdef EFIBOOT
-			if (d->part[partition].attr & GPT_ENT_ATTR_BOOTME) {
-switch (d->part[partition].fstype) {
-case FS_BSDFFS:
-case FS_BSDLFS:
-case FS_RAID:
-case FS_CCD:
-case FS_CGD:
-case FS_ISO9660:
-	break;
+			switch (d->part[partition].fstype) {
+			case FS_BSDFFS:
+			case FS_BSDLFS:
+			case FS_RAID:
+			case FS_CCD:
+			case FS_CGD:
+			case FS_ISO9660:
+if (d->part[partition].attr & GPT_ENT_ATTR_BOOTME)
+	goto found;
+candidate = partition;
+break;
 
-default:
+			default:
+if (d->part[partition].attr & GPT_ENT_ATTR_BOOTME)
 	candidate = partition;
-	continue;
-}
 break;
 			}
 #else
@@ -824,6 +825,7 @@ biosdisk_findpartition(int biosdev, dadd
 #endif
 		}
 #ifdef EFIBOOT
+found:
 		if (partition == 0 && candidate != 0)
 			partition = candidate;
 #endif



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

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 10:19:33 UTC 2018

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

Log Message:
efiboot: boot device is always efi_distlist first element.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/efidisk.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/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.2 src/sys/arch/i386/stand/efiboot/efidisk.c:1.3
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.2	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Tue Mar 20 10:19:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.2 2018/03/08 10:34:33 nonaka Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.3 2018/03/20 10:19:33 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -106,14 +106,11 @@ next:
 	FreePool(handles);
 
 	if (efi_bootdp_type == BIOSDISK_TYPE_CD) {
-		TAILQ_FOREACH(edi, _disklist, list) {
-			if (edi->bootdev) {
-edi = TAILQ_FIRST(_disklist);
-edi->type = BIOSDISK_TYPE_CD;
-TAILQ_REMOVE(_disklist, edi, list);
-TAILQ_INSERT_TAIL(_disklist, edi, list);
-break;
-			}
+		edi = TAILQ_FIRST(_disklist);
+		if (edi != NULL && edi->bootdev) {
+			edi->type = BIOSDISK_TYPE_CD;
+			TAILQ_REMOVE(_disklist, edi, list);
+			TAILQ_INSERT_TAIL(_disklist, edi, list);
 		}
 	}
 



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

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 10:18:10 UTC 2018

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

Log Message:
efiboot: more pager.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/boot.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.6 src/sys/arch/i386/stand/efiboot/boot.c:1.7
--- src/sys/arch/i386/stand/efiboot/boot.c:1.6	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/efiboot/boot.c	Tue Mar 20 10:18:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.6 2018/03/08 10:34:33 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.7 2018/03/20 10:18:10 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -627,6 +627,12 @@ command_devpath(char *arg)
 			break;
 
 		Print(L"DevicePathType %d\n", DevicePathType(dp0));
+		if (++row >= rows) {
+			row = 0;
+			Print(L"Press Any Key to continue :");
+			(void) awaitkey(-1, 0);
+			Print(L"\n");
+		}
 		for (dp = dp0;
 		 !IsDevicePathEnd(dp);
 		 dp = NextDevicePathNode(dp)) {



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

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 10:16:18 UTC 2018

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

Log Message:
efiboot: fix it can't boot from HDD.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/sys/arch/i386/stand/efiboot/devopen.c:1.3
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.2	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Tue Mar 20 10:16:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.2 2018/03/08 10:34:33 nonaka Exp $	 */
+/*	$NetBSD: devopen.c,v 1.3 2018/03/20 10:16:17 nonaka Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ dev2bios(char *devname, int unit, int *b
 
 	if (strcmp(devname, "hd") == 0)
 		*biosdev = 0x80 + unit;
-	if (strcmp(devname, "cd") == 0)
+	else if (strcmp(devname, "cd") == 0)
 		*biosdev = 0x80 + get_harddrives() + unit;
 	else
 		return ENXIO;



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

2018-03-08 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Mar  8 10:34:33 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot TODO.efiboot boot.c
devopen.c efiboot.c efiboot.h efidisk.c efidisk.h efidisk_ll.c
src/sys/arch/i386/stand/lib: biosdisk.c biosdisk.h biosdisk_ll.h
Added Files:
src/sys/arch/i386/stand/efiboot: efidev.c

Log Message:
efiboot: system can boot from CD/DVD-ROM media.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/TODO.efiboot
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/boot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/devopen.c \
src/sys/arch/i386/stand/efiboot/efidisk.c \
src/sys/arch/i386/stand/efiboot/efidisk.h \
src/sys/arch/i386/stand/efiboot/efidisk_ll.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/efiboot.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/efidev.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/lib/biosdisk.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/stand/lib/biosdisk_ll.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.9 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.10
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.9	Sat Apr 29 00:05:35 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Thu Mar  8 10:34:33 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.9 2017/04/29 00:05:35 nonaka Exp $
+# $NetBSD: Makefile.efiboot,v 1.10 2018/03/08 10:34:33 nonaka Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -12,8 +12,8 @@ SOURCES?= start.S conf.c devopen.c efibo
 LIBI386SRCS= boot.c biosdisk.c bootinfo.c bootinfo_biosgeom.c
 LIBI386SRCS+= bootmenu.c diskbuf.c exec.c menuutils.c
 LIBI386SRCS+= panic.c parseutils.c pread.c
-LIBI386SRCS+= eficons.c efidelay.c efidisk.c efidisk_ll.c efigetsecs.c
-LIBI386SRCS+= efimemory.c
+LIBI386SRCS+= eficons.c efidelay.c efidev.c efidisk.c efidisk_ll.c
+LIBI386SRCS+= efigetsecs.c efimemory.c
 SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS}
 
 PIE_CFLAGS=
@@ -54,9 +54,11 @@ CPPFLAGS+= -Wno-pointer-sign
 CPPFLAGS+= -DEFI_ALLOCATE_MAX_ADDRESS=0x1ULL
 CPPFLAGS+= -DHEAP_VARIABLE
 CPPFLAGS+= -DSUPPORT_CD9660
+CPPFLAGS+= -D"devb2cdb(bno)=(bno)"
 CPPFLAGS+= -DSUPPORT_DOSFS
 CPPFLAGS+= -DSUPPORT_EXT2FS
 CPPFLAGS+= -DPASS_BIOSGEOM
+CPPFLAGS+= -DBIOSDISK_DEFAULT_SECSIZE=2048	# for bootinfo_biosgeom.c
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
 
 EFIDIR= ${S}/external/bsd/gnu-efi/dist
@@ -66,6 +68,7 @@ CPPFLAGS+= -I${EFIDIR}/inc/protocol
 
 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT
+SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)"
 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes  # Read compressed kernels
 SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no # Netboot via TFTP, NFS
 

Index: src/sys/arch/i386/stand/efiboot/TODO.efiboot
diff -u src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.3 src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.4
--- src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.3	Sun Mar 12 06:37:41 2017
+++ src/sys/arch/i386/stand/efiboot/TODO.efiboot	Thu Mar  8 10:34:33 2018
@@ -1,6 +1,5 @@
 - efiboot
  * handle UEFI variables
- * boot from CD/DVD (bootable from CD/DVD, but root fs not found.)
  * load boot.cfg from EFI system partition (FAT32)
 
 - kernel

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.5 src/sys/arch/i386/stand/efiboot/boot.c:1.6
--- src/sys/arch/i386/stand/efiboot/boot.c:1.5	Mon May  1 13:03:01 2017
+++ src/sys/arch/i386/stand/efiboot/boot.c	Thu Mar  8 10:34:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.5 2017/05/01 13:03:01 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.6 2018/03/08 10:34:33 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -419,7 +419,7 @@ command_dev(char *arg)
 	const char *file; /* dummy */
 
 	if (*arg == '\0') {
-		biosdisk_probe();
+		efi_disk_show();
 		printf("default %s%d%c\n", default_devname, default_unit,
 		   'a' + default_partition);
 		return;
@@ -554,6 +554,7 @@ command_multiboot(char *arg)
 void
 command_version(char *arg)
 {
+	CHAR16 *path;
 
 	if (strcmp(arg, "full") == 0) {
 		printf("ImageBase: 0x%" PRIxPTR "\n",
@@ -563,6 +564,10 @@ command_version(char *arg)
 		ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0x);
 		Print(L"EFI Firmware: %s (rev %d.%02d)\n", ST->FirmwareVendor,
 		ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0x);
+		path = DevicePathToStr(efi_bootdp);
+		Print(L"Boot DevicePath: %d:%d:%s\n", DevicePathType(efi_bootdp),
+		DevicePathSubType(efi_bootdp), path);
+		

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

2018-02-21 Thread Alistair Crooks
Thanks, Christos.

This should also fix PR/53045 (qemu booting).

On 21 February 2018 at 17:37, Christos Zoulas  wrote:
> Module Name:src
> Committed By:   christos
> Date:   Thu Feb 22 01:37:04 UTC 2018
>
> Modified Files:
> src/sys/arch/i386/stand: Makefile.inc
>
> Log Message:
> gcc-6 needs -nosse
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/Makefile.inc
>
> 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

2018-02-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 22 01:37:04 UTC 2018

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

Log Message:
gcc-6 needs -nosse


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

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/Makefile.inc
diff -u src/sys/arch/i386/stand/Makefile.inc:1.13 src/sys/arch/i386/stand/Makefile.inc:1.14
--- src/sys/arch/i386/stand/Makefile.inc:1.13	Thu Jan 12 17:16:29 2017
+++ src/sys/arch/i386/stand/Makefile.inc	Wed Feb 21 20:37:04 2018
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile.inc,v 1.13 2017/01/12 22:16:29 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2018/02/22 01:37:04 christos Exp $
 
 .include 
 
 BINDIR=	/usr/mdec
 
 OPT_SIZE.gcc=	-Os -ffreestanding -fomit-frame-pointer -fno-unwind-tables \
-		-fno-asynchronous-unwind-tables -fno-exceptions
+		-fno-asynchronous-unwind-tables -fno-exceptions -mno-sse
 OPT_SIZE.clang=	-Oz -ffreestanding -fomit-frame-pointer -DNDEBUG \
 		-fno-stack-protector -mno-sse \
 		-mstack-alignment=4 \



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

2018-02-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb 17 13:54:52 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gptmbr.S
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
Drop explicit loop prefix. GAS doesn't care and LLVM doesn't support it.
Drop the need for assembling with GAS. While LLVM is using a suboptimal
encoding of for hard-coded memory writes, it shouldn't affect
functionality. It just wastes three bytes with extra prefixes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/mbr/gptmbr.S
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

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/mbr/gptmbr.S
diff -u src/sys/arch/i386/stand/mbr/gptmbr.S:1.1 src/sys/arch/i386/stand/mbr/gptmbr.S:1.2
--- src/sys/arch/i386/stand/mbr/gptmbr.S:1.1	Wed Aug 17 00:25:05 2011
+++ src/sys/arch/i386/stand/mbr/gptmbr.S	Sat Feb 17 13:54:52 2018
@@ -160,7 +160,7 @@ next:
 get_ptab:
 	call	read_sector
 	call	inc64
-	loopw	get_ptab
+	loop	get_ptab
 
 	/* Find the boot partition */
 	xorw	%si,%si			/* Nothing found yet */
@@ -182,7 +182,7 @@ find_part:
 	movw	%di,%si
 not_this:
 	addw	%ax,%di
-	loopw	find_part
+	loop	find_part
 
 	andw	%si,%si
 	jnz	found_part

Index: src/sys/arch/i386/stand/mbr/gptmbr/Makefile
diff -u src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.3 src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.4
--- src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.3	Wed Sep 21 18:15:59 2011
+++ src/sys/arch/i386/stand/mbr/gptmbr/Makefile	Sat Feb 17 13:54:52 2018
@@ -1,10 +1,8 @@
-#	$NetBSD: Makefile,v 1.3 2011/09/21 18:15:59 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.4 2018/02/17 13:54:52 joerg Exp $
 
 PROG=		gptmbr.bin
 SRCS=		gptmbr.S
 
-AFLAGS.gptmbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
-
 .include <../Makefile.mbr>
 
 LOADADDR=	0x600



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

2018-01-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Jan 27 22:25:23 UTC 2018

Modified Files:
src/sys/arch/i386/stand/lib: bootinfo.h

Log Message:
Recent changes have increased the number of "things" the bootloader
needs to deal with.  Increase the table size so we don't overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/bootinfo.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/lib/bootinfo.h
diff -u src/sys/arch/i386/stand/lib/bootinfo.h:1.11 src/sys/arch/i386/stand/lib/bootinfo.h:1.12
--- src/sys/arch/i386/stand/lib/bootinfo.h:1.11	Sun Jun  5 14:13:57 2016
+++ src/sys/arch/i386/stand/lib/bootinfo.h	Sat Jan 27 22:25:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.11 2016/06/05 14:13:57 maxv Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.12 2018/01/27 22:25:23 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1997
@@ -35,7 +35,7 @@ struct bootinfo {
 
 extern struct bootinfo *bootinfo;
 
-#define BTINFO_MAX	32
+#define BTINFO_MAX	64
 
 #define BI_ALLOC(max) (bootinfo = alloc(sizeof(struct bootinfo) \
 + ((max) - 1) * sizeof(uint32_t))) \



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

2017-11-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 14 09:55:41 UTC 2017

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Add missing ).


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.69 src/sys/arch/i386/stand/boot/boot2.c:1.70
--- src/sys/arch/i386/stand/boot/boot2.c:1.69	Wed Nov  8 18:31:00 2017
+++ src/sys/arch/i386/stand/boot/boot2.c	Tue Nov 14 09:55:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.69 2017/11/08 18:31:00 maxv Exp $	*/
+/*	$NetBSD: boot2.c,v 1.70 2017/11/14 09:55:41 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -402,7 +402,7 @@ command_help(char *arg)
 
 	printf("commands are:\n"
 	   "boot [xdNx:][filename] [-12acdqsvxz]\n"
-	   " (ex. \"hd0a:netbsd.old -s\"\n"
+	   " (ex. \"hd0a:netbsd.old -s\")\n"
 	   "pkboot [xdNx:][filename] [-12acdqsvxz]\n"
 #if LIBSA_ENABLE_LS_OP
 	   "ls [path]\n"



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

2017-11-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov  8 18:31:00 UTC 2017

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Add pkboot in "help".


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.68 src/sys/arch/i386/stand/boot/boot2.c:1.69
--- src/sys/arch/i386/stand/boot/boot2.c:1.68	Wed Oct 11 09:53:14 2017
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Nov  8 18:31:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.68 2017/10/11 09:53:14 maxv Exp $	*/
+/*	$NetBSD: boot2.c,v 1.69 2017/11/08 18:31:00 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -403,6 +403,7 @@ command_help(char *arg)
 	printf("commands are:\n"
 	   "boot [xdNx:][filename] [-12acdqsvxz]\n"
 	   " (ex. \"hd0a:netbsd.old -s\"\n"
+	   "pkboot [xdNx:][filename] [-12acdqsvxz]\n"
 #if LIBSA_ENABLE_LS_OP
 	   "ls [path]\n"
 #endif



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

2017-10-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Oct 11 09:53:14 UTC 2017

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.67 src/sys/arch/i386/stand/boot/boot2.c:1.68
--- src/sys/arch/i386/stand/boot/boot2.c:1.67	Sat Oct  7 10:26:38 2017
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Oct 11 09:53:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.67 2017/10/07 10:26:38 maxv Exp $	*/
+/*	$NetBSD: boot2.c,v 1.68 2017/10/11 09:53:14 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -477,6 +477,7 @@ command_pkboot(char *arg)
 	extern int has_prekern;
 	has_prekern = 1;
 	command_boot(arg);
+	has_prekern = 0;
 }
 
 void



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

2017-10-07 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Oct  7 10:32:56 UTC 2017

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

Log Message:
Bump bootloader version, support for booting KASLR amd64 kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/stand/boot/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/boot/version
diff -u src/sys/arch/i386/stand/boot/version:1.16 src/sys/arch/i386/stand/boot/version:1.17
--- src/sys/arch/i386/stand/boot/version:1.16	Fri Aug 30 16:43:33 2013
+++ src/sys/arch/i386/stand/boot/version	Sat Oct  7 10:32:56 2017
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.16 2013/08/30 16:43:33 jmcneill Exp $
+$NetBSD: version,v 1.17 2017/10/07 10:32:56 maxv Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -48,3 +48,4 @@ is taken as the current.
 5.8:	Support for splash images.
 5.9:	VESA VBE/DDC EDID support.
 5.10:	Support for using raw file-system images as memory disks.
+5.11:	Support for booting KASLR amd64 kernels.



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

2017-06-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun  2 18:19:33 UTC 2017

Modified Files:
src/sys/arch/i386/stand/misc: rawr32.exe.uue

Log Message:
Update to rawrite32 1.0.5 (new signatures to avoid scary windows
warnings)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/misc/rawr32.exe.uue

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

diffs are larger than 1MB and have been omitted


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

2017-05-01 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon May  1 13:03:02 UTC 2017

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

Log Message:
efiboot: implement consdev command.

no support to change console device for efiboot yet.
only pass console parameters to kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/boot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.3 -r1.4 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/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.4 src/sys/arch/i386/stand/efiboot/boot.c:1.5
--- src/sys/arch/i386/stand/efiboot/boot.c:1.4	Sun Mar 12 05:33:48 2017
+++ src/sys/arch/i386/stand/efiboot/boot.c	Mon May  1 13:03:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.4 2017/03/12 05:33:48 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.5 2017/05/01 13:03:01 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -30,6 +30,7 @@
 
 #include 
 #include 
+#include 
 
 #include "bootcfg.h"
 #include "bootmod.h"
@@ -340,7 +341,7 @@ command_help(char *arg)
 	   "boot [xdNx:][filename] [-12acdqsvxz]\n"
 	   " (ex. \"hd0a:netbsd.old -s\"\n"
 	   "dev [xd[N[x]]:]\n"
-	   "consdev {pc|com[0123]|com[0123]kbd|auto}\n"
+	   "consdev {pc|com[0123][,{speed}]|com,{ioport}[,{speed}]}\n"
 	   "devpath\n"
 	   "efivar\n"
 	   "gop [{modenum|list}]\n"
@@ -436,12 +437,77 @@ command_dev(char *arg)
 	default_devname = savedevname;
 }
 
-/* ARGSUSED */
+static const struct cons_devs {
+	const char	*name;
+	u_int		tag;
+	int		ioport;
+} cons_devs[] = {
+	{ "pc",		CONSDEV_PC,   0 },
+	{ "com0",	CONSDEV_COM0, 0 },
+	{ "com1",	CONSDEV_COM1, 0 },
+	{ "com2",	CONSDEV_COM2, 0 },
+	{ "com3",	CONSDEV_COM3, 0 },
+	{ "com0kbd",	CONSDEV_COM0KBD, 0 },
+	{ "com1kbd",	CONSDEV_COM1KBD, 0 },
+	{ "com2kbd",	CONSDEV_COM2KBD, 0 },
+	{ "com3kbd",	CONSDEV_COM3KBD, 0 },
+	{ "com",	CONSDEV_COM0, -1 },
+	{ "auto",	CONSDEV_AUTO, 0 },
+	{ NULL,		0 }
+};
+
 void
 command_consdev(char *arg)
 {
-
-	/* XXX not implemented yet */
+	const struct cons_devs *cdp;
+	char *sep, *sep2 = NULL;
+	int ioport, speed = 0;
+
+	sep = strchr(arg, ',');
+	if (sep != NULL) {
+		*sep++ = '\0';
+		sep2 = strchr(sep, ',');
+		if (sep != NULL)
+			*sep2++ = '\0';
+	}
+
+	for (cdp = cons_devs; cdp->name; cdp++) {
+		if (strcmp(arg, cdp->name) == 0) {
+			ioport = cdp->ioport;
+			if (cdp->tag == CONSDEV_PC || cdp->tag == CONSDEV_AUTO) {
+if (sep != NULL || sep2 != NULL)
+	goto error;
+			} else {
+/* com? */
+if (ioport == -1) {
+	if (sep != NULL) {
+		u_long t = strtoul(sep, NULL, 0);
+		if (t > INT_MAX)
+			goto error;
+		ioport = (int)t;
+	}
+	if (sep2 != NULL) {
+		speed = atoi(sep2);
+		if (speed < 0)
+			goto error;
+	}
+} else {
+	if (sep != NULL) {
+		speed = atoi(sep);
+		if (speed < 0)
+			goto error;
+	}
+	if (sep2 != NULL)
+		goto error;
+}
+			}
+			consinit(cdp->tag, ioport, speed);
+			print_banner();
+			return;
+		}
+	}
+error:
+	printf("invalid console device.\n");
 }
 
 #ifndef SMALL
Index: src/sys/arch/i386/stand/efiboot/efiboot.h
diff -u src/sys/arch/i386/stand/efiboot/efiboot.h:1.4 src/sys/arch/i386/stand/efiboot/efiboot.h:1.5
--- src/sys/arch/i386/stand/efiboot/efiboot.h:1.4	Sat Feb 11 10:23:39 2017
+++ src/sys/arch/i386/stand/efiboot/efiboot.h	Mon May  1 13:03:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.4 2017/02/11 10:23:39 nonaka Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.5 2017/05/01 13:03:01 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -55,6 +55,7 @@ void efi_cleanup(void);
 
 /* eficons.c */
 int cninit(void);
+void consinit(int, int, int);
 void command_text(char *);
 void command_gop(char *);
 

Index: src/sys/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.3 src/sys/arch/i386/stand/efiboot/eficons.c:1.4
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.3	Fri Mar 24 01:25:36 2017
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Mon May  1 13:03:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.3 2017/03/24 01:25:36 nonaka Exp $	*/
+/*	$NetBSD: eficons.c,v 1.4 2017/05/01 13:03:01 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -34,6 +34,8 @@
 #include "bootinfo.h"
 #include "vbe.h"
 
+extern struct x86_boot_params boot_params;
+
 struct btinfo_console btinfo_console;
 
 static EFI_GRAPHICS_OUTPUT_PROTOCOL *efi_gop;
@@ -46,6 +48,68 @@ static int keybuf_write = 0;
 static void eficons_init_video(void);
 static void efi_switch_video_to_text_mode(void);
 
+static int
+getcomaddr(int idx)
+{
+	static const short comioport[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
+
+	if (idx < __arraycount(comioport))

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

2017-03-24 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Mar 24 08:50:17 UTC 2017

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
efiboot: fix calculation of the kernel size when loading modules.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/i386/stand/lib/exec.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/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.67 src/sys/arch/i386/stand/lib/exec.c:1.68
--- src/sys/arch/i386/stand/lib/exec.c:1.67	Sun Mar 12 05:33:48 2017
+++ src/sys/arch/i386/stand/lib/exec.c	Fri Mar 24 08:50:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.67 2017/03/12 05:33:48 nonaka Exp $	 */
+/*	$NetBSD: exec.c,v 1.68 2017/03/24 08:50:17 nonaka Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -469,14 +469,16 @@ count_netbsd(const char *file, u_long *r
 {
 	u_long marks[MARK_MAX];
 	char kdev[64];
-	char base_path[64];
+	char base_path[64] = "/";
 	struct stat st;
 	boot_module_t *bm;
 	u_long sz;
 	int err, fd;
 
+	howto = AB_SILENT;
+
 	memset(marks, 0, sizeof(marks));
-	if ((fd = loadfile(file, marks, COUNT_KERNEL)) == -1)
+	if ((fd = loadfile(file, marks, COUNT_KERNEL | LOAD_NOTE)) == -1)
 		return -1;
 	close(fd);
 	marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) &
@@ -490,13 +492,13 @@ count_netbsd(const char *file, u_long *r
 
 		/* If the root fs type is unusual, load its module. */
 		if (fsmod != NULL)
-			module_add(__UNCONST(fsmod));
+			module_add_common(fsmod, BM_TYPE_KMOD);
 
 		for (bm = boot_modules; bm; bm = bm->bm_next) {
 			fd = module_open(bm, 0, kdev, base_path, false);
 			if (fd == -1)
 continue;
-			sz = (image_end + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
+			sz = (sz + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
 			err = fstat(fd, );
 			if (err == -1 || st.st_size == -1) {
 close(fd);



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

2017-03-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Mar 24 01:25:36 UTC 2017

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

Log Message:
Don't maximize the text columns and rows. only use 100x31 or 80x25.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/sys/arch/i386/stand/efiboot/eficons.c:1.3
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.2	Fri Mar 24 01:00:47 2017
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Fri Mar 24 01:25:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.2 2017/03/24 01:00:47 nonaka Exp $	*/
+/*	$NetBSD: eficons.c,v 1.3 2017/03/24 01:25:36 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -499,24 +499,27 @@ static void
 eficons_init_video(void)
 {
 	EFI_STATUS status;
-	UINTN cols, rows, dim = 0;
-	INT32 i, best = -1;
+	UINTN cols, rows;
+	INT32 i, best, mode80x25, mode100x31;
 
 	/*
 	 * Setup text mode
 	 */
 	uefi_call_wrapper(ST->ConOut->Reset, 2, ST->ConOut, TRUE);
 
+	mode80x25 = mode100x31 = -1;
 	for (i = 0; i < ST->ConOut->Mode->MaxMode; i++) {
 		status = uefi_call_wrapper(ST->ConOut->QueryMode, 4,
 		ST->ConOut, i, , );
 		if (EFI_ERROR(status))
 			continue;
-		if (dim < cols * rows) {
-			dim = cols * rows;
-			best = i;
-		}
+
+		if (mode80x25 < 0 && cols == 80 && rows == 25)
+			mode80x25 = i;
+		else if (mode100x31 < 0 && cols == 100 && rows == 31)
+			mode100x31 = i;
 	}
+	best = mode100x31 >= 0 ? mode100x31 : mode80x25 >= 0 ? mode80x25 : -1;
 	if (best >= 0)
 		uefi_call_wrapper(ST->ConOut->SetMode, 2, ST->ConOut, best);
 	uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, TRUE);



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

2017-03-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Mar 24 01:00:47 UTC 2017

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

Log Message:
Don't maximize the screen size when gop is not specified.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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.1 src/sys/arch/i386/stand/efiboot/eficons.c:1.2
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Fri Mar 24 01:00:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: eficons.c,v 1.2 2017/03/24 01:00:47 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -209,9 +209,6 @@ bi_framebuffer(void)
 	EFI_STATUS status;
 	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
 	struct btinfo_framebuffer fb;
-	UINT64 res, bestres = 0;
-	UINTN sz;
-	UINT32 i;
 	INT32 bestmode = -1;
 
 	if (efi_gop == NULL) {
@@ -222,7 +219,12 @@ bi_framebuffer(void)
 	if (efi_gop_mode >= 0) {
 		bestmode = efi_gop_mode;
 	} else {
-		/* XXX EDID? EFI_EDID_DISCOVERD_PROTOCOL */
+#if 0
+		UINT64 res, bestres = 0;
+		UINTN sz;
+		UINT32 i;
+
+		/* XXX EDID? EFI_EDID_DISCOVERED_PROTOCOL */
 		for (i = 0; i < efi_gop->Mode->MaxMode; i++) {
 			status = uefi_call_wrapper(efi_gop->QueryMode, 4,
 			efi_gop, i, , );
@@ -237,6 +239,7 @@ bi_framebuffer(void)
 bestres = res;
 			}
 		}
+#endif
 	}
 	if (bestmode >= 0) {
 		status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,



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

2017-03-11 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sun Mar 12 06:37:41 UTC 2017

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

Log Message:
Remove `fix module_init()' entry.

I've been committed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/TODO.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/TODO.efiboot
diff -u src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.2 src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.3
--- src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.2	Tue Feb 21 10:53:37 2017
+++ src/sys/arch/i386/stand/efiboot/TODO.efiboot	Sun Mar 12 06:37:41 2017
@@ -2,7 +2,6 @@
  * handle UEFI variables
  * boot from CD/DVD (bootable from CD/DVD, but root fs not found.)
  * load boot.cfg from EFI system partition (FAT32)
- * fix module_init(). need to allocate memory for modules.
 
 - kernel
  * handle UEFI variables (/dev/efivar)



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

2017-03-11 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sun Mar 12 05:33:48 UTC 2017

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c
src/sys/arch/i386/stand/lib: exec.c libi386.h

Log Message:
efiboot: Kernel modules are loaded in pre-allocated memory.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/i386/stand/lib/libi386.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.3 src/sys/arch/i386/stand/efiboot/boot.c:1.4
--- src/sys/arch/i386/stand/efiboot/boot.c:1.3	Fri Mar  3 09:29:57 2017
+++ src/sys/arch/i386/stand/efiboot/boot.c	Sun Mar 12 05:33:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.3 2017/03/03 09:29:57 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.4 2017/03/12 05:33:48 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -31,10 +31,9 @@
 #include 
 #include 
 
-#include 
-
-#include 
-#include 
+#include "bootcfg.h"
+#include "bootmod.h"
+#include "bootmenu.h"
 #include "devopen.h"
 
 int errno;
@@ -207,16 +206,40 @@ clearit(void)
 static void
 bootit(const char *filename, int howto)
 {
+	EFI_STATUS status;
+	EFI_PHYSICAL_ADDRESS bouncebuf;
+	UINTN npages;
+	u_long allocsz;
 
 	if (howto & AB_VERBOSE)
 		printf("booting %s (howto 0x%x)\n", sprint_bootsel(filename),
 		howto);
 
-	if (exec_netbsd(filename, 0, howto, 0, efi_cleanup) < 0)
+	if (count_netbsd(filename, ) < 0) {
+		printf("boot: %s: %s\n", sprint_bootsel(filename),
+		   strerror(errno));
+		return;
+	}
+
+	bouncebuf = EFI_ALLOCATE_MAX_ADDRESS;
+	npages = EFI_SIZE_TO_PAGES(allocsz);
+	status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
+	EfiLoaderData, npages, );
+	if (EFI_ERROR(status)) {
+		printf("boot: %s: %s\n", sprint_bootsel(filename),
+		   strerror(ENOMEM));
+		return;
+	}
+
+	efi_loadaddr = bouncebuf;
+	if (exec_netbsd(filename, bouncebuf, howto, 0, efi_cleanup) < 0)
 		printf("boot: %s: %s\n", sprint_bootsel(filename),
 		   strerror(errno));
 	else
 		printf("boot returned\n");
+
+	(void) uefi_call_wrapper(BS->FreePages, 2, bouncebuf, npages);
+	efi_loadaddr = 0;
 }
 
 void

Index: src/sys/arch/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.66 src/sys/arch/i386/stand/lib/exec.c:1.67
--- src/sys/arch/i386/stand/lib/exec.c:1.66	Thu Feb 23 12:14:53 2017
+++ src/sys/arch/i386/stand/lib/exec.c	Sun Mar 12 05:33:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.66 2017/02/23 12:14:53 nonaka Exp $	 */
+/*	$NetBSD: exec.c,v 1.67 2017/03/12 05:33:48 nonaka Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -151,6 +151,11 @@ static void	module_add_common(const char
 
 static void	userconf_init(void);
 
+static void	extract_device(const char *, char *, size_t);
+static void	module_base_path(char *, size_t);
+static int	module_open(boot_module_t *, int, const char *, const char *,
+		bool);
+
 void
 framebuffer_configure(struct btinfo_framebuffer *fb)
 {
@@ -196,6 +201,10 @@ module_add_common(const char *name, uint
 	while (*name == ' ' || *name == '\t')
 		++name;
 
+	for (bm = boot_modules; bm != NULL; bm = bm->bm_next)
+		if (bm->bm_type == type && strcmp(bm->bm_path, name) == 0)
+			return;
+
 	bm = alloc(sizeof(boot_module_t));
 	len = strlen(name) + 1;
 	str = alloc(len);
@@ -299,30 +308,6 @@ common_load_kernel(const char *file, u_l
 			return ENOMEM;
 	}
 #endif
-#ifdef EFIBOOT
-	{
-		EFI_STATUS status;
-		EFI_PHYSICAL_ADDRESS addr;
-		UINTN kernsize;
-
-		marks[MARK_START] = loadaddr;
-		if ((fd = loadfile(file, marks, COUNT_KERNEL)) == -1)
-			return EIO;
-		close(fd);
-
-		/* Allocate temporary arena. */
-		addr = EFI_ALLOCATE_MAX_ADDRESS;
-		kernsize = marks[MARK_END] - loadaddr;
-		kernsize = EFI_SIZE_TO_PAGES(kernsize);
-		status = uefi_call_wrapper(BS->AllocatePages, 4,
-		AllocateMaxAddress, EfiLoaderData, kernsize, );
-		if (EFI_ERROR(status))
-			return ENOMEM;
-		efi_loadaddr = loadaddr = addr;
-
-		memset(marks, 0, sizeof(marks[0]) * MARK_MAX);
-	}
-#endif
 	marks[MARK_START] = loadaddr;
 	if ((fd = loadfile(file, marks,
 	LOAD_KERNEL & ~(floppy ? LOAD_BACKWARDS : 0))) == -1)
@@ -360,15 +345,6 @@ common_load_kernel(const char *file, u_l
 		ppbcopy(loadaddr, origaddr, marks[MARK_END]);
 	}
 #endif
-#ifdef EFIBOOT
-	marks[MARK_START] -= loadaddr;
-	marks[MARK_ENTRY] -= loadaddr;
-	marks[MARK_DATA] -= loadaddr;
-	/* MARK_NSYM */
-	marks[MARK_SYM] -= loadaddr;
-	marks[MARK_END] -= loadaddr;
-	/* Copy the kernel to original load address later. */
-#endif
 	marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) &
 	(-sizeof(int));
 	image_end = marks[MARK_END];
@@ -410,6 +386,15 @@ exec_netbsd(const char *file, physaddr_t
 		errno = error;

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

2017-03-03 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Mar  3 09:29:57 UTC 2017

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

Log Message:
efiboot: fix efivar command.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/boot.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.2 src/sys/arch/i386/stand/efiboot/boot.c:1.3
--- src/sys/arch/i386/stand/efiboot/boot.c:1.2	Fri Feb  3 16:42:26 2017
+++ src/sys/arch/i386/stand/efiboot/boot.c	Fri Mar  3 09:29:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.2 2017/02/03 16:42:26 roy Exp $	*/
+/*	$NetBSD: boot.c,v 1.3 2017/03/03 09:29:57 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -557,7 +557,7 @@ command_efivar(char *arg)
 	 L"GUIDVariable NameValue\n"
 	 L"===  \n";
 	EFI_STATUS status;
-	UINTN sz = 64;
+	UINTN sz = 64, osz;
 	CHAR16 *name = NULL, *tmp, *val;
 	EFI_GUID vendor;
 	UINTN cols, rows, row = 0;
@@ -576,11 +576,12 @@ command_efivar(char *arg)
 		return;
 	}
 
-	name[0] = 0;
+	SetMem(name, sz, 0);
 	vendor = NullGuid;
 
 	Print(L"%s", header);
 	for (;;) {
+		osz = sz;
 		status = uefi_call_wrapper(RT->GetNextVariableName, 3,
 		, name, );
 		if (EFI_ERROR(status)) {
@@ -598,8 +599,11 @@ command_efivar(char *arg)
 (UINT64)sz);
 break;
 			}
+			SetMem(tmp, sz, 0);
+			CopyMem(tmp, name, osz);
 			FreePool(name);
 			name = tmp;
+			continue;
 		}
 
 		val = LibGetVariable(name, );



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

2017-02-24 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 24 12:24:25 UTC 2017

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

Log Message:
efiboot: Don't access old stack after copying a kernel.

It's possible that the old stack is overwritten by the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/sys/arch/i386/stand/efiboot/bootia32/startprog32.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/startprog32.S
diff -u src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S:1.1 src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S:1.2
--- src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S:1.1	Tue Feb 21 10:53:37 2017
+++ src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S	Fri Feb 24 12:24:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: startprog32.S,v 1.1 2017/02/21 10:53:37 nonaka Exp $	*/
+/*	$NetBSD: startprog32.S,v 1.2 2017/02/24 12:24:25 nonaka Exp $	*/
 /*	NetBSD: startprog.S,v 1.4 2016/12/04 08:21:08 maxv Exp	*/
 
 /*
@@ -91,6 +91,9 @@ start:
 
 	cli
 
+	movl	8(%ebp), %ebx	/* %ebx: entry address */
+	movl	36(%ebp), %edx	/* %edx: loaded start address */
+
 	/* Prepare a new stack */
 	movl	20(%ebp), %eax	/* stack */
 	subl	$4, %eax
@@ -108,12 +111,12 @@ start:
 	rep
 	movsl			/* copy %ds:(%esi) -> %es:(%edi) */
 	cld
-	mov	%edi, %edx	/* %edx: new stack pointer */
+	mov	%edi, %esp	/* set new stack pointer */
 
 	/* Copy kernel */
-	movl	24(%esp), %edi	/* dest */
-	movl	28(%esp), %esi	/* src */
-	movl	32(%esp), %ecx	/* size */
+	movl	24(%ebp), %edi	/* dest */
+	movl	28(%ebp), %esi	/* src */
+	movl	32(%ebp), %ecx	/* size */
 #if defined(NO_OVERLAP)
 	movl	%ecx, %eax
 #else
@@ -179,20 +182,17 @@ start:
 .Lcopy_done:
 	cld			/* LynxOS depends on it */
 
-	movl	8(%ebp), %esi	/* %esi: entry address */
-	movl	36(%ebp), %edi	/* %edi: loaded start address */
-
 	/* Prepare jump address */
-	lea	(start32a - start)(%edi), %eax
-	movl	%eax, (start32r - start)(%edi)
+	lea	(start32a - start)(%edx), %eax
+	movl	%eax, (start32r - start)(%edx)
 
 	/* Setup GDT */
-	lea	(gdt - start)(%edi), %eax
-	movl	%eax, (gdtrr - start)(%edi)
-	lgdt	(gdtr - start)(%edi)
+	lea	(gdt - start)(%edx), %eax
+	movl	%eax, (gdtrr - start)(%edx)
+	lgdt	(gdtr - start)(%edx)
 
 	/* Jump to set %cs */
-	ljmp	*(start32r - start)(%edi)
+	ljmp	*(start32r - start)(%edx)
 
 	.align	4
 start32a:
@@ -203,7 +203,8 @@ start32a:
 	movw	%ax, %gs
 	movw	%ax, %ss
 
-	movl	%edx, %esp
+	/* Already set new stack pointer */
+	movl	%esp, %ebp
 
 	/* Disable Paging in CR0 */
 	movl	%cr0, %eax
@@ -220,8 +221,8 @@ start32a:
 	.align	4
 start32b:
 	xor	%eax, %eax
-	movl	%esi, (start32r - start)(%edi)
-	ljmp	*(start32r - start)(%edi)
+	movl	%ebx, (start32r - start)(%edx)
+	ljmp	*(start32r - start)(%edx)
 
 	.align	16
 start32r:



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

2017-02-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Feb 23 12:14:53 UTC 2017

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
no need COUNT_KERNEL hack.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/i386/stand/lib/exec.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/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.65 src/sys/arch/i386/stand/lib/exec.c:1.66
--- src/sys/arch/i386/stand/lib/exec.c:1.65	Sat Feb 11 10:23:39 2017
+++ src/sys/arch/i386/stand/lib/exec.c	Thu Feb 23 12:14:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.65 2017/02/11 10:23:39 nonaka Exp $	 */
+/*	$NetBSD: exec.c,v 1.66 2017/02/23 12:14:53 nonaka Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -313,7 +313,6 @@ common_load_kernel(const char *file, u_l
 		/* Allocate temporary arena. */
 		addr = EFI_ALLOCATE_MAX_ADDRESS;
 		kernsize = marks[MARK_END] - loadaddr;
-		kernsize += 1 * 1024 * 1024;	/* XXX: kernel size COUNT_KERNEL vs LOAD_KERNL (lacked some SYMTAB?) */
 		kernsize = EFI_SIZE_TO_PAGES(kernsize);
 		status = uefi_call_wrapper(BS->AllocatePages, 4,
 		AllocateMaxAddress, EfiLoaderData, kernsize, );



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

2017-02-21 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Feb 21 10:53:37 UTC 2017

Modified Files:
src/sys/arch/i386/stand/efiboot: TODO.efiboot
src/sys/arch/i386/stand/efiboot/bootia32: Makefile efibootia32.c
Added Files:
src/sys/arch/i386/stand/efiboot/bootia32: startprog32.S

Log Message:
fix to be able to boot amd64 kernel from 32bit efiboot (booia32.efi).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/TODO.efiboot
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/bootia32/Makefile \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootia32/startprog32.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/TODO.efiboot
diff -u src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.1 src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.2
--- src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.1	Sat Feb 11 10:33:44 2017
+++ src/sys/arch/i386/stand/efiboot/TODO.efiboot	Tue Feb 21 10:53:37 2017
@@ -3,7 +3,6 @@
  * boot from CD/DVD (bootable from CD/DVD, but root fs not found.)
  * load boot.cfg from EFI system partition (FAT32)
  * fix module_init(). need to allocate memory for modules.
- * bootia32.efi can load kernel, but can't start kernel
 
 - kernel
  * handle UEFI variables (/dev/efivar)

Index: src/sys/arch/i386/stand/efiboot/bootia32/Makefile
diff -u src/sys/arch/i386/stand/efiboot/bootia32/Makefile:1.1 src/sys/arch/i386/stand/efiboot/bootia32/Makefile:1.2
--- src/sys/arch/i386/stand/efiboot/bootia32/Makefile:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/bootia32/Makefile	Tue Feb 21 10:53:37 2017
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2017/01/24 11:09:14 nonaka Exp $
+#	$NetBSD: Makefile,v 1.2 2017/02/21 10:53:37 nonaka Exp $
 
 PROG=		bootia32.efi
 OBJFMT=		pei-i386
 
-EXTRA_SOURCES=	efibootia32.c
+EXTRA_SOURCES=	efibootia32.c startprog32.S
 
 CPUFLAGS=	-march=i686 -mtune=i686
 GNUEFIARCH=	ia32
Index: src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c
diff -u src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.1 src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.2
--- src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c	Tue Feb 21 10:53:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibootia32.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: efibootia32.c,v 1.2 2017/02/21 10:53:37 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -32,18 +32,40 @@
 
 struct x86_boot_params boot_params;
 
+void startprog32_start(physaddr_t, uint32_t, uint32_t *, physaddr_t,
+physaddr_t, physaddr_t, u_long, void *);
+extern void (*startprog32)(physaddr_t, uint32_t, uint32_t *, physaddr_t,
+physaddr_t, physaddr_t, u_long, void *);
+extern u_int startprog32_size;
+
 void
 efi_md_init(void)
 {
-	/* Nothing to do */
+	EFI_STATUS status;
+	EFI_PHYSICAL_ADDRESS addr = EFI_ALLOCATE_MAX_ADDRESS;
+	u_int sz = EFI_SIZE_TO_PAGES(startprog32_size);
+
+	status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
+	EfiLoaderData, sz, );
+	if (EFI_ERROR(status))
+		Panic(L"%a: AllocatePages() failed: %d page(s): %r",
+		__func__, sz, status);
+	startprog32 = (void *)(u_long)addr;
+	CopyMem(startprog32, startprog32_start, startprog32_size);
 }
 
+/* ARGSUSED */
 void
 startprog(physaddr_t entry, uint32_t argc, uint32_t *argv, physaddr_t sp)
 {
-	Panic(L"%a: not implemented", __func__);
+
+	(*startprog32)(entry, argc, argv,
+	(physaddr_t)startprog32 + startprog32_size,
+	efi_kernel_start, efi_kernel_start + efi_loadaddr,
+	efi_kernel_size, startprog32);
 }
 
+/* ARGSUSED */
 void
 multiboot(physaddr_t entry, physaddr_t header, physaddr_t sp)
 {

Added files:

Index: src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S
diff -u /dev/null src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S:1.1
--- /dev/null	Tue Feb 21 10:53:37 2017
+++ src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S	Tue Feb 21 10:53:37 2017
@@ -0,0 +1,243 @@
+/*	$NetBSD: startprog32.S,v 1.1 2017/02/21 10:53:37 nonaka Exp $	*/
+/*	NetBSD: startprog.S,v 1.4 2016/12/04 08:21:08 maxv Exp	*/
+
+/*
+ * Ported to boot 386BSD by Julian Elischer (jul...@tfs.com) Sept 1992
+ *
+ * Mach Operating System
+ * Copyright (c) 1992, 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON 

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

2017-02-11 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Feb 11 10:33:44 UTC 2017

Added Files:
src/sys/arch/i386/stand/efiboot: TODO.efiboot

Log Message:
Added efiboot TODO.


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

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

Added files:

Index: src/sys/arch/i386/stand/efiboot/TODO.efiboot
diff -u /dev/null src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.1
--- /dev/null	Sat Feb 11 10:33:44 2017
+++ src/sys/arch/i386/stand/efiboot/TODO.efiboot	Sat Feb 11 10:33:44 2017
@@ -0,0 +1,18 @@
+- efiboot
+ * handle UEFI variables
+ * boot from CD/DVD (bootable from CD/DVD, but root fs not found.)
+ * load boot.cfg from EFI system partition (FAT32)
+ * fix module_init(). need to allocate memory for modules.
+ * bootia32.efi can load kernel, but can't start kernel
+
+- kernel
+ * handle UEFI variables (/dev/efivar)
+ * accelerated console
+
+- userland
+ * efibootmgr like utility
+ * merge distrib/amd64/uefi-installimage to distrib/amd64/install-image
+ * merge distrib/amd64/uefi-installimage/Makefile.* to distrib/common/Makefile.*
+
+- installer
+ * sysinst(8): handle dk(4) for install disk



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

2017-02-11 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Feb 11 10:23:39 UTC 2017

Modified Files:
src/sys/arch/i386/stand/efiboot: efiboot.c efiboot.h
src/sys/arch/i386/stand/efiboot/bootx64: efibootx64.c startprog64.S
src/sys/arch/i386/stand/lib: exec.c

Log Message:
PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/efiboot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/i386/stand/lib/exec.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.3 src/sys/arch/i386/stand/efiboot/efiboot.c:1.4
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.3	Sat Feb 11 10:15:55 2017
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Sat Feb 11 10:23:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.3 2017/02/11 10:15:55 nonaka Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.4 2017/02/11 10:23:39 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -35,6 +35,8 @@ EFI_HANDLE IH;
 EFI_DEVICE_PATH *efi_bootdp;
 EFI_LOADED_IMAGE *efi_li;
 uintptr_t efi_main_sp;
+physaddr_t efi_loadaddr, efi_kernel_start;
+u_long efi_kernel_size;
 bool efi_cleanuped;
 
 static EFI_PHYSICAL_ADDRESS heap_start = EFI_ALLOCATE_MAX_ADDRESS;
Index: src/sys/arch/i386/stand/efiboot/efiboot.h
diff -u src/sys/arch/i386/stand/efiboot/efiboot.h:1.3 src/sys/arch/i386/stand/efiboot/efiboot.h:1.4
--- src/sys/arch/i386/stand/efiboot/efiboot.h:1.3	Sat Feb 11 10:15:55 2017
+++ src/sys/arch/i386/stand/efiboot/efiboot.h	Sat Feb 11 10:23:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.3 2017/02/11 10:15:55 nonaka Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.4 2017/02/11 10:23:39 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -48,6 +48,8 @@ extern EFI_HANDLE IH;
 extern EFI_DEVICE_PATH *efi_bootdp;
 extern EFI_LOADED_IMAGE *efi_li;
 extern uintptr_t efi_main_sp;
+extern physaddr_t efi_loadaddr, efi_kernel_start;
+extern u_long efi_kernel_size;
 extern bool efi_cleanuped;
 void efi_cleanup(void);
 

Index: src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c
diff -u src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c:1.1 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c:1.2
--- src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c	Sat Feb 11 10:23:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibootx64.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: efibootx64.c,v 1.2 2017/02/11 10:23:39 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -32,8 +32,10 @@
 
 struct x86_boot_params boot_params;
 
-void startprog64_start(void *, physaddr_t, physaddr_t);
-extern void (*startprog64)(void *, physaddr_t, physaddr_t);
+void startprog64_start(physaddr_t, physaddr_t, physaddr_t, u_long,
+void *, physaddr_t);
+extern void (*startprog64)(physaddr_t, physaddr_t, physaddr_t, u_long,
+void *, physaddr_t);
 extern u_int startprog64_size;
 
 void
@@ -64,7 +66,8 @@ startprog(physaddr_t entry, uint32_t arg
 		memcpy(newsp, argv, sizeof(*argv) * argc);
 	}
 
-	(*startprog64)(startprog64, entry, (physaddr_t)newsp);
+	(*startprog64)(efi_kernel_start, efi_kernel_start + efi_loadaddr,
+	(physaddr_t)newsp, efi_kernel_size, startprog64, entry);
 }
 
 /* ARGSUSED */

Index: src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S
diff -u src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S:1.2 src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S:1.3
--- src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S:1.2	Sat Feb  4 16:14:27 2017
+++ src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S	Sat Feb 11 10:23:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: startprog64.S,v 1.2 2017/02/04 16:14:27 christos Exp $	*/
+/*	$NetBSD: startprog64.S,v 1.3 2017/02/11 10:23:39 nonaka Exp $	*/
 /*	NetBSD: startprog.S,v 1.3 2003/02/01 14:48:18 dsl Exp	*/
 
 /* starts program in protected mode / flat space
@@ -78,26 +78,135 @@ _C_LABEL(startprog64_size):
 	.p2align 4,,15
 
 /*
- * startprog64(loadddr,entry,stack)
+ * startprog64(loadddr,entry,stack,kern_load,kern_start,kern_size)
  */
 ENTRY(startprog64_start)
 start:
 	/*
 	 * This function is to call the loaded kernel's start() with
 	 * 32bit segment mode from x64 mode.
-	 * %rdi: loaded start address
-	 * %rsi: kernel entry address
+	 * %rdi: kernel start address
+	 * %rsi: loaded kernel address
 	 * %rdx: stack address
+	 * %rcx: loaded kernel size
+	 * %r8 : loaded start 

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

2017-02-11 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Feb 11 10:18:10 UTC 2017

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
efiboot: Copy bootinfo to safe arena.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/i386/stand/lib/exec.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/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.63 src/sys/arch/i386/stand/lib/exec.c:1.64
--- src/sys/arch/i386/stand/lib/exec.c:1.63	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/lib/exec.c	Sat Feb 11 10:18:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.63 2017/01/24 11:09:14 nonaka Exp $	 */
+/*	$NetBSD: exec.c,v 1.64 2017/02/11 10:18:10 nonaka Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -389,6 +389,9 @@ exec_netbsd(const char *file, physaddr_t
 	u_long extmem;
 	u_long basemem;
 	int error;
+#ifdef EFIBOOT
+	int i;
+#endif
 
 #ifdef	DEBUG
 	printf("exec: file=%s loadaddr=0x%lx\n", file ? file : "NULL",
@@ -449,6 +452,14 @@ exec_netbsd(const char *file, physaddr_t
 	if (callback != NULL)
 		(*callback)();
 #ifdef EFIBOOT
+	/* Copy bootinfo to safe arena. */
+	for (i = 0; i < bootinfo->nentries; i++) {
+		struct btinfo_common *bi = (void *)(u_long)bootinfo->entry[i];
+		char *p = alloc(bi->len);
+		memcpy(p, bi, bi->len);
+		bootinfo->entry[i] = vtophys(p);
+	}
+
 	/* Copy the kernel to original load address. */
 	memmove((void *)marks[MARK_START],
 	(void *)(efi_loadaddr + marks[MARK_START]),



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

2017-02-11 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Feb 11 10:15:55 UTC 2017

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

Log Message:
efiboot: don't call WaitForSingleEvent after ExitBootServices is called.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/efiboot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/panic.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.2 src/sys/arch/i386/stand/efiboot/efiboot.c:1.3
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.2	Sat Feb 11 10:13:46 2017
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Sat Feb 11 10:15:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.2 2017/02/11 10:13:46 nonaka Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.3 2017/02/11 10:15:55 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -35,6 +35,7 @@ EFI_HANDLE IH;
 EFI_DEVICE_PATH *efi_bootdp;
 EFI_LOADED_IMAGE *efi_li;
 uintptr_t efi_main_sp;
+bool efi_cleanuped;
 
 static EFI_PHYSICAL_ADDRESS heap_start = EFI_ALLOCATE_MAX_ADDRESS;
 static UINTN heap_size = 1 * 1024 * 1024;			/* 1MB */
@@ -121,6 +122,7 @@ efi_cleanup(void)
 		if (EFI_ERROR(status))
 			Panic(L"ExitBootServices failed");
 	}
+	efi_cleanuped = true;
 
 	allocsz = sizeof(struct btinfo_efimemmap) - 1
 	+ NoEntries * DescriptorSize;
Index: src/sys/arch/i386/stand/efiboot/efiboot.h
diff -u src/sys/arch/i386/stand/efiboot/efiboot.h:1.2 src/sys/arch/i386/stand/efiboot/efiboot.h:1.3
--- src/sys/arch/i386/stand/efiboot/efiboot.h:1.2	Sat Feb 11 10:13:46 2017
+++ src/sys/arch/i386/stand/efiboot/efiboot.h	Sat Feb 11 10:15:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.2 2017/02/11 10:13:46 nonaka Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.3 2017/02/11 10:15:55 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -48,6 +48,7 @@ extern EFI_HANDLE IH;
 extern EFI_DEVICE_PATH *efi_bootdp;
 extern EFI_LOADED_IMAGE *efi_li;
 extern uintptr_t efi_main_sp;
+extern bool efi_cleanuped;
 void efi_cleanup(void);
 
 /* eficons.c */

Index: src/sys/arch/i386/stand/efiboot/panic.c
diff -u src/sys/arch/i386/stand/efiboot/panic.c:1.3 src/sys/arch/i386/stand/efiboot/panic.c:1.4
--- src/sys/arch/i386/stand/efiboot/panic.c:1.3	Sun Feb  5 10:13:43 2017
+++ src/sys/arch/i386/stand/efiboot/panic.c	Sat Feb 11 10:15:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: panic.c,v 1.3 2017/02/05 10:13:43 joerg Exp $	*/
+/*	$NetBSD: panic.c,v 1.4 2017/02/11 10:15:55 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -54,7 +54,8 @@ __dead void
 reboot(void)
 {
 
-	WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
+	if (!efi_cleanuped)
+		WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
 
 	uefi_call_wrapper(RT->ResetSystem, 4, EfiResetCold, EFI_SUCCESS,
 	0, NULL);



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

2017-02-11 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Feb 11 10:13:46 UTC 2017

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

Log Message:
efiboot: pass memory map after ExitBootService is called to kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/efiboot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.2 -r1.3 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/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.6 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.7
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.6	Mon Feb  6 10:32:35 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Sat Feb 11 10:13:46 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.6 2017/02/06 10:32:35 nonaka Exp $
+# $NetBSD: Makefile.efiboot,v 1.7 2017/02/11 10:13:46 nonaka Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -61,7 +61,6 @@ CPPFLAGS+= -DSUPPORT_CD9660
 CPPFLAGS+= -DSUPPORT_DOSFS
 CPPFLAGS+= -DSUPPORT_EXT2FS
 CPPFLAGS+= -DPASS_BIOSGEOM
-CPPFLAGS+= -DPASS_MEMMAP
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
 
 EFIDIR= ${S}/external/bsd/gnu-efi/dist

Index: src/sys/arch/i386/stand/efiboot/efiboot.c
diff -u src/sys/arch/i386/stand/efiboot/efiboot.c:1.1 src/sys/arch/i386/stand/efiboot/efiboot.c:1.2
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Sat Feb 11 10:13:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.2 2017/02/11 10:13:46 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -97,6 +97,8 @@ efi_cleanup(void)
 	EFI_MEMORY_DESCRIPTOR *desc;
 	UINTN NoEntries, MapKey, DescriptorSize;
 	UINT32 DescriptorVersion;
+	struct btinfo_efimemmap *bim;
+	size_t allocsz;
 
 	clearit();
 
@@ -108,17 +110,26 @@ efi_cleanup(void)
 	BI_ADD(_efi, BTINFO_EFI, sizeof(btinfo_efi));
 
 	NoEntries = 0;
-	desc = LibMemoryMap(, , ,
-	);
+	desc = efi_memory_get_map(, , ,
+	, true);
 	status = uefi_call_wrapper(BS->ExitBootServices, 2, IH, MapKey);
 	if (EFI_ERROR(status)) {
 		FreePool(desc);
-		desc = LibMemoryMap(, , ,
-		);
+		desc = efi_memory_get_map(, , ,
+		, true);
 		status = uefi_call_wrapper(BS->ExitBootServices, 2, IH, MapKey);
 		if (EFI_ERROR(status))
 			Panic(L"ExitBootServices failed");
 	}
+
+	allocsz = sizeof(struct btinfo_efimemmap) - 1
+	+ NoEntries * DescriptorSize;
+	bim = alloc(allocsz);
+	bim->num = NoEntries;
+	bim->version = DescriptorVersion;
+	bim->size = DescriptorSize;
+	memcpy(bim->memmap, desc, NoEntries * DescriptorSize);
+	BI_ADD(bim, BTINFO_EFIMEMMAP, allocsz);
 }
 
 static void
Index: src/sys/arch/i386/stand/efiboot/efiboot.h
diff -u src/sys/arch/i386/stand/efiboot/efiboot.h:1.1 src/sys/arch/i386/stand/efiboot/efiboot.h:1.2
--- src/sys/arch/i386/stand/efiboot/efiboot.h:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/efiboot.h	Sat Feb 11 10:13:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.2 2017/02/11 10:13:46 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -61,6 +61,8 @@ void efi_disk_probe(void);
 /* efimemory.c */
 void efi_memory_probe(void);
 void efi_memory_show_map(bool);
+EFI_MEMORY_DESCRIPTOR *efi_memory_get_map(UINTN *, UINTN *, UINTN *, UINT32 *,
+bool);
 
 /* panic.c */
 __dead VOID Panic(IN CHAR16 *, ...);

Index: src/sys/arch/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.2 src/sys/arch/i386/stand/efiboot/efimemory.c:1.3
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.2	Fri Feb  3 16:42:26 2017
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Sat Feb 11 10:13:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.2 2017/02/03 16:42:26 roy Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.3 2017/02/11 10:13:46 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -87,9 +87,9 @@ getmemtype(EFI_MEMORY_DESCRIPTOR *md)
 	return BIM_Reserved;
 }
 
-static EFI_MEMORY_DESCRIPTOR *
-GetMemoryMap(OUT UINTN *NoEntries, OUT UINTN *MapKey, OUT UINTN *DescriptorSize,
-OUT UINT32 *DescriptorVersion, bool sorted)
+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;
 	UINTN i, j;
@@ -98,7 +98,7 @@ GetMemoryMap(OUT UINTN *NoEntries, OUT U
 	desc = LibMemoryMap(NoEntries, MapKey, DescriptorSize,
 	DescriptorVersion);
 	if (desc == NULL)
-		Panic(L"LibMemoryMap failed");
+		

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

2017-02-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb  5 10:13:43 UTC 2017

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

Log Message:
Be a bit nicer to outdated compilers and use __unreachable().


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/panic.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/panic.c
diff -u src/sys/arch/i386/stand/efiboot/panic.c:1.2 src/sys/arch/i386/stand/efiboot/panic.c:1.3
--- src/sys/arch/i386/stand/efiboot/panic.c:1.2	Sat Feb  4 13:36:07 2017
+++ src/sys/arch/i386/stand/efiboot/panic.c	Sun Feb  5 10:13:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: panic.c,v 1.2 2017/02/04 13:36:07 roy Exp $	*/
+/*	$NetBSD: panic.c,v 1.3 2017/02/05 10:13:43 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -47,7 +47,7 @@ Panic(
 	va_end(args);
 	reboot();
 	/*NOTREACHED*/
-	__builtin_unreachable();
+	__unreachable();
 }
 
 __dead void



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

2017-02-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb  5 10:13:18 UTC 2017

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

Log Message:
Unbreak clang again.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.5
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.4	Sat Feb  4 16:14:04 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Sun Feb  5 10:13:18 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.4 2017/02/04 16:14:04 christos Exp $
+# $NetBSD: Makefile.efiboot,v 1.5 2017/02/05 10:13:18 joerg Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -48,7 +48,7 @@ CPPFLAGS+= -I${.CURDIR}/../../lib
 
 COPTS+= -ffreestanding -fPIC -fshort-wchar -fno-strict-aliasing -fno-builtin
 COPTS+= -fno-stack-protector
-COPTS+= -Wno-error=unused-but-set-variable
+COPTS+= ${${ACTIVE_CC} == "gcc":? -Wno-error=unused-but-set-variable :}
 COPTS+= ${${ACTIVE_CC} == "gcc":? -falign-functions=16 :}
 CPPFLAGS+= -nostdinc -D_STANDALONE
 CPPFLAGS+= -DEFIBOOT



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

2017-02-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb  4 16:14:28 UTC 2017

Modified Files:
src/sys/arch/i386/stand/efiboot/bootx64: startprog64.S

Log Message:
Fix operand width


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/sys/arch/i386/stand/efiboot/bootx64/startprog64.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/bootx64/startprog64.S
diff -u src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S:1.1 src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S:1.2
--- src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S:1.1	Tue Jan 24 06:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S	Sat Feb  4 11:14:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: startprog64.S,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: startprog64.S,v 1.2 2017/02/04 16:14:27 christos Exp $	*/
 /*	NetBSD: startprog.S,v 1.3 2003/02/01 14:48:18 dsl Exp	*/
 
 /* starts program in protected mode / flat space
@@ -110,11 +110,11 @@ start:
 	.code32
 start32a:
 	movl	$DATA_SEGMENT, %eax
-	movw	%eax, %ds
-	movw	%eax, %es
-	movw	%eax, %fs
-	movw	%eax, %gs
-	movw	%eax, %ss
+	movw	%ax, %ds
+	movw	%ax, %es
+	movw	%ax, %fs
+	movw	%ax, %gs
+	movw	%ax, %ss
 
 	movl	%edx, %esp
 



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

2017-02-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb  4 16:14:04 UTC 2017

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

Log Message:
Don't error out for set but unused variables for now.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.4
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.3	Sat Feb  4 08:36:07 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Sat Feb  4 11:14:04 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.3 2017/02/04 13:36:07 roy Exp $
+# $NetBSD: Makefile.efiboot,v 1.4 2017/02/04 16:14:04 christos Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -48,6 +48,7 @@ CPPFLAGS+= -I${.CURDIR}/../../lib
 
 COPTS+= -ffreestanding -fPIC -fshort-wchar -fno-strict-aliasing -fno-builtin
 COPTS+= -fno-stack-protector
+COPTS+= -Wno-error=unused-but-set-variable
 COPTS+= ${${ACTIVE_CC} == "gcc":? -falign-functions=16 :}
 CPPFLAGS+= -nostdinc -D_STANDALONE
 CPPFLAGS+= -DEFIBOOT



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

2017-02-04 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Feb  4 13:36:07 UTC 2017

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

Log Message:
Mark reboot() and _rtt() as __dead.
Use __builtin_unreachable() to ensure Panic really is marked dead.

Thanks to joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/panic.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.2 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.3
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.2	Fri Feb  3 17:24:43 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Sat Feb  4 13:36:07 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.2 2017/02/03 17:24:43 roy Exp $
+# $NetBSD: Makefile.efiboot,v 1.3 2017/02/04 13:36:07 roy Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -46,7 +46,6 @@ CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR
 CPPFLAGS+= -I${.OBJDIR}
 CPPFLAGS+= -I${.CURDIR}/../../lib
 
-CWARNFLAGS.clang+= -Wno-invalid-noreturn #panic.c
 COPTS+= -ffreestanding -fPIC -fshort-wchar -fno-strict-aliasing -fno-builtin
 COPTS+= -fno-stack-protector
 COPTS+= ${${ACTIVE_CC} == "gcc":? -falign-functions=16 :}

Index: src/sys/arch/i386/stand/efiboot/panic.c
diff -u src/sys/arch/i386/stand/efiboot/panic.c:1.1 src/sys/arch/i386/stand/efiboot/panic.c:1.2
--- src/sys/arch/i386/stand/efiboot/panic.c:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/panic.c	Sat Feb  4 13:36:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: panic.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: panic.c,v 1.2 2017/02/04 13:36:07 roy Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -47,9 +47,10 @@ Panic(
 	va_end(args);
 	reboot();
 	/*NOTREACHED*/
+	__builtin_unreachable();
 }
 
-void
+__dead void
 reboot(void)
 {
 
@@ -61,7 +62,7 @@ reboot(void)
 		continue;
 }
 
-void
+__dead void
 _rtt(void)
 {
 



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

2017-02-03 Thread Roy Marples
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.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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.1 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.2
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Fri Feb  3 17:24:43 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.1 2017/01/24 11:09:14 nonaka Exp $
+# $NetBSD: Makefile.efiboot,v 1.2 2017/02/03 17:24:43 roy Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -46,8 +46,10 @@ CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR
 CPPFLAGS+= -I${.OBJDIR}
 CPPFLAGS+= -I${.CURDIR}/../../lib
 
+CWARNFLAGS.clang+= -Wno-invalid-noreturn #panic.c
 COPTS+= -ffreestanding -fPIC -fshort-wchar -fno-strict-aliasing -fno-builtin
-COPTS+= -fno-stack-protector -falign-functions=16
+COPTS+= -fno-stack-protector
+COPTS+= ${${ACTIVE_CC} == "gcc":? -falign-functions=16 :}
 CPPFLAGS+= -nostdinc -D_STANDALONE
 CPPFLAGS+= -DEFIBOOT
 



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

2017-02-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Feb  3 16:42:26 UTC 2017

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

Log Message:
rows is a uint ... it will always be greater than or equal to 0.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/boot.c \
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.1 src/sys/arch/i386/stand/efiboot/boot.c:1.2
--- src/sys/arch/i386/stand/efiboot/boot.c:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/boot.c	Fri Feb  3 16:42:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.2 2017/02/03 16:42:26 roy Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -540,7 +540,7 @@ command_devpath(char *arg)
 			Print(L"%d:%d:%s\n", DevicePathType(dp), DevicePathSubType(dp), path);
 			FreePool(path);
 
-			if (rows >= 0 && ++row >= rows) {
+			if (++row >= rows) {
 row = 0;
 Print(L"Press Any Key to continue :");
 (void) awaitkey(-1, 0);
@@ -607,7 +607,7 @@ command_efivar(char *arg)
 		val ? val : L"(null)");
 		FreePool(val);
 
-		if (rows >= 0 && ++row >= rows) {
+		if (++row >= rows) {
 			row = 0;
 			Print(L"Press Any Key to continue :");
 			(void) awaitkey(-1, 0);
Index: src/sys/arch/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.1 src/sys/arch/i386/stand/efiboot/efimemory.c:1.2
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Fri Feb  3 16:42:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.2 2017/02/03 16:42:26 roy Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -288,7 +288,7 @@ efi_memory_show_map(bool sorted)
 		md->Type >= __arraycount(efimemtypes) ?
 		  efimemstr : efimemtypes[md->Type]);
 
-		if (rows >= 0 && ++row >= rows) {
+		if (++row >= rows) {
 			row = 0;
 			Print(L"Press Any Key to continue :");
 			(void) awaitkey(-1, 0);



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

2017-01-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jan 12 22:16:29 UTC 2017

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

Log Message:
Remove some manual size tuning that no longer seems to be needed.


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

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/Makefile.inc
diff -u src/sys/arch/i386/stand/Makefile.inc:1.12 src/sys/arch/i386/stand/Makefile.inc:1.13
--- src/sys/arch/i386/stand/Makefile.inc:1.12	Thu May  1 18:37:26 2014
+++ src/sys/arch/i386/stand/Makefile.inc	Thu Jan 12 22:16:29 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.12 2014/05/01 18:37:26 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.13 2017/01/12 22:16:29 joerg Exp $
 
 .include 
 
@@ -9,5 +9,4 @@ OPT_SIZE.gcc=	-Os -ffreestanding -fomit-
 OPT_SIZE.clang=	-Oz -ffreestanding -fomit-frame-pointer -DNDEBUG \
 		-fno-stack-protector -mno-sse \
 		-mstack-alignment=4 \
-		-mllvm -inline-threshold=3 -mllvm -enable-load-pre=false \
 		-fno-unwind-tables



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

2016-12-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec  4 08:21:08 UTC 2016

Modified Files:
src/sys/arch/i386/stand/lib: biosmem.S biosmemps2.S biosmemx.S exec.c
multiboot.S startprog.S

Log Message:
KNF and explain a few things


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/lib/biosmem.S \
src/sys/arch/i386/stand/lib/biosmemx.S
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/lib/biosmemps2.S
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/multiboot.S
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/lib/startprog.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/lib/biosmem.S
diff -u src/sys/arch/i386/stand/lib/biosmem.S:1.9 src/sys/arch/i386/stand/lib/biosmem.S:1.10
--- src/sys/arch/i386/stand/lib/biosmem.S:1.9	Thu Jun 16 13:27:59 2011
+++ src/sys/arch/i386/stand/lib/biosmem.S	Sun Dec  4 08:21:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosmem.S,v 1.9 2011/06/16 13:27:59 joerg Exp $	*/
+/*	$NetBSD: biosmem.S,v 1.10 2016/12/04 08:21:08 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996
@@ -36,8 +36,9 @@
 
 	.text
 
-/* get mem below 1M, in kByte */
-
+/*
+ * Get mem below 1M, in kByte.
+ */
 ENTRY(getbasemem)
 	pusha
 
@@ -45,18 +46,19 @@ ENTRY(getbasemem)
 	.code16
 
 	int	$0x12
-	# zero-extend 16-bit result to 32 bits.
-	movzwl	%ax, %eax
+	/* Zero-extend 16-bit result to 32 bits */
+	movzwl	%ax,%eax
 
 	calll	_C_LABEL(real_to_prot)
 	.code32
 
-	movl	%eax, 28(%esp)
+	movl	%eax,28(%esp)
 	popa
 	ret
 
-/* get mem above 1M, in kByte */
-
+/*
+ * Get mem above 1M, in kByte.
+ */
 ENTRY(getextmem1)
 	pusha
 
@@ -66,13 +68,13 @@ ENTRY(getextmem1)
 	movb	$0x88,%ah
 	int	$0x15
 
-	# zero-extend 16-bit result to 32 bits.
-	movzwl	%ax, %eax
+	/* Zero-extend 16-bit result to 32 bits */
+	movzwl	%ax,%eax
 
 	calll	_C_LABEL(real_to_prot)
 	.code32
 
-	movl	%eax, 28(%esp)
+	movl	%eax,28(%esp)
 	popa
 	ret
 
Index: src/sys/arch/i386/stand/lib/biosmemx.S
diff -u src/sys/arch/i386/stand/lib/biosmemx.S:1.9 src/sys/arch/i386/stand/lib/biosmemx.S:1.10
--- src/sys/arch/i386/stand/lib/biosmemx.S:1.9	Tue Oct 14 14:18:11 2008
+++ src/sys/arch/i386/stand/lib/biosmemx.S	Sun Dec  4 08:21:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosmemx.S,v 1.9 2008/10/14 14:18:11 ad Exp $	*/
+/*	$NetBSD: biosmemx.S,v 1.10 2016/12/04 08:21:08 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999
@@ -30,11 +30,13 @@
 
 	.text
 
-/* int getextmem2(int buffer[2])
-   return: 0=OK, -1=error
-   buffer[0]: extmem kBytes below 16M (max 15M/1024)
-   buffer[1]: extmem above 16M, in 64k units
-*/
+/*
+ * int getextmem2(int buffer[2])
+ *
+ * return: 0=OK, -1=error
+ * buffer[0]: extmem kBytes below 16M (max 15M/1024)
+ * buffer[1]: extmem above 16M, in 64k units
+ */
 ENTRY(getextmem2)
 	pushl	%ebp
 	movl	%esp,%ebp
@@ -47,16 +49,16 @@ ENTRY(getextmem2)
 	call	_C_LABEL(prot_to_real)
 	.code16
 
-	xorl	%ebx, %ebx
-	movl	$0xe801, %eax
+	xorl	%ebx,%ebx
+	movl	$0xe801,%eax
 	int	$0x15
 	pushf
 
-	movw	%si, %ax
-	orw	%si, %bx
+	movw	%si,%ax
+	orw	%si,%bx
 	jz	1f		/* if zero use configured values */
-	movw	%cx, %ax	/* k below 16M (max 0x3c00 = 15MB) */
-	movw	%dx, %bx	/* 64k above 16M */
+	movw	%cx,%ax		/* k below 16M (max 0x3c00 = 15MB) */
+	movw	%dx,%bx		/* 64k above 16M */
 1:
 	popf
 	setc	%bl
@@ -64,13 +66,13 @@ ENTRY(getextmem2)
 	calll	_C_LABEL(real_to_prot)
 	.code32
 
-	movl	8(%ebp), %edi
-	xorl	%eax, %eax
-	movw	%cx, %ax
+	movl	8(%ebp),%edi
+	xorl	%eax,%eax
+	movw	%cx,%ax
 	stosl
-	movw	%dx, %ax
+	movw	%dx,%ax
 	stosl
-	movb	%bl, %al
+	movb	%bl,%al
 	cbw
 
 	pop	%edi
@@ -81,12 +83,14 @@ ENTRY(getextmem2)
 	popl	%ebp
 	ret
 
-/* int getmementry(int *iterator, buffer[5])
-   return: 0=ok, else error
-   buffer[0]: start of memory chunk
-   buffer[2]: length (bytes)
-   buffer[4]: type
-*/
+/*
+ * int getmementry(int *iterator, int buffer[5])
+ *
+ * return: 0=ok, else error
+ * buffer[0]: start of memory chunk
+ * buffer[2]: length (bytes)
+ * buffer[4]: type
+ */
 ENTRY(getmementry)
 	pushl	%ebp
 	movl	%esp,%ebp
@@ -96,24 +100,24 @@ ENTRY(getmementry)
 	push	%esi
 	push	%edi
 
-	movl	8(%ebp), %eax
-	movl	0(%eax), %ebx		/* index */
-	movl	$20, %ecx		/* Buffer size */
-	movl	$0x534d4150, %edx	/* "SMAP" */
-	movl	12(%ebp), %edi		/* buffer address */
+	movl	8(%ebp),%eax
+	movl	0(%eax),%ebx		/* index */
+	movl	$20,%ecx		/* Buffer size */
+	movl	$0x534d4150,%edx	/* "SMAP" */
+	movl	12(%ebp),%edi		/* buffer address */
 
 	call	_C_LABEL(prot_to_real)
 	.code16
 
 	push	%di
-	shrl	$4, %edi
-	mov	%ds, %ax
-	add	%di, %ax
-	mov	%ax, %es
+	shrl	$4,%edi
+	mov	%ds,%ax
+	add	%di,%ax
+	mov	%ax,%es
 	pop	%di
-	and	$0xf, %di		/* buffer addres now in ES:DI */
+	and	$0xf,%di		/* buffer addres now in ES:DI */
 
-	movl	$0xe820, %eax		/* Some BIOS check EAX value */
+	movl	$0xe820,%eax		/* Some BIOS check EAX value */
 	int	$0x15
 
 	setc	%cl
@@ 

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

2016-06-05 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun  5 14:13:57 UTC 2016

Modified Files:
src/sys/arch/i386/stand/lib: bootinfo.c bootinfo.h exec.c

Log Message:
Don't use a magic value. Define a limit, and enforce it.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/bootinfo.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/lib/bootinfo.h
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/i386/stand/lib/exec.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/lib/bootinfo.c
diff -u src/sys/arch/i386/stand/lib/bootinfo.c:1.5 src/sys/arch/i386/stand/lib/bootinfo.c:1.6
--- src/sys/arch/i386/stand/lib/bootinfo.c:1.5	Sun Dec 14 18:46:33 2008
+++ src/sys/arch/i386/stand/lib/bootinfo.c	Sun Jun  5 14:13:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.c,v 1.5 2008/12/14 18:46:33 christos Exp $	*/
+/*	$NetBSD: bootinfo.c,v 1.6 2016/06/05 14:13:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997
@@ -40,6 +40,11 @@ bi_add(struct btinfo_common *what, int t
 	what->len = size;
 	what->type = type;
 
-	if (bootinfo)
-		bootinfo->entry[bootinfo->nentries++] = vtophys(what);
+	if (bootinfo == NULL) {
+		return;
+	}
+	if (bootinfo->nentries >= BTINFO_MAX) {
+		panic("bootinfo too big");
+	}
+	bootinfo->entry[bootinfo->nentries++] = vtophys(what);
 }

Index: src/sys/arch/i386/stand/lib/bootinfo.h
diff -u src/sys/arch/i386/stand/lib/bootinfo.h:1.10 src/sys/arch/i386/stand/lib/bootinfo.h:1.11
--- src/sys/arch/i386/stand/lib/bootinfo.h:1.10	Mon Nov 18 03:52:45 2013
+++ src/sys/arch/i386/stand/lib/bootinfo.h	Sun Jun  5 14:13:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.10 2013/11/18 03:52:45 jakllsch Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.11 2016/06/05 14:13:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997
@@ -35,6 +35,8 @@ struct bootinfo {
 
 extern struct bootinfo *bootinfo;
 
+#define BTINFO_MAX	32
+
 #define BI_ALLOC(max) (bootinfo = alloc(sizeof(struct bootinfo) \
 + ((max) - 1) * sizeof(uint32_t))) \
   ->nentries = 0

Index: src/sys/arch/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.60 src/sys/arch/i386/stand/lib/exec.c:1.61
--- src/sys/arch/i386/stand/lib/exec.c:1.60	Sun Jun  5 14:06:31 2016
+++ src/sys/arch/i386/stand/lib/exec.c	Sun Jun  5 14:13:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.60 2016/06/05 14:06:31 maxv Exp $	 */
+/*	$NetBSD: exec.c,v 1.61 2016/06/05 14:13:57 maxv Exp $	 */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -356,7 +356,7 @@ exec_netbsd(const char *file, physaddr_t
 	   file ? file : "NULL", loadaddr);
 #endif
 
-	BI_ALLOC(32); /* ??? */
+	BI_ALLOC(BTINFO_MAX);
 
 	BI_ADD(_console, BTINFO_CONSOLE, sizeof(struct btinfo_console));
 



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

2016-06-05 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun  5 14:06:31 UTC 2016

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c exec.c

Log Message:
The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/i386/stand/lib/exec.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/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.44 src/sys/arch/i386/stand/lib/biosdisk.c:1.45
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.44	Sun Jan 18 20:18:07 2015
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Sun Jun  5 14:06:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.44 2015/01/18 20:18:07 jakllsch Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.45 2016/06/05 14:06:31 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -701,24 +701,13 @@ biosdisk_findpartition(int biosdev, dadd
 static void
 add_biosdisk_bootinfo(void)
 {
-	static bool done;
-
 	if (bootinfo == NULL) {
-		done = false;
 		return;
 	}
-	
-	if (done)
-		return;
-
 	BI_ADD(_disk, BTINFO_BOOTDISK, sizeof(bi_disk));
 	BI_ADD(_wedge, BTINFO_BOOTWEDGE, sizeof(bi_wedge));
-
-	done = true;
-
 	return;
 }
-
 #endif
 
 int

Index: src/sys/arch/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.59 src/sys/arch/i386/stand/lib/exec.c:1.60
--- src/sys/arch/i386/stand/lib/exec.c:1.59	Sun Apr  6 19:18:00 2014
+++ src/sys/arch/i386/stand/lib/exec.c	Sun Jun  5 14:06:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.59 2014/04/06 19:18:00 jakllsch Exp $	 */
+/*	$NetBSD: exec.c,v 1.60 2016/06/05 14:06:31 maxv Exp $	 */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -411,7 +411,7 @@ exec_netbsd(const char *file, physaddr_t
 
 out:
 	BI_FREE();
-	bootinfo = 0;
+	bootinfo = NULL;
 	return -1;
 }
 



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

2016-05-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 23 18:36:06 UTC 2016

Modified Files:
src/sys/arch/i386/stand/misc: rawr32.exe.uue

Log Message:
New Rawrite32 release


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/misc/rawr32.exe.uue

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

diffs are larger than 1MB and have been omitted


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

2016-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  3 15:06:25 UTC 2016

Modified Files:
src/sys/arch/i386/stand/misc: rawr32.exe.uue

Log Message:
New rawrite32 version out (small bugfixes)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/misc/rawr32.exe.uue

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

diffs are larger than 1MB and have been omitted


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

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:27:53 UTC 2016

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
PR/50748: David Binderman: check bounds before dereference


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.65 src/sys/arch/i386/stand/boot/boot2.c:1.66
--- src/sys/arch/i386/stand/boot/boot2.c:1.65	Thu Jun 11 11:56:53 2015
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Feb  3 00:27:53 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.65 2015/06/11 15:56:53 khorben Exp $	*/
+/*	$NetBSD: boot2.c,v 1.66 2016/02/03 05:27:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -266,8 +266,8 @@ print_banner(void)
 #ifndef SMALL
 	int n;
 	if (bootcfg_info.banner[0]) {
-		for (n = 0; bootcfg_info.banner[n]
-		&& n < BOOTCFG_MAXBANNER; n++) 
+		for (n = 0; n < BOOTCFG_MAXBANNER && bootcfg_info.banner[n];
+		n++) 
 			printf("%s\n", bootcfg_info.banner[n]);
 	} else {
 #endif /* !SMALL */



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

2016-01-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 23 22:29:29 UTC 2016

Modified Files:
src/sys/arch/i386/stand/boot: Makefile.boot
src/sys/arch/i386/stand/dosboot: Makefile
src/sys/arch/i386/stand/pxeboot: Makefile

Log Message:
We'll define the kernel types for standalone code.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/i386/stand/boot/Makefile.boot
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/stand/dosboot/Makefile
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/pxeboot/Makefile

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/boot/Makefile.boot
diff -u src/sys/arch/i386/stand/boot/Makefile.boot:1.68 src/sys/arch/i386/stand/boot/Makefile.boot:1.69
--- src/sys/arch/i386/stand/boot/Makefile.boot:1.68	Sat Jan 23 16:22:47 2016
+++ src/sys/arch/i386/stand/boot/Makefile.boot	Sat Jan 23 17:29:29 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.boot,v 1.68 2016/01/23 21:22:47 christos Exp $
+# $NetBSD: Makefile.boot,v 1.69 2016/01/23 22:29:29 christos Exp $
 
 S=	${.CURDIR}/../../../../..
 
@@ -36,7 +36,7 @@ BINMODE=444
 
 LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
 CPPFLAGS+= -I ${.CURDIR}/..  -I ${.CURDIR}/../../lib -I ${S}/lib/libsa
-CPPFLAGS+= -I ${.OBJDIR} -D_KERNTYPES
+CPPFLAGS+= -I ${.OBJDIR}
 # Make sure we override any optimization options specified by the user
 COPTS=  -Os
 

Index: src/sys/arch/i386/stand/dosboot/Makefile
diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.29 src/sys/arch/i386/stand/dosboot/Makefile:1.30
--- src/sys/arch/i386/stand/dosboot/Makefile:1.29	Sat Jan 23 16:22:47 2016
+++ src/sys/arch/i386/stand/dosboot/Makefile	Sat Jan 23 17:29:29 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.29 2016/01/23 21:22:47 christos Exp $
+#	$NetBSD: Makefile,v 1.30 2016/01/23 22:29:29 christos Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -13,7 +13,7 @@ SRCS= main.c devopen.c exec.c
 
 CPPFLAGS+= -DSLOW	# for libz
 CPPFLAGS+= -DCOMPAT_386BSD_MBRPART
-CPPFLAGS+= -DXMS -D_KERNTYPES
+CPPFLAGS+= -DXMS
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
 #uncomment if there are problems with memory detection
 #CPPFLAGS+= -DCONSERVATIVE_MEMDETECT

Index: src/sys/arch/i386/stand/pxeboot/Makefile
diff -u src/sys/arch/i386/stand/pxeboot/Makefile:1.23 src/sys/arch/i386/stand/pxeboot/Makefile:1.24
--- src/sys/arch/i386/stand/pxeboot/Makefile:1.23	Sat Jan 23 16:22:47 2016
+++ src/sys/arch/i386/stand/pxeboot/Makefile	Sat Jan 23 17:29:29 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2016/01/23 21:22:47 christos Exp $
+#	$NetBSD: Makefile,v 1.24 2016/01/23 22:29:29 christos Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -40,7 +40,7 @@ CPPFLAGS+= -DSUPPORT_SERIAL=boot_params.
 CPPFLAGS+= -DCONSPEED=boot_params.bp_conspeed
 CPPFLAGS+= -DCONSADDR=boot_params.bp_consaddr
 CPPFLAGS+= -DCONSOLE_KEYMAP=boot_params.bp_keymap
-CPPFLAGS+= -DDIRECT_SERIAL -D_KERNTYPES
+CPPFLAGS+= -DDIRECT_SERIAL
 # Various serial line configurations
 #CPPFLAGS+= -DSUPPORT_SERIAL=CONSDEV_PC -DDIRECT_SERIAL
 #	or



CVS commit: src/sys/arch/i386/stand/lib/netif

2016-01-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 17 14:57:18 UTC 2016

Modified Files:
src/sys/arch/i386/stand/lib/netif: 3c90xb.c etherdrv.h

Log Message:
PR/50668: David Binderman: Don't compare unsigned to -1


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/lib/netif/3c90xb.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/lib/netif/etherdrv.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/lib/netif/3c90xb.c
diff -u src/sys/arch/i386/stand/lib/netif/3c90xb.c:1.14 src/sys/arch/i386/stand/lib/netif/3c90xb.c:1.15
--- src/sys/arch/i386/stand/lib/netif/3c90xb.c:1.14	Sun Dec 14 13:46:33 2008
+++ src/sys/arch/i386/stand/lib/netif/3c90xb.c	Sun Jan 17 09:57:18 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: 3c90xb.c,v 1.14 2008/12/14 18:46:33 christos Exp $ */
+/* $NetBSD: 3c90xb.c,v 1.15 2016/01/17 14:57:18 christos Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -291,7 +291,7 @@ ex_probemedia(void)
 	}
 	printf("unknown connector\n");
 bad:
-	ether_medium = -1;
+	ether_medium = ETHERMEDIUM_BAD;
 }
 
 int
@@ -346,7 +346,7 @@ found:
 		ether_medium = ETHERMEDIUM_MII;
 	else {
 		ex_probemedia();
-		if (ether_medium < 0)
+		if (ether_medium == ETHERMEDIUM_BAD)
 			return 0;
 	}
 

Index: src/sys/arch/i386/stand/lib/netif/etherdrv.h
diff -u src/sys/arch/i386/stand/lib/netif/etherdrv.h:1.9 src/sys/arch/i386/stand/lib/netif/etherdrv.h:1.10
--- src/sys/arch/i386/stand/lib/netif/etherdrv.h:1.9	Sun Dec 14 13:46:33 2008
+++ src/sys/arch/i386/stand/lib/netif/etherdrv.h	Sun Jan 17 09:57:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: etherdrv.h,v 1.9 2008/12/14 18:46:33 christos Exp $	*/
+/*	$NetBSD: etherdrv.h,v 1.10 2016/01/17 14:57:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1996
@@ -32,6 +32,7 @@ int EtherReceive(char *, int);
 void EtherStop(void);
 
 extern unsigned ether_medium;
+#define ETHERMEDIUM_BAD ((unsigned)-1)
 #define ETHERMEDIUM_BNC 0
 #define ETHERMEDIUM_UTP 1
 #define ETHERMEDIUM_AUI 2



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

2016-01-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  4 18:17:31 UTC 2016

Modified Files:
src/sys/arch/i386/stand/bootxx: pbr.S

Log Message:
revert, this has to do with the bootloader protocol version and should
stay the same until there is a reason for it to change.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/bootxx/pbr.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/bootxx/pbr.S
diff -u src/sys/arch/i386/stand/bootxx/pbr.S:1.21 src/sys/arch/i386/stand/bootxx/pbr.S:1.22
--- src/sys/arch/i386/stand/bootxx/pbr.S:1.21	Sun Jan  3 15:59:47 2016
+++ src/sys/arch/i386/stand/bootxx/pbr.S	Mon Jan  4 13:17:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pbr.S,v 1.21 2016/01/03 20:59:47 christos Exp $	*/
+/*	$NetBSD: pbr.S,v 1.22 2016/01/04 18:17:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@ ENTRY(start)
 	 */
 	jmp	start0
 	nop
-	.ascii	"NetBSD70"		/* oemname (8 bytes) */
+	.ascii	"NetBSD60"		/* oemname (8 bytes) */
 
 	. = start + MBR_BPB_OFFSET	/* move to start of BPB */
 	/* (ensures oemname doesn't overflow) */



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

2016-01-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  3 20:59:47 UTC 2016

Modified Files:
src/sys/arch/i386/stand/bootxx: pbr.S

Log Message:
change 60 to 70 which is the current release. Noticed by Rares Aioanei.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/bootxx/pbr.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/bootxx/pbr.S
diff -u src/sys/arch/i386/stand/bootxx/pbr.S:1.20 src/sys/arch/i386/stand/bootxx/pbr.S:1.21
--- src/sys/arch/i386/stand/bootxx/pbr.S:1.20	Tue Aug 16 20:07:38 2011
+++ src/sys/arch/i386/stand/bootxx/pbr.S	Sun Jan  3 15:59:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pbr.S,v 1.20 2011/08/17 00:07:38 jakllsch Exp $	*/
+/*	$NetBSD: pbr.S,v 1.21 2016/01/03 20:59:47 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@ ENTRY(start)
 	 */
 	jmp	start0
 	nop
-	.ascii	"NetBSD60"		/* oemname (8 bytes) */
+	.ascii	"NetBSD70"		/* oemname (8 bytes) */
 
 	. = start + MBR_BPB_OFFSET	/* move to start of BPB */
 	/* (ensures oemname doesn't overflow) */



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

2015-12-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 13 19:51:53 UTC 2015

Modified Files:
src/sys/arch/i386/stand/lib: dosfile.c

Log Message:
better than returning random errors.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/stand/lib/dosfile.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/lib/dosfile.c
diff -u src/sys/arch/i386/stand/lib/dosfile.c:1.17 src/sys/arch/i386/stand/lib/dosfile.c:1.18
--- src/sys/arch/i386/stand/lib/dosfile.c:1.17	Fri Dec 11 03:04:20 2015
+++ src/sys/arch/i386/stand/lib/dosfile.c	Sun Dec 13 14:51:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dosfile.c,v 1.17 2015/12/11 08:04:20 mlelstv Exp $	 */
+/*	$NetBSD: dosfile.c,v 1.18 2015/12/13 19:51:53 christos Exp $	 */
 
 /*
  * Copyright (c) 1996
@@ -70,6 +70,7 @@ dos2errno(void)
 		err = EPERM;
 		break;
 	case 6: /* invalid handle */
+	default:
 		err = EINVAL;
 		break;
 	}



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

2015-12-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 13 21:03:31 UTC 2015

Modified Files:
src/sys/arch/i386/stand/lib: dosfile.c

Log Message:
one default is better than two


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/lib/dosfile.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/lib/dosfile.c
diff -u src/sys/arch/i386/stand/lib/dosfile.c:1.18 src/sys/arch/i386/stand/lib/dosfile.c:1.19
--- src/sys/arch/i386/stand/lib/dosfile.c:1.18	Sun Dec 13 14:51:53 2015
+++ src/sys/arch/i386/stand/lib/dosfile.c	Sun Dec 13 16:03:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dosfile.c,v 1.18 2015/12/13 19:51:53 christos Exp $	 */
+/*	$NetBSD: dosfile.c,v 1.19 2015/12/13 21:03:31 christos Exp $	 */
 
 /*
  * Copyright (c) 1996
@@ -70,7 +70,6 @@ dos2errno(void)
 		err = EPERM;
 		break;
 	case 6: /* invalid handle */
-	default:
 		err = EINVAL;
 		break;
 	}



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

2015-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Dec 11 08:04:20 UTC 2015

Modified Files:
src/sys/arch/i386/stand/lib: dosfile.c

Log Message:
PR 50516 bad switch statement.
Adding some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/stand/lib/dosfile.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/lib/dosfile.c
diff -u src/sys/arch/i386/stand/lib/dosfile.c:1.16 src/sys/arch/i386/stand/lib/dosfile.c:1.17
--- src/sys/arch/i386/stand/lib/dosfile.c:1.16	Sun Oct 20 21:06:37 2013
+++ src/sys/arch/i386/stand/lib/dosfile.c	Fri Dec 11 08:04:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dosfile.c,v 1.16 2013/10/20 21:06:37 christos Exp $	 */
+/*	$NetBSD: dosfile.c,v 1.17 2015/12/11 08:04:20 mlelstv Exp $	 */
 
 /*
  * Copyright (c) 1996
@@ -56,18 +56,22 @@ dos2errno(void)
 	int err;
 
 	switch (doserrno) {
-	case 1:
-	case 4:
-	case 12:
+	case 1: /* invalid function number */
+	case 4: /* too many open files */
+	case 12: /* invalid access mode */
 	default:
 		err = EIO;
-	case 2:
-	case 3:
+		break;
+	case 2: /* file not found */
+	case 3: /* path not found */
 		err = ENOENT;
-	case 5:
+		break;
+	case 5: /* access denied */
 		err = EPERM;
-	case 6:
+		break;
+	case 6: /* invalid handle */
 		err = EINVAL;
+		break;
 	}
 	return err;
 }



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

2015-08-20 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Aug 20 11:39:28 UTC 2015

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

Log Message:
${PROG} depends on ${LDSCRIPT}.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/i386/stand/boot/Makefile.boot

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/boot/Makefile.boot
diff -u src/sys/arch/i386/stand/boot/Makefile.boot:1.66 src/sys/arch/i386/stand/boot/Makefile.boot:1.67
--- src/sys/arch/i386/stand/boot/Makefile.boot:1.66	Mon Apr 14 15:05:19 2014
+++ src/sys/arch/i386/stand/boot/Makefile.boot	Thu Aug 20 11:39:28 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.boot,v 1.66 2014/04/14 15:05:19 uebayasi Exp $
+# $NetBSD: Makefile.boot,v 1.67 2015/08/20 11:39:28 uebayasi Exp $
 
 S=	${.CURDIR}/../../../../..
 
@@ -132,7 +132,7 @@ vers.c: ${VERSIONFILE} ${SOURCES} ${LIBL
 # Anything that calls 'real_to_prot' must have a %pc  0x1.
 # We link the program, find the callers (all in libi386), then
 # explicitly pull in the required objects before any other library code.
-${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
+${PROG}: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.boot
 	${_MKTARGET_LINK}
 	bb=$$( ${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,-Ttext,0 -Wl,-cref \
 	${OBJS} ${LIBLIST} | ( \



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

2015-08-20 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Aug 20 11:38:27 UTC 2015

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

Log Message:
${PROG} depends on ${LDSCRIPT}.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/i386/stand/bootxx/Makefile.bootxx

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/bootxx/Makefile.bootxx
diff -u src/sys/arch/i386/stand/bootxx/Makefile.bootxx:1.48 src/sys/arch/i386/stand/bootxx/Makefile.bootxx:1.49
--- src/sys/arch/i386/stand/bootxx/Makefile.bootxx:1.48	Wed Jan 15 22:25:22 2014
+++ src/sys/arch/i386/stand/bootxx/Makefile.bootxx	Thu Aug 20 11:38:27 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.bootxx,v 1.48 2014/01/15 22:25:22 joerg Exp $
+# $NetBSD: Makefile.bootxx,v 1.49 2015/08/20 11:38:27 uebayasi Exp $
 
 S=	${.CURDIR}/../../../../..
 
@@ -120,7 +120,7 @@ LIBLIST= ${LIBI386} ${LIBSA} ${LIBKERN} 
 
 CLEANFILES+= ${PROG}.sym ${PROG}.map
 
-${PROG}: ${OBJS} ${LIBLIST}
+${PROG}: ${OBJS} ${LIBLIST} ${LDSCRIPT}
 	${_MKTARGET_LINK}
 	${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,-Ttext,${PRIMARY_LOAD_ADDRESS} \
 		-T ${LDSCRIPT} -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST}



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

2015-06-11 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Jun 11 15:56:53 UTC 2015

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Also document the splash command in boot(8)


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.64 src/sys/arch/i386/stand/boot/boot2.c:1.65
--- src/sys/arch/i386/stand/boot/boot2.c:1.64	Fri Jan 16 03:45:53 2015
+++ src/sys/arch/i386/stand/boot/boot2.c	Thu Jun 11 15:56:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.64 2015/01/16 03:45:53 christos Exp $	*/
+/*	$NetBSD: boot2.c,v 1.65 2015/06/11 15:56:53 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -413,6 +413,7 @@ command_help(char *arg)
 	   modules {on|off|enabled|disabled}\n
 	   load {path_to_module}\n
 	   multiboot [xdNx:][filename] [args]\n
+	   splash {path_to_image_file}\n
 	   userconf {command}\n
 	   rndseed {path_to_rndseed_file}\n
 	   help|?\n



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

2015-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Apr 16 08:38:36 UTC 2015

Modified Files:
src/sys/arch/i386/stand/lib: Makefile

Log Message:
remove HAVE_GCC=45 fragment.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/i386/stand/lib/Makefile

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/lib/Makefile
diff -u src/sys/arch/i386/stand/lib/Makefile:1.40 src/sys/arch/i386/stand/lib/Makefile:1.41
--- src/sys/arch/i386/stand/lib/Makefile:1.40	Tue Apr  8 15:34:18 2014
+++ src/sys/arch/i386/stand/lib/Makefile	Thu Apr 16 08:38:36 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.40 2014/04/08 15:34:18 christos Exp $
+#	$NetBSD: Makefile,v 1.41 2015/04/16 08:38:36 mrg Exp $
 
 S?=	${.CURDIR}/../../../..
 
@@ -54,9 +54,6 @@ lib${LIB}.o:: ${OBJS}
 	@${LD} -r -o lib${LIB}.o `lorder ${OBJS} | tsort`
 
 # XXX
-.if ${HAVE_GCC:U} == 45
-COPTS.biosdisk.c+=	-fno-strict-aliasing
-.endif
 .if ${ACTIVE_CC} == gcc  ${HAVE_GCC:U} == 48
 COPTS.biosdisk_ll.c+=	-O0
 .endif



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

2015-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 19:47:17 UTC 2015

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

Log Message:
Compile the booblocks for i386 CPUs, even when the main target architecture
is amd64.
Fixes PR port-i386/49725.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/i386/stand/Makefile.booters

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/Makefile.booters
diff -u src/sys/arch/i386/stand/Makefile.booters:1.89 src/sys/arch/i386/stand/Makefile.booters:1.90
--- src/sys/arch/i386/stand/Makefile.booters:1.89	Sun Jan 12 15:26:29 2014
+++ src/sys/arch/i386/stand/Makefile.booters	Sun Mar  8 19:47:17 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.booters,v 1.89 2014/01/12 15:26:29 tsutsui Exp $
+#	$NetBSD: Makefile.booters,v 1.90 2015/03/08 19:47:17 martin Exp $
 
 .include bsd.own.mk
 
@@ -14,7 +14,7 @@ LIBC=		# nothing
 # Make sure we override any optimization options specified by the
 # user.
 .if ${MACHINE_ARCH} == x86_64
-CPUFLAGS= -m32
+CPUFLAGS= -m32 -march=i386 -mtune=i386
 .else
 CPUFLAGS=  -march=i386 -mtune=i386
 .endif



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

2015-01-18 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan 18 20:18:07 UTC 2015

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
While the old gpt.S mbr code looks at both primary and alternate GPT
partition tables, mbrgpt.S and DKWEDGE_METHOD_GPT only look in the
primary.  Align the bootxx/boot2 biosdisk code with this so as to avoid
situations where the disk becomes unbootable when it has an undestroyed
secondary GPT.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/stand/lib/biosdisk.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/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.43 src/sys/arch/i386/stand/lib/biosdisk.c:1.44
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.43	Thu Oct 31 20:31:04 2013
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Sun Jan 18 20:18:07 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.43 2013/10/31 20:31:04 christos Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.44 2015/01/18 20:18:07 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -330,9 +330,6 @@ read_gpt(struct biosdisk *d)
 		gptsector[1] = d-ll.chs_sectors - 1;
 	}
 
-	/*
-	 * Use any valid GPT available, do not require both GPTs to be valid
-	 */
 	for (i = 0; i  __arraycount(gptsector); i++) {
 		error = check_gpt(d, gptsector[i]);
 		if (error == 0)
@@ -344,6 +341,15 @@ read_gpt(struct biosdisk *d)
 		return -1;
 	}
 
+#ifndef USE_SECONDARY_GPT
+	if (i  0) {
+#ifdef DISK_DEBUG
+		printf(ignoring valid secondary GPT\n);
+#endif
+		return -1;
+	}
+#endif
+
 #ifdef DISK_DEBUG
 	printf(using %s GPT\n, (i == 0) ? primary : secondary);
 #endif



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

2015-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 16 03:45:53 UTC 2015

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Restore previous behavior: boot -s == boot netbsd -s
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.63 src/sys/arch/i386/stand/boot/boot2.c:1.64
--- src/sys/arch/i386/stand/boot/boot2.c:1.63	Sat Jun 28 05:16:18 2014
+++ src/sys/arch/i386/stand/boot/boot2.c	Thu Jan 15 22:45:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.63 2014/06/28 09:16:18 rtr Exp $	*/
+/*	$NetBSD: boot2.c,v 1.64 2015/01/16 03:45:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@ static int default_unit, default_partiti
 static const char *default_filename;
 
 char *sprint_bootsel(const char *);
-void bootit(const char *, int, int);
+static void bootit(const char *, int);
 void print_banner(void);
 void boot2(int, uint64_t);
 
@@ -244,16 +244,12 @@ clearit(void)
 		clear_pc_screen();
 }
 
-void
-bootit(const char *filename, int howto, int tell)
+static void
+bootit(const char *filename, int howto)
 {
-
-	if (tell) {
-		printf(booting %s, sprint_bootsel(filename));
-		if (howto)
-			printf( (howto 0x%x), howto);
-		printf(\n);
-	}
+	if (howto  AB_VERBOSE)
+		printf(booting %s (howto 0x%x)\n, sprint_bootsel(filename),
+		howto);
 
 	if (exec_netbsd(filename, 0, howto, boot_biosdev  0x80, clearit)  0)
 		printf(boot: %s: %s\n, sprint_bootsel(filename),
@@ -389,9 +385,9 @@ boot2(int biosdev, uint64_t biossector)
 		 * try pairs of names[] entries, foo and foo.gz
 		 */
 		/* don't print booting... again */
-		bootit(names[currname][0], 0, 0);
+		bootit(names[currname][0], 0);
 		/* since it failed, try compressed bootfile. */
-		bootit(names[currname][1], 0, 1);
+		bootit(names[currname][1], AB_VERBOSE);
 	}
 
 	bootmenu();	/* does not return */
@@ -451,23 +447,23 @@ void
 command_boot(char *arg)
 {
 	char *filename;
-	int howto, tell;
+	int howto;
 
 	if (!parseboot(arg, filename, howto))
 		return;
 
-	tell = ((howto  AB_VERBOSE) != 0);
 	if (filename != NULL) {
-		bootit(filename, howto, tell);
+		bootit(filename, howto);
 	} else {
 		int i;
 
 #ifndef SMALL
-		bootdefault();
+		if (howto == 0)
+			bootdefault();
 #endif
 		for (i = 0; i  NUMNAMES; i++) {
-			bootit(names[i][0], howto, tell);
-			bootit(names[i][1], howto, tell);
+			bootit(names[i][0], howto);
+			bootit(names[i][1], howto);
 		}
 	}
 }



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

2014-07-19 Thread Eric Haszlakiewicz
Module Name:src
Committed By:   erh
Date:   Sat Jul 19 14:50:21 UTC 2014

Modified Files:
src/sys/arch/i386/stand/lib: bios_disk.S

Log Message:
Fix bootxx_* and boot on machines where the bios sets high bits of %eax on 
success.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/lib/bios_disk.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/lib/bios_disk.S
diff -u src/sys/arch/i386/stand/lib/bios_disk.S:1.21 src/sys/arch/i386/stand/lib/bios_disk.S:1.22
--- src/sys/arch/i386/stand/lib/bios_disk.S:1.21	Thu Jun 16 13:27:59 2011
+++ src/sys/arch/i386/stand/lib/bios_disk.S	Sat Jul 19 14:50:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bios_disk.S,v 1.21 2011/06/16 13:27:59 joerg Exp $	*/
+/*	$NetBSD: bios_disk.S,v 1.22 2014/07/19 14:50:21 erh Exp $	*/
 
 /*
  * Ported to boot 386BSD by Julian Elischer (jul...@tfs.com) Sept 1992
@@ -133,6 +133,9 @@ ENTRY(biosdisk_read)
 	calll	_C_LABEL(real_to_prot) # back to protected mode
 	.code32
 
+	andl$0x, %eax  # Some bioses set high bits in %eax
+	   #  on success, interfering with our
+	   #  return value.  Clear those out.
 	movl	%eax, 28(%esp)
 
 	popa



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

2014-05-01 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Thu May  1 18:37:26 UTC 2014

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

Log Message:
Add -fno-asynchronous-unwind-tables -fno-exceptions to gcc builds.
One of these (probably the first) is needed to stop the eh-frame
section being created.
The eh_frame section is loadable and bloats the boot images.
This might be enough to make pxeboot work.


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

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/Makefile.inc
diff -u src/sys/arch/i386/stand/Makefile.inc:1.11 src/sys/arch/i386/stand/Makefile.inc:1.12
--- src/sys/arch/i386/stand/Makefile.inc:1.11	Mon Jul  1 12:48:03 2013
+++ src/sys/arch/i386/stand/Makefile.inc	Thu May  1 18:37:26 2014
@@ -1,10 +1,11 @@
-#	$NetBSD: Makefile.inc,v 1.11 2013/07/01 12:48:03 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.12 2014/05/01 18:37:26 dsl Exp $
 
 .include bsd.own.mk
 
 BINDIR=	/usr/mdec
 
-OPT_SIZE.gcc=	-Os -ffreestanding -fomit-frame-pointer -fno-unwind-tables
+OPT_SIZE.gcc=	-Os -ffreestanding -fomit-frame-pointer -fno-unwind-tables \
+		-fno-asynchronous-unwind-tables -fno-exceptions
 OPT_SIZE.clang=	-Oz -ffreestanding -fomit-frame-pointer -DNDEBUG \
 		-fno-stack-protector -mno-sse \
 		-mstack-alignment=4 \



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

2014-04-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Apr  8 13:56:04 UTC 2014

Modified Files:
src/sys/arch/i386/stand/lib: Makefile

Log Message:
Unbreak clang build by restricting -O0 hack to gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/stand/lib/Makefile

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/lib/Makefile
diff -u src/sys/arch/i386/stand/lib/Makefile:1.38 src/sys/arch/i386/stand/lib/Makefile:1.39
--- src/sys/arch/i386/stand/lib/Makefile:1.38	Mon Apr  7 21:09:55 2014
+++ src/sys/arch/i386/stand/lib/Makefile	Tue Apr  8 13:56:04 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2014/04/07 21:09:55 christos Exp $
+#	$NetBSD: Makefile,v 1.39 2014/04/08 13:56:04 joerg Exp $
 
 S?=	${.CURDIR}/../../../..
 
@@ -58,5 +58,5 @@ lib${LIB}.o:: ${OBJS}
 COPTS.biosdisk.c+=	-fno-strict-aliasing
 .endif
 .if ${HAVE_GCC:U} == 48
-COPTS.biosdisk_ll.c+=	-O0
+COPTS.biosdisk_ll.c+=	${${ACTIVE_CC} == gcc:?-O0:}
 .endif



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

2014-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  8 15:34:18 UTC 2014

Modified Files:
src/sys/arch/i386/stand/lib: Makefile

Log Message:
make this more attractive (to me).


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/stand/lib/Makefile

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/lib/Makefile
diff -u src/sys/arch/i386/stand/lib/Makefile:1.39 src/sys/arch/i386/stand/lib/Makefile:1.40
--- src/sys/arch/i386/stand/lib/Makefile:1.39	Tue Apr  8 09:56:04 2014
+++ src/sys/arch/i386/stand/lib/Makefile	Tue Apr  8 11:34:18 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.39 2014/04/08 13:56:04 joerg Exp $
+#	$NetBSD: Makefile,v 1.40 2014/04/08 15:34:18 christos Exp $
 
 S?=	${.CURDIR}/../../../..
 
@@ -57,6 +57,6 @@ lib${LIB}.o:: ${OBJS}
 .if ${HAVE_GCC:U} == 45
 COPTS.biosdisk.c+=	-fno-strict-aliasing
 .endif
-.if ${HAVE_GCC:U} == 48
-COPTS.biosdisk_ll.c+=	${${ACTIVE_CC} == gcc:?-O0:}
+.if ${ACTIVE_CC} == gcc  ${HAVE_GCC:U} == 48
+COPTS.biosdisk_ll.c+=	-O0
 .endif



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

2014-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  7 21:09:55 UTC 2014

Modified Files:
src/sys/arch/i386/stand/lib: Makefile

Log Message:
XXX: gcc-4.8 bug. Passes wrong arguments to biosdisk_read(). Turn optimization
off.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/i386/stand/lib/Makefile

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/lib/Makefile
diff -u src/sys/arch/i386/stand/lib/Makefile:1.37 src/sys/arch/i386/stand/lib/Makefile:1.38
--- src/sys/arch/i386/stand/lib/Makefile:1.37	Fri Feb 14 15:34:27 2014
+++ src/sys/arch/i386/stand/lib/Makefile	Mon Apr  7 17:09:55 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.37 2014/02/14 20:34:27 joerg Exp $
+#	$NetBSD: Makefile,v 1.38 2014/04/07 21:09:55 christos Exp $
 
 S?=	${.CURDIR}/../../../..
 
@@ -57,3 +57,6 @@ lib${LIB}.o:: ${OBJS}
 .if ${HAVE_GCC:U} == 45
 COPTS.biosdisk.c+=	-fno-strict-aliasing
 .endif
+.if ${HAVE_GCC:U} == 48
+COPTS.biosdisk_ll.c+=	-O0
+.endif



  1   2   3   >