CVS commit: src/sys/arch/sparc/stand/ofwboot

2020-04-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr 20 02:04:44 UTC 2020

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
More -Wno-error=address-of-packed-member to placate clang.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.38 src/sys/arch/sparc/stand/ofwboot/Makefile:1.39
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.38	Sat Apr  8 19:53:23 2017
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Mon Apr 20 02:04:44 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2017/04/08 19:53:23 christos Exp $
+#	$NetBSD: Makefile,v 1.39 2020/04/20 02:04:44 riastradh Exp $
 
 .include 
 
@@ -38,6 +38,11 @@ CPPFLAGS+=	-DSUPPORT_DHCP
 #CPPFLAGS+=	-DNETIF_DEBUG 
 #CPPFLAGS+=	-D_DEBUG
 
+# 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
+
 LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
 
 NOMAN=		# defined



CVS commit: src/sys/arch/sparc/stand/ofwboot

2017-03-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 25 09:22:02 UTC 2017

Modified Files:
src/sys/arch/sparc/stand/ofwboot: version

Log Message:
Bump version - virtio support added


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/version
diff -u src/sys/arch/sparc/stand/ofwboot/version:1.21 src/sys/arch/sparc/stand/ofwboot/version:1.22
--- src/sys/arch/sparc/stand/ofwboot/version:1.21	Sun Jun 14 18:40:10 2015
+++ src/sys/arch/sparc/stand/ofwboot/version	Sat Mar 25 09:22:02 2017
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.21 2015/06/14 18:40:10 martin Exp $
+$NetBSD: version,v 1.22 2017/03/25 09:22:02 martin 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
@@ -22,3 +22,4 @@ is taken as the current.
 1.16:	Add support to boot with root on cd9660
 1.17:	Add support for sun4v architecture
 1.18:	Fix loading of kernels with huge .bss
+1.19:	Support booting from virtio devices



CVS commit: src/sys/arch/sparc/stand/ofwboot

2016-11-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  4 20:04:12 UTC 2016

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c

Log Message:
fix remaining *_TSB_DATA() uses


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.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/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.15 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.16
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.15	Mon Aug 15 08:29:34 2016
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Fri Nov  4 20:04:11 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.15 2016/08/15 08:29:34 maxv Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.16 2016/11/04 20:04:11 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -353,7 +353,8 @@ mmu_mapin_sun4u(vaddr_t rva, vsize_t len
 	1,		/* cache */
 	1,		/* alias */
 	1,		/* valid */
-	0		/* endianness */
+	0,		/* endianness */
+	0		/* wc */
 	);
 			data |= SUN4U_TLB_L | SUN4U_TLB_CV; /* locked, virt.cache */
 
@@ -429,7 +430,8 @@ mmu_mapin_sun4v(vaddr_t rva, vsize_t len
 			1,		/* cache */
 			1,		/* alias */
 			1,		/* valid */
-			0		/* endianness */
+			0,		/* endianness */
+			0		/* wc */
 			);
 		data |= SUN4V_TLB_CV; /* virt.cache */
 		
@@ -646,7 +648,8 @@ sparc64_finalize_tlb_sun4u(u_long data_v
 1,		/* cache */
 1,		/* alias */
 1,		/* valid */
-0		/* endianness */
+0,		/* endianness */
+0		/* wc */
 );
 		data |= SUN4U_TLB_L | SUN4U_TLB_CV; /* locked, virt.cache */
 		if (!writable_text)
@@ -696,7 +699,8 @@ sparc64_finalize_tlb_sun4v(u_long data_v
 			1,		/* cache */
 			1,		/* alias */
 			1,		/* valid */
-			0		/* endianness */
+			0,		/* endianness */
+			0		/* wc */
 			);
 		data |= SUN4V_TLB_CV|SUN4V_TLB_X; /* virt.cache, executable */
 		if (!writable_text) {



CVS commit: src/sys/arch/sparc/stand/ofwboot

2016-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 31 16:24:34 UTC 2016

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.c

Log Message:
Init the markers array to all 0 - pointed out by Mark Cave-Ayland.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.33 src/sys/arch/sparc/stand/ofwboot/boot.c:1.34
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.33	Sat Jun 11 06:43:47 2016
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Wed Aug 31 16:24:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.33 2016/06/11 06:43:47 dholland Exp $	*/
+/*	$NetBSD: boot.c,v 1.34 2016/08/31 16:24:34 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -364,8 +364,9 @@ start_kernel(char *kernel, char *bootlin
 	int boothowto)
 {
 	int fd;
-	u_long marks[MARK_MAX];
+	u_long marks[MARK_MAX] = {0};
 	int flags = LOAD_ALL;
+
 	if (isfloppy)
 		flags &= ~LOAD_BACKWARDS;
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2016-08-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Aug 15 08:29:34 UTC 2016

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c

Log Message:
Uninitialized var, found by brainy; not tested, but obvious enough


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.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/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.14 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.15
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.14	Sun Jun 14 16:20:44 2015
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Mon Aug 15 08:29:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.14 2015/06/14 16:20:44 martin Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.15 2016/08/15 08:29:34 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -216,6 +216,7 @@ tlb_init_sun4u(void)
 	phandle_t child;
 	phandle_t root;
 	char buf[128];
+	bool foundcpu = false;
 	u_int bootcpu;
 	u_int cpu;
 
@@ -236,10 +237,13 @@ tlb_init_sun4u(void)
 			sizeof(cpu)) == -1 && _prom_getprop(child, "portid",
 			&cpu, sizeof(cpu)) == -1)
 panic("tlb_init: prom_getprop");
+			foundcpu = true;
 			if (cpu == bootcpu)
 break;
 		}
 	}
+	if (!foundcpu)
+		panic("tlb_init: no cpu found!");
 	if (cpu != bootcpu)
 		panic("tlb_init: no node for bootcpu?!?!");
 	if (_prom_getprop(child, "#dtlb-entries", &dtlb_slot_max,



CVS commit: src/sys/arch/sparc/stand/ofwboot

2016-06-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun 11 06:43:47 UTC 2016

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.c

Log Message:
PR 51200 gets in libsa considered harmful: use kgets


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.32 src/sys/arch/sparc/stand/ofwboot/boot.c:1.33
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.32	Mon May 30 10:37:14 2016
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Sat Jun 11 06:43:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.32 2016/05/30 10:37:14 martin Exp $	*/
+/*	$NetBSD: boot.c,v 1.33 2016/06/11 06:43:47 dholland Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -463,7 +463,7 @@ main(void *ofw)
 			char cmdline[PROM_MAX_PATH];
 
 			printf("Boot: ");
-			gets(cmdline);
+			kgets(cmdline, sizeof(cmdline));
 
 			if (!strcmp(cmdline,"exit") ||
 			!strcmp(cmdline,"halt")) {



CVS commit: src/sys/arch/sparc/stand/ofwboot

2016-05-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 30 10:37:14 UTC 2016

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.c

Log Message:
David Binderman in PR port-sparc/51188: simplify while condition


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.31 src/sys/arch/sparc/stand/ofwboot/boot.c:1.32
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.31	Sat Jun 28 09:16:18 2014
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Mon May 30 10:37:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.31 2014/06/28 09:16:18 rtr Exp $	*/
+/*	$NetBSD: boot.c,v 1.32 2016/05/30 10:37:14 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -141,7 +141,7 @@ bootoptions(const char *ap, char *loadde
 		}
 		end1 = ap;
 
-		while (*ap != '\0' && *ap == ' ') {
+		while (*ap == ' ') {
 			ap++;
 		}
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2015-10-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Oct 26 07:11:33 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
force -mcpu=v9 for ofwboot, which demands v9 cpus.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.35 src/sys/arch/sparc/stand/ofwboot/Makefile:1.36
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.35	Sat Oct 10 06:49:40 2015
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Mon Oct 26 07:11:33 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2015/10/10 06:49:40 martin Exp $
+#	$NetBSD: Makefile,v 1.36 2015/10/26 07:11:33 mrg Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
@@ -26,7 +26,7 @@ LIBC=
 LIBCRTBEGIN=
 LIBCRTEND=
 
-COPTS+=		-ffreestanding
+COPTS+=		-ffreestanding -mcpu=v9
 CWARNFLAGS+=	-Wno-main
 CFLAGS+=	${COPTS}
 CPPFLAGS+=	-D_STANDALONE



CVS commit: src/sys/arch/sparc/stand/ofwboot

2015-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 10 06:50:25 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Locore.c

Log Message:
Add compile time asserts to make sure we have properly picked up types
for a 64bit cpu and 64bit openfirmware.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/stand/ofwboot/Locore.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/sparc/stand/ofwboot/Locore.c
diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.14 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.15
--- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.14	Fri Mar 27 06:07:33 2015
+++ src/sys/arch/sparc/stand/ofwboot/Locore.c	Sat Oct 10 06:50:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.14 2015/03/27 06:07:33 nakayama Exp $	*/
+/*	$NetBSD: Locore.c,v 1.15 2015/10/10 06:50:25 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -36,6 +36,15 @@
 
 #include 
 
+/*
+ * We are trying to boot a sparc v9 cpu, so openfirmware has to be 64bit,
+ * and the kernel we load will be dealing with 64bits too (even if it is
+ * a 32bit kernel.
+ * Make sure we picked up the right defines:
+ */
+__CTASSERT(sizeof(cell_t)==8);
+__CTASSERT(sizeof(paddr_t)==8);
+
 extern int openfirmware(void *);
 
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2015-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 10 06:49:40 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
Simplify, get rid of manual _LP64 define.
Do not pass a SUN4U define, as that is no longer used in the relevant headers.
Instead tell the compiler we are compiling for a v9 CPU (so it internally
defines everything we need).


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.34 src/sys/arch/sparc/stand/ofwboot/Makefile:1.35
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.34	Fri Oct  2 20:36:54 2015
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Sat Oct 10 06:49:40 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2015/10/02 20:36:54 joerg Exp $
+#	$NetBSD: Makefile,v 1.35 2015/10/10 06:49:40 martin Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
@@ -15,6 +15,7 @@ SRCS=		srt0.s Locore.c boot.c ofdev.c al
 SRCS+=		bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c
 .if ${MACHINE_ARCH} == "sparc64"
 SRCS+=		hvcall.S
+CPPFLAGS+=	-DSUN4V
 .endif
 .PATH:		${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common
 
@@ -27,11 +28,8 @@ LIBCRTEND=
 
 COPTS+=		-ffreestanding
 CWARNFLAGS+=	-Wno-main
-CFLAGS+=	${COPTS} ${CEXTRAFLAGS}
-CPPFLAGS+=	-D_STANDALONE -DSUN4U
-.if ${MACHINE_ARCH} == "sparc64"
-CPPFLAGS+=	-DSUN4V
-.endif
+CFLAGS+=	${COPTS}
+CPPFLAGS+=	-D_STANDALONE
 CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT
 CPPFLAGS+=	-DNETBOOT
 CPPFLAGS+=	-DSUPPORT_DHCP
@@ -109,19 +107,9 @@ ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBK
 
 .include 
 
-.if ${MACHINE_ARCH} == "sparc64"
+CPUFLAGS+=		-mcpu=v9
 AFLAGS+=		-Wa,-Av9a
-CEXTRAFLAGS?=		-D_LP64
-.else
-AFLAGS+=		-Wa,-Av8plusa
-.endif
-
-.if CROSS
 AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__
-CEXTRAFLAGS?=		-D_LP64
-.else
-AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
-.endif
 
 NORMAL_S=	${CC} ${AFLAGS} ${AFLAGS.${<:T}}  ${CPPFLAGS} -c $<
 srt0.o: srt0.s



CVS commit: src/sys/arch/sparc/stand/ofwboot

2015-10-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Oct  2 20:36:54 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
Support per-target AFLAGS.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.33 src/sys/arch/sparc/stand/ofwboot/Makefile:1.34
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.33	Sun Jan 11 22:59:25 2015
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Fri Oct  2 20:36:54 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2015/01/11 22:59:25 martin Exp $
+#	$NetBSD: Makefile,v 1.34 2015/10/02 20:36:54 joerg Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
@@ -123,7 +123,7 @@ CEXTRAFLAGS?=		-D_LP64
 AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
 .endif
 
-NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
+NORMAL_S=	${CC} ${AFLAGS} ${AFLAGS.${<:T}}  ${CPPFLAGS} -c $<
 srt0.o: srt0.s
 	${NORMAL_S}
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2015-06-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun 14 18:40:10 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot: version

Log Message:
Bump version now that we can load kernels with sizeof(.data)+sizeof(.bss)> 4 MB


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/version
diff -u src/sys/arch/sparc/stand/ofwboot/version:1.20 src/sys/arch/sparc/stand/ofwboot/version:1.21
--- src/sys/arch/sparc/stand/ofwboot/version:1.20	Sun Dec  8 14:41:28 2013
+++ src/sys/arch/sparc/stand/ofwboot/version	Sun Jun 14 18:40:10 2015
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.20 2013/12/08 14:41:28 palle Exp $
+$NetBSD: version,v 1.21 2015/06/14 18:40:10 martin 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
@@ -21,3 +21,4 @@ is taken as the current.
 1.15:	Properly close the firmware handle before starting the kernel
 1.16:	Add support to boot with root on cd9660
 1.17:	Add support for sun4v architecture
+1.18:	Fix loading of kernels with huge .bss



CVS commit: src/sys/arch/sparc/stand/ofwboot

2015-06-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun 14 16:20:44 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c

Log Message:
Fix available length calculation in kvamap_extract when reusing existing
mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.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/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.13 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.14
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.13	Mon Apr 21 18:10:40 2014
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Sun Jun 14 16:20:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.13 2014/04/21 18:10:40 palle Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.14 2015/06/14 16:20:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -136,13 +136,13 @@ kvamap_extract(vaddr_t va, vsize_t len, 
 		if (kvamap[i].start == NULL)
 			break;
 		if ((kvamap[i].start <= va) && (va < kvamap[i].end)) {
-			uint64_t va_len = kvamap[i].end - va + kvamap[i].start;
+			uint64_t va_len = kvamap[i].end - va;
 			len = (va_len < len) ? len - va_len : 0;
 			*new_va = kvamap[i].end;
 		}
 	}
 
-	return (len);
+	return len;
 }
 
 /*



CVS commit: src/sys/arch/sparc/stand/ofwboot

2015-03-26 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Mar 27 06:07:33 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Locore.c

Log Message:
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc/stand/ofwboot/Locore.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/sparc/stand/ofwboot/Locore.c
diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.13 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.14
--- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.13	Wed Dec 18 10:09:56 2013
+++ src/sys/arch/sparc/stand/ofwboot/Locore.c	Fri Mar 27 06:07:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.13 2013/12/18 10:09:56 martin Exp $	*/
+/*	$NetBSD: Locore.c,v 1.14 2015/03/27 06:07:33 nakayama Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -302,8 +302,8 @@ OF_seek(int handle, u_quad_t pos)
 	args.nargs = 3;
 	args.nreturns = 1;
 	args.handle = HDL2CELL(handle);
-	args.poshi = HDL2CELL(pos >> 32);
-	args.poslo = HDL2CELL(pos);
+	args.poshi = HDQ2CELL_HI(pos);
+	args.poslo = HDQ2CELL_LO(pos);
 	if (openfirmware(&args) == -1) {
 		return -1;
 	}



CVS commit: src/sys/arch/sparc/stand/ofwboot

2015-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 11 22:59:25 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
Strip debug symbols from ofwboot.

The forth bootsector loading this file when booting from disk is
"simplistic" and does not skip non loadable sections. The five times
bigger file with debug info overruns some important memory contents
with some firmware versions otherwise.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.32 src/sys/arch/sparc/stand/ofwboot/Makefile:1.33
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.32	Sun Jan 12 15:26:31 2014
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Sun Jan 11 22:59:25 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.32 2014/01/12 15:26:31 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.33 2015/01/11 22:59:25 martin Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
@@ -103,7 +103,7 @@ ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBK
 .else
 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${_MKTARGET_LINK}
-	${LD} -X -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
+	${LD} -X -N -S -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
 	${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
 .endif
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2014-04-21 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Apr 21 18:10:40 UTC 2014

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c

Log Message:
sun4v: Update TTE data in sparc64_finalize_tlb_sun4v() - sun4v has no L 
(locked) bit + ensure that the ITLB has the EP (executable) bit set


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.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/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.12 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.13
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.12	Fri Feb 21 18:00:09 2014
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Mon Apr 21 18:10:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.12 2014/02/21 18:00:09 palle Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.13 2014/04/21 18:10:40 palle Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -694,7 +694,7 @@ sparc64_finalize_tlb_sun4v(u_long data_v
 			1,		/* valid */
 			0		/* endianness */
 			);
-		data |= SUN4V_TLB_L | SUN4V_TLB_CV; /* locked, virt.cache */
+		data |= SUN4V_TLB_CV|SUN4V_TLB_X; /* virt.cache, executable */
 		if (!writable_text) {
 			hv_rc = hv_mmu_unmap_perm_addr(dtlb_store[i].te_va,
 			   MAP_DTLB);



CVS commit: src/sys/arch/sparc/stand/ofwboot

2014-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 20 15:11:36 UTC 2014

Modified Files:
src/sys/arch/sparc/stand/ofwboot: ofdev.c

Log Message:
Zero the block on failure, not just the first pointer in it.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.34 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.35
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.34	Tue Apr 16 07:45:37 2013
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Thu Feb 20 15:11:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.34 2013/04/16 07:45:37 martin Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.35 2014/02/20 15:11:36 joerg Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -353,7 +353,7 @@ search_label(struct of_dev *devp, u_long
 		return (disklabel_sun_to_bsd(buf, lp));
 
 
-	memset(buf, 0, sizeof(buf));
+	memset(buf, 0, DEV_BSIZE);
 	return ("no disk label");
 }
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2014-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 20 14:50:39 UTC 2014

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.h

Log Message:
Add prototype for main.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/stand/ofwboot/boot.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/sparc/stand/ofwboot/boot.h
diff -u src/sys/arch/sparc/stand/ofwboot/boot.h:1.9 src/sys/arch/sparc/stand/ofwboot/boot.h:1.10
--- src/sys/arch/sparc/stand/ofwboot/boot.h:1.9	Wed Jun  1 11:43:12 2011
+++ src/sys/arch/sparc/stand/ofwboot/boot.h	Thu Feb 20 14:50:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.h,v 1.9 2011/06/01 11:43:12 tsutsui Exp $	*/
+/*	$NetBSD: boot.h,v 1.10 2014/02/20 14:50:39 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -69,4 +69,7 @@ void	freeall(void);
 /* ofdev.c */
 char *filename(char *, char *);
 
+/* boot.c */
+void main(void *);
+
 #endif /* _BOOT_H_ */



CVS commit: src/sys/arch/sparc/stand/ofwboot

2013-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 30 08:47:50 UTC 2013

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.c

Log Message:
Improve debugging output


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.29 src/sys/arch/sparc/stand/ofwboot/boot.c:1.30
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.29	Mon May 28 19:24:30 2012
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Mon Dec 30 08:47:50 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.29 2012/05/28 19:24:30 martin Exp $	*/
+/*	$NetBSD: boot.c,v 1.30 2013/12/30 08:47:50 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -478,7 +478,10 @@ check_boot_config(void)
 	if (!root_fs_quickseekable) return;
 	DPRINTF(("checking for /boot.cfg...\n"));
 	fd = open("/boot.cfg", 0);
-	if (fd < 0) return;
+	if (fd < 0) {
+		DPRINTF(("no /boot.cfg found\n"));
+		return;
+	}
 	DPRINTF(("found /boot.cfg\n"));
 	if (fstat(fd, &st) == -1 || st.st_size > 32*1024) {
 		close(fd);



CVS commit: src/sys/arch/sparc/stand/ofwboot

2013-12-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 18 10:09:56 UTC 2013

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Locore.c

Log Message:
The "close" call returns no arguments


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/stand/ofwboot/Locore.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/sparc/stand/ofwboot/Locore.c
diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.12 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.13
--- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.12	Sat May 21 15:50:42 2011
+++ src/sys/arch/sparc/stand/ofwboot/Locore.c	Wed Dec 18 10:09:56 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.12 2011/05/21 15:50:42 tsutsui Exp $	*/
+/*	$NetBSD: Locore.c,v 1.13 2013/12/18 10:09:56 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -231,7 +231,7 @@ OF_close(int handle)
 	
 	args.name = ADR2CELL("close");
 	args.nargs = 1;
-	args.nreturns = 1;
+	args.nreturns = 0;
 	args.handle = HDL2CELL(handle);
 	openfirmware(&args);
 }



CVS commit: src/sys/arch/sparc/stand/ofwboot

2013-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 16 07:45:37 UTC 2013

Modified Files:
src/sys/arch/sparc/stand/ofwboot: ofdev.c

Log Message:
Make a "panic" message slightly more verbose


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.33 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.34
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.33	Mon Jul 16 11:26:27 2012
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Tue Apr 16 07:45:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.33 2012/07/16 11:26:27 tsutsui Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.34 2013/04/16 07:45:37 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -374,7 +374,7 @@ devopen(struct open_file *of, const char
 	int error = 0;
 
 	if (ofdev.handle != -1)
-		panic("devopen");
+		panic("devopen: ofdev already in use");
 	if (of->f_flags != F_READ)
 		return EPERM;
 	DPRINTF(("devopen: you want %s\n", name));



CVS commit: src/sys/arch/sparc/stand/ofwboot

2012-07-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jul 16 11:26:28 UTC 2012

Modified Files:
src/sys/arch/sparc/stand/ofwboot: net.c net.h ofdev.c

Log Message:
Fix tftpboot which was broken by my botched WARNSfy in last year.
Also add comments that mention libsa tftp requires network device socket
in f_devdata in struct open_file, from spz@ in PR port-sparc64/46652.
Briefly tested tftpboot and nfsboot on Ultra5.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/stand/ofwboot/net.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/stand/ofwboot/net.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/net.c
diff -u src/sys/arch/sparc/stand/ofwboot/net.c:1.7 src/sys/arch/sparc/stand/ofwboot/net.c:1.8
--- src/sys/arch/sparc/stand/ofwboot/net.c:1.7	Sat May 21 15:50:42 2011
+++ src/sys/arch/sparc/stand/ofwboot/net.c	Mon Jul 16 11:26:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: net.c,v 1.7 2011/05/21 15:50:42 tsutsui Exp $	*/
+/*	$NetBSD: net.c,v 1.8 2012/07/16 11:26:27 tsutsui Exp $	*/
 
 /*
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -180,14 +180,28 @@ net_mountroot_bootp(void)
 	return (0);
 }
 
+/*
+ * libsa's tftp_open expects a pointer to netdev_sock, i.e. an (int *),
+ * in f_devdata, a pointer to which gets handed down from devopen().
+ *
+ * Do not expect booting via different methods to have the same
+ * requirements or semantics.
+ *
+ * net_tftp_bootp uses net_mountroot_bootp because that incidentially does
+ * most of what it needs to do. It of course in no manner actually mounts
+ * anything, all that routine actually does is prepare the socket for the
+ * necessary net access, and print info for the user.
+ */
+
 int
-net_tftp_bootp(struct of_dev *op)
+net_tftp_bootp(int **sock)
 {
 
 	net_mountroot_bootp();
 	if (myip.s_addr == 0)
 		return(ENOENT);
 
+	*sock = &netdev_sock;
 	return (0);
 }
 

Index: src/sys/arch/sparc/stand/ofwboot/net.h
diff -u src/sys/arch/sparc/stand/ofwboot/net.h:1.2 src/sys/arch/sparc/stand/ofwboot/net.h:1.3
--- src/sys/arch/sparc/stand/ofwboot/net.h:1.2	Sat May 21 15:50:42 2011
+++ src/sys/arch/sparc/stand/ofwboot/net.h	Mon Jul 16 11:26:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: net.h,v 1.2 2011/05/21 15:50:42 tsutsui Exp $ */
+/* $NetBSD: net.h,v 1.3 2012/07/16 11:26:27 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 int	net_open(struct of_dev *);
 int	net_close(struct of_dev *);
-int	net_tftp_bootp(struct of_dev *);
+int	net_tftp_bootp(int **);
 int	net_mountroot(void);
 
 #endif /* _OFWBOOT_NET_H */

Index: src/sys/arch/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.32 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.33
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.32	Wed Jun  1 11:42:18 2011
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Mon Jul 16 11:26:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.32 2011/06/01 11:42:18 tsutsui Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.33 2012/07/16 11:26:27 tsutsui Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -536,7 +536,7 @@ open_again:
 		if (!strncmp(*file,"/tftp:",6)) {
 			*file += 6;
 			memcpy(&file_system[0], &file_system_tftp, sizeof file_system[0]);
-			if (net_tftp_bootp(of->f_devdata)) {
+			if (net_tftp_bootp((int **)&of->f_devdata)) {
 net_close(&ofdev);
 goto bad;
 			}



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-07-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jul 30 04:18:38 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: netif_of.c

Log Message:
printf fixes for ifdef NETIF_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sparc/stand/ofwboot/netif_of.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/sparc/stand/ofwboot/netif_of.c
diff -u src/sys/arch/sparc/stand/ofwboot/netif_of.c:1.8 src/sys/arch/sparc/stand/ofwboot/netif_of.c:1.9
--- src/sys/arch/sparc/stand/ofwboot/netif_of.c:1.8	Sat May 21 15:50:42 2011
+++ src/sys/arch/sparc/stand/ofwboot/netif_of.c	Sat Jul 30 04:18:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netif_of.c,v 1.8 2011/05/21 15:50:42 tsutsui Exp $	*/
+/*	$NetBSD: netif_of.c,v 1.9 2011/07/30 04:18:38 jakllsch Exp $	*/
 
 /*
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -147,7 +147,7 @@
 	{
 		struct ether_header *eh;
 
-		printf("netif_put: desc=0x%x pkt=0x%x len=%d\n",
+		printf("netif_put: desc=%p pkt=%p len=%zu\n",
 		   desc, pkt, len);
 		eh = pkt;
 		printf("dst: %s ", ether_sprintf(eh->ether_dhost));
@@ -160,14 +160,14 @@
 	if (sendlen < 60) {
 		sendlen = 60;
 #ifdef	NETIF_DEBUG
-		printf("netif_put: length padded to %d\n", sendlen);
+		printf("netif_put: length padded to %zu\n", sendlen);
 #endif
 	}
 
 	rv = prom_write(op->handle, pkt, sendlen);
 
 #ifdef	NETIF_DEBUG
-	printf("netif_put: xmit returned %d\n", rv);
+	printf("netif_put: xmit returned %zd\n", rv);
 #endif
 
 	if (rv > len)
@@ -190,7 +190,7 @@
 	op = ((struct netif *)desc->io_netif)->nif_devdata;
 
 #ifdef	NETIF_DEBUG
-	printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n",
+	printf("netif_get: pkt=%p, maxlen=%zu, tmo=%d\n",
 	   pkt, maxlen, timo);
 #endif
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-06-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jun  1 11:43:56 UTC 2011

Removed Files:
src/sys/arch/sparc/stand/ofwboot: md5.h

Log Message:
Remove unused header.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r0 src/sys/arch/sparc/stand/ofwboot/md5.h

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



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-06-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jun  1 11:43:12 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.h

Log Message:
- remove extern from function declarations
- some KNF


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sparc/stand/ofwboot/boot.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/sparc/stand/ofwboot/boot.h
diff -u src/sys/arch/sparc/stand/ofwboot/boot.h:1.8 src/sys/arch/sparc/stand/ofwboot/boot.h:1.9
--- src/sys/arch/sparc/stand/ofwboot/boot.h:1.8	Thu May 19 15:18:29 2011
+++ src/sys/arch/sparc/stand/ofwboot/boot.h	Wed Jun  1 11:43:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.h,v 1.8 2011/05/19 15:18:29 hauke Exp $	*/
+/*	$NetBSD: boot.h,v 1.9 2011/06/01 11:43:12 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -44,29 +44,29 @@
 extern const char bootprog_name[];
 
 /* bootinfo.c */
-extern u_long	bi_init(u_long);
-extern void	bi_add(void *, int, size_t);
+u_long	bi_init(u_long);
+void	bi_add(void *, int, size_t);
 
 /* sparc64.c */
-extern ssize_t	sparc64_read(int, void *, size_t);
-extern void*	sparc64_memcpy(void *, const void *, size_t);
-extern void*	sparc64_memset(void *, int, size_t);
-extern void	sparc64_bi_add(void);
-extern void	sparc64_finalize_tlb(u_long);
+ssize_t	sparc64_read(int, void *, size_t);
+void	*sparc64_memcpy(void *, const void *, size_t);
+void	*sparc64_memset(void *, int, size_t);
+void	sparc64_bi_add(void);
+void	sparc64_finalize_tlb(u_long);
 
 /* srt0.s */
-extern u_int	get_cpuid(void);
+u_int	get_cpuid(void);
 
 /* loadfile_machdep.c */
 #define LOADFILE_NOP_ALLOCATOR		0x0
 #define LOADFILE_OFW_ALLOCATOR		0x1
 #define LOADFILE_MMU_ALLOCATOR		0x2
-extern void	loadfile_set_allocator(int);
+void	loadfile_set_allocator(int);
 
 /* alloc.c */
-extern void	freeall(void);
+void	freeall(void);
 
 /* ofdev.c */
-char *filename(char*, char*);
+char *filename(char *, char *);
 
 #endif /* _BOOT_H_ */



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-06-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jun  1 11:42:18 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: ofdev.c

Log Message:
Fix harmless merge botch.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.31 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.32
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.31	Sat May 21 16:32:00 2011
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Wed Jun  1 11:42:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.31 2011/05/21 16:32:00 nakayama Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.32 2011/06/01 11:42:18 tsutsui Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -55,7 +55,6 @@
 #include 
 
 #include "ofdev.h"
-#include "net.h"
 #include "boot.h"
 #include "net.h"
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-05-21 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Sat May 21 16:32:01 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c ofdev.c

Log Message:
Fix debug build.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.9 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.10
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.9	Sat May 21 15:50:42 2011
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Sat May 21 16:32:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.9 2011/05/21 15:50:42 tsutsui Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.10 2011/05/21 16:32:00 nakayama Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -251,7 +251,8 @@
 			if (itlb_slot >= itlb_slot_max)
 panic("mmu_mapin: out of itlb_slots");
 
-			DPRINTF(("mmu_mapin: %p:%p.%p\n", va, hi(pa), lo(pa)));
+			DPRINTF(("mmu_mapin: 0x%lx:0x%x.0x%x\n", va,
+			hi(pa), lo(pa)));
 
 			data = TSB_DATA(0,		/* global */
 	PGSZ_4M,	/* 4mb page */

Index: src/sys/arch/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.30 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.31
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.30	Sat May 21 15:50:42 2011
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Sat May 21 16:32:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.30 2011/05/21 15:50:42 tsutsui Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.31 2011/05/21 16:32:00 nakayama Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -126,7 +126,7 @@
 sizeof devtype) < 0)
 			devtype[0] = 0;
 	}
-	DPRINTF(("filename: not found\n",lp));
+	DPRINTF(("filename: not found\n"));
 	return 0;
 }
 
@@ -501,12 +501,12 @@
 		} else {
 			part = partition ? partition - 'a' : 0;
 			ofdev.partoff = label.d_partitions[part].p_offset;
-			DPRINTF(("devopen: setting partition %d offset %x\n",
+			DPRINTF(("devopen: setting partition %d offset %lx\n",
 			   part, ofdev.partoff));
 			if (label.d_partitions[part].p_fstype == FS_RAID) {
 ofdev.partoff += RF_PROTECTED_SECTORS;
 DPRINTF(("devopen: found RAID partition, "
-"adjusting offset to %x\n", ofdev.partoff));
+"adjusting offset to %lx\n", ofdev.partoff));
 			}
 		}
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-05-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May 21 15:50:42 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Locore.c Makefile boot.c
loadfile_machdep.c net.c net.h netif_of.c ofdev.c openfirm.h
promlib.c

Log Message:
WARNSfy and fix dumb bugs noticed by warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc/stand/ofwboot/Locore.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sparc/stand/ofwboot/Makefile
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sparc/stand/ofwboot/boot.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/stand/ofwboot/net.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc/stand/ofwboot/net.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/stand/ofwboot/netif_of.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sparc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/stand/ofwboot/openfirm.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/stand/ofwboot/promlib.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/sparc/stand/ofwboot/Locore.c
diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.11 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.12
--- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.11	Mon May 18 11:39:30 2009
+++ src/sys/arch/sparc/stand/ofwboot/Locore.c	Sat May 21 15:50:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.11 2009/05/18 11:39:30 nakayama Exp $	*/
+/*	$NetBSD: Locore.c,v 1.12 2011/05/21 15:50:42 tsutsui Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -764,12 +764,12 @@
 
 	if (virt == NULL) {
 		if ((virt = (void*)OF_alloc_virt(size, align)) == (void*)-1) {
-			printf("OF_alloc_virt(%d,%d) failed w/%x\n", size, align, virt);
+			printf("OF_alloc_virt(%d,%d) failed w/%p\n", size, align, virt);
 			return (void *)-1;
 		}
 	} else {
 		if ((newvirt = (void*)OF_claim_virt((vaddr_t)virt, size)) == (void*)-1) {
-			printf("OF_claim_virt(%x,%d) failed w/%x\n", virt, size, newvirt);
+			printf("OF_claim_virt(%p,%d) failed w/%p\n", virt, size, newvirt);
 			return (void *)-1;
 		}
 	}
@@ -779,7 +779,8 @@
 		return (void *)-1;
 	}
 	if (OF_map_phys(paddr, size, (vaddr_t)virt, -1) == -1) {
-		printf("OF_map_phys(%x,%d,%x,%d) failed\n", paddr, size, virt, -1);
+		printf("OF_map_phys(0x%lx,%d,%p,%d) failed\n",
+		(u_long)paddr, size, virt, -1);
 		OF_free_phys((paddr_t)paddr, size);
 		OF_free_virt((vaddr_t)virt, size);
 		return (void *)-1;

Index: src/sys/arch/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.28 src/sys/arch/sparc/stand/ofwboot/Makefile:1.29
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.28	Sun Jan 23 11:29:46 2011
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Sat May 21 15:50:42 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.28 2011/01/23 11:29:46 nakayama Exp $
+#	$NetBSD: Makefile,v 1.29 2011/05/21 15:50:42 tsutsui Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
@@ -7,7 +7,7 @@
 # Override normal settings
 #
 
-WARNS=		0
+WARNS?=		2
 
 PROG?=		ofwboot
 SRCS=		srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c vers.c

Index: src/sys/arch/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.27 src/sys/arch/sparc/stand/ofwboot/boot.c:1.28
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.27	Sat Jan 22 19:19:24 2011
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Sat May 21 15:50:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.27 2011/01/22 19:19:24 joerg Exp $	*/
+/*	$NetBSD: boot.c,v 1.28 2011/05/21 15:50:42 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -230,8 +230,8 @@
 static void
 ksyms_copyout(void **ssym, void **esym)
 {
-	void *addr;
-	int kssize = (int)(long)(*esym - *ssym + 1);
+	uint8_t *addr;
+	int kssize = (int)(long)((char *)*esym - (char *)*ssym + 1);
 
 	DPRINTF(("ksyms_copyout(): ssym = %p, esym = %p, kssize = %d\n",
 *ssym, *esym, kssize));
@@ -253,7 +253,6 @@
 static void
 jump_to_kernel(u_long *marks, char *kernel, char *args, void *ofw)
 {
-	extern char end[];
 	int l, machine_tag;
 	long newargs[4];
 	void *ssym, *esym;
@@ -467,7 +466,7 @@
 static void
 check_boot_config(void)
 {
-	int fd, err, off, len;
+	int fd, off, len;
 	struct stat st;
 	char *bc;
 
@@ -515,7 +514,7 @@
 
 	for (;; *kernel = '\0') {
 		if (boothowto & RB_ASKNAME) {
-			char *cp, cmdline[PROM_MAX_PATH];
+			char cmdline[PROM_MAX_PATH];
 
 			printf("Boot: ");
 			gets(cmdline);

Index: src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.8 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.9
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.8	Fri May 20 14:49:54 2011
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Sat May 21 15:50:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.8 2011/05/20 14:49:5

CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 21 15:10:34 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: net.c

Log Message:
more missing includes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/stand/ofwboot/net.c

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

Modified files:

Index: src/sys/arch/sparc/stand/ofwboot/net.c
diff -u src/sys/arch/sparc/stand/ofwboot/net.c:1.5 src/sys/arch/sparc/stand/ofwboot/net.c:1.6
--- src/sys/arch/sparc/stand/ofwboot/net.c:1.5	Wed May  6 20:01:31 2009
+++ src/sys/arch/sparc/stand/ofwboot/net.c	Sat May 21 11:10:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: net.c,v 1.5 2009/05/07 00:01:31 roy Exp $	*/
+/*	$NetBSD: net.c,v 1.6 2011/05/21 15:10:34 christos Exp $	*/
 
 /*
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -60,6 +60,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-05-20 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Fri May 20 14:49:54 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c ofdev.c
Added Files:
src/sys/arch/sparc/stand/ofwboot: net.h

Log Message:
Put the external functions from net.c in it's own header file and
include it, and do some other minimal adjustments to bring this
back to a buildable state.

OK'ed by martin@


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc/stand/ofwboot/net.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.7 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.8
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.7	Mon May 18 11:39:30 2009
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Fri May 20 14:49:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.7 2009/05/18 11:39:30 nakayama Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.8 2011/05/20 14:49:54 he Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -30,6 +30,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 

Index: src/sys/arch/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.28 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.29
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.28	Sun Apr  4 21:49:15 2010
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Fri May 20 14:49:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.28 2010/04/04 21:49:15 martin Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.29 2011/05/20 14:49:54 he Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -55,6 +55,7 @@
 #include 
 
 #include "ofdev.h"
+#include "net.h"
 #include "boot.h"
 
 extern char bootdev[];
@@ -545,7 +546,7 @@
 		if (!strncmp(*file,"/tftp:",6)) {
 			*file += 6;
 			memcpy(&file_system[0], &file_system_tftp, sizeof file_system[0]);
-			if (net_tftp_bootp(&of->f_devdata)) {
+			if (net_tftp_bootp((int**)&of->f_devdata)) {
 net_close(&ofdev);
 goto bad;
 			}

Added files:

Index: src/sys/arch/sparc/stand/ofwboot/net.h
diff -u /dev/null src/sys/arch/sparc/stand/ofwboot/net.h:1.1
--- /dev/null	Fri May 20 14:49:54 2011
+++ src/sys/arch/sparc/stand/ofwboot/net.h	Fri May 20 14:49:54 2011
@@ -0,0 +1,42 @@
+/* $NetBSD: net.h,v 1.1 2011/05/20 14:49:54 he Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _OFWBOOT_NET_H
+#define _OFWBOOT_NET_H
+
+extern int	net_open(struct of_dev *);
+extern int	net_close(struct of_dev *);
+extern int	net_mountroot_bootparams(void);
+extern int	net_mountroot_bootp(void);
+extern int	net_tftp_bootp(int **);
+extern int	net_mountroot(void);
+
+#endif /* _OFWBOOT_NET_H */



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-05-19 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Thu May 19 15:18:29 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.h

Log Message:
Fix a tyop.
The intentions were good...


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/stand/ofwboot/boot.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/sparc/stand/ofwboot/boot.h
diff -u src/sys/arch/sparc/stand/ofwboot/boot.h:1.7 src/sys/arch/sparc/stand/ofwboot/boot.h:1.8
--- src/sys/arch/sparc/stand/ofwboot/boot.h:1.7	Thu May 19 03:09:47 2011
+++ src/sys/arch/sparc/stand/ofwboot/boot.h	Thu May 19 15:18:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.h,v 1.7 2011/05/19 03:09:47 christos Exp $	*/
+/*	$NetBSD: boot.h,v 1.8 2011/05/19 15:18:29 hauke Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 extern void	loadfile_set_allocator(int);
 
 /* alloc.c */
-extern vois	freeall(void);
+extern void	freeall(void);
 
 /* ofdev.c */
 char *filename(char*, char*);



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 19 03:09:47 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: alloc.c boot.h

Log Message:
handle prototype for freeall


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/stand/ofwboot/alloc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/stand/ofwboot/boot.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/sparc/stand/ofwboot/alloc.c
diff -u src/sys/arch/sparc/stand/ofwboot/alloc.c:1.4 src/sys/arch/sparc/stand/ofwboot/alloc.c:1.5
--- src/sys/arch/sparc/stand/ofwboot/alloc.c:1.4	Mon Apr 28 16:23:36 2008
+++ src/sys/arch/sparc/stand/ofwboot/alloc.c	Wed May 18 23:09:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: alloc.c,v 1.4 2008/04/28 20:23:36 martin Exp $	*/
+/*	$NetBSD: alloc.c,v 1.5 2011/05/19 03:09:47 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -82,6 +82,7 @@
 #include 
 
 #include "openfirm.h"
+#include "boot.h"
 
 /*
  * Each block actually has ALIGN(struct ml) + ALIGN(size) bytes allocated

Index: src/sys/arch/sparc/stand/ofwboot/boot.h
diff -u src/sys/arch/sparc/stand/ofwboot/boot.h:1.6 src/sys/arch/sparc/stand/ofwboot/boot.h:1.7
--- src/sys/arch/sparc/stand/ofwboot/boot.h:1.6	Sat Jan 22 14:19:24 2011
+++ src/sys/arch/sparc/stand/ofwboot/boot.h	Wed May 18 23:09:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.h,v 1.6 2011/01/22 19:19:24 joerg Exp $	*/
+/*	$NetBSD: boot.h,v 1.7 2011/05/19 03:09:47 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -63,6 +63,9 @@
 #define LOADFILE_MMU_ALLOCATOR		0x2
 extern void	loadfile_set_allocator(int);
 
+/* alloc.c */
+extern vois	freeall(void);
+
 /* ofdev.c */
 char *filename(char*, char*);
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2011-01-23 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Sun Jan 23 11:29:46 UTC 2011

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
Redo previous.
bsd.own.mk must be included after NOMAN=.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.27 src/sys/arch/sparc/stand/ofwboot/Makefile:1.28
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.27	Sat Jan 22 19:19:24 2011
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Sun Jan 23 11:29:46 2011
@@ -1,10 +1,8 @@
-#	$NetBSD: Makefile,v 1.27 2011/01/22 19:19:24 joerg Exp $
+#	$NetBSD: Makefile,v 1.28 2011/01/23 11:29:46 nakayama Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
 
-.include 
-
 #
 # Override normal settings
 #
@@ -94,6 +92,8 @@
 cleanlibdir:
 	-rm -rf lib
 
+.include 
+
 vers.c: version
 	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
 	${CURDIR}/version "sparc64" ${NEWVERSWHAT}



CVS commit: src/sys/arch/sparc/stand/ofwboot

2010-11-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Nov  6 21:33:42 UTC 2010

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.c

Log Message:
add a "-T" option to disable the twiddler, which can help booting
with serial output slowness i've seen.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.25 src/sys/arch/sparc/stand/ofwboot/boot.c:1.26
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.25	Wed Aug 25 20:16:49 2010
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Sat Nov  6 21:33:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.25 2010/08/25 20:16:49 christos Exp $	*/
+/*	$NetBSD: boot.c,v 1.26 2010/11/06 21:33:42 mrg Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -95,6 +95,7 @@
 
 int debug  = 0;
 int compatmode = 0;
+extern char twiddle_toggle;
 
 #if 0
 static void
@@ -190,6 +191,7 @@
 		kernel[end2 - start2] = '\0';
 	}
 
+	twiddle_toggle = 1;
 	strcpy(options, ap);
 	while (*ap != '\0' && *ap != ' ' && *ap != '\t' && *ap != '\n') {
 		BOOT_FLAG(*ap, v);
@@ -200,6 +202,9 @@
 		case 'C':
 			compatmode = 1;
 			break;
+		case 'T':
+			twiddle_toggle = 1 - twiddle_toggle;
+			break;
 		default:
 			break;
 		}



CVS commit: src/sys/arch/sparc/stand/ofwboot

2010-08-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 25 16:38:04 UTC 2010

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.c

Log Message:
kill LOAD_MINIMAL.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.23 src/sys/arch/sparc/stand/ofwboot/boot.c:1.24
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.23	Wed Aug 25 12:24:45 2010
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Wed Aug 25 12:38:04 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.23 2010/08/25 16:24:45 christos Exp $	*/
+/*	$NetBSD: boot.c,v 1.24 2010/08/25 16:38:04 christos Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -354,7 +354,9 @@
 {
 	int fd;
 	u_long marks[MARK_MAX];
-	int flags = isfloppy ? LOAD_MINIMAL : LOAD_ALL;
+	int flags = LOAD_ALL;
+	if (isfloppy)
+		flags &= ~LOAD_BACKWARDS;
 
 	/*
 	 * First, load headers using default allocator and check whether kernel



CVS commit: src/sys/arch/sparc/stand/ofwboot

2010-08-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 25 16:24:45 UTC 2010

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.c

Log Message:
Try to detect if we are doing a floppy boot from the device name and if
we are, load the minimal set to avoid backwards seeks.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.22 src/sys/arch/sparc/stand/ofwboot/boot.c:1.23
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.22	Fri Apr  2 14:39:44 2010
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Wed Aug 25 12:24:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.22 2010/04/02 18:39:44 martin Exp $	*/
+/*	$NetBSD: boot.c,v 1.23 2010/08/25 16:24:45 christos Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -350,10 +350,11 @@
 }
 
 static void
-start_kernel(char *kernel, char *bootline, void *ofw)
+start_kernel(char *kernel, char *bootline, void *ofw, int isfloppy)
 {
 	int fd;
 	u_long marks[MARK_MAX];
+	int flags = isfloppy ? LOAD_MINIMAL : LOAD_ALL;
 
 	/*
 	 * First, load headers using default allocator and check whether kernel
@@ -371,7 +372,7 @@
 		}
 		(void)printf("Loading %s: ", kernel);
 
-		if (fdloadfile(fd, marks, LOAD_ALL) != -1) {
+		if (fdloadfile(fd, marks, flags) != -1) {
 			close(fd);
 			jump_to_kernel(marks, kernel, bootline, ofw);
 		}
@@ -488,7 +489,7 @@
 void
 main(void *ofw)
 {
-	int boothowto, i = 0;
+	int boothowto, i = 0, isfloppy;
 
 	char kernel[PROM_MAX_PATH];
 	char bootline[PROM_MAX_PATH];
@@ -503,6 +504,7 @@
 	/* Figure boot arguments */
 	strncpy(bootdev, prom_getbootpath(), sizeof(bootdev) - 1);
 	boothowto = bootoptions(prom_getbootargs(), bootdev, kernel, bootline);
+	isfloppy = strstr(bootdev, "fd") || strstr(bootdev, "floppy");
 
 	for (;; *kernel = '\0') {
 		if (boothowto & RB_ASKNAME) {
@@ -541,7 +543,7 @@
 		}
 
 		check_boot_config();
-		start_kernel(kernel, bootline, ofw);
+		start_kernel(kernel, bootline, ofw, isfloppy);
 
 		/*
 		 * Try next name from kernel name list if not in askname mode,



CVS commit: src/sys/arch/sparc/stand/ofwboot

2010-04-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr  4 21:49:15 UTC 2010

Modified Files:
src/sys/arch/sparc/stand/ofwboot: ofdev.c

Log Message:
Turn a printf into a DPRINTF(), since we will very likely recover from
the condition (and it happens on stock install CDs)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.27 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.28
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.27	Fri Apr  2 18:39:44 2010
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Sun Apr  4 21:49:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.27 2010/04/02 18:39:44 martin Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.28 2010/04/04 21:49:15 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -477,7 +477,10 @@
 			 LABELSECTOR, DEV_BSIZE, b.buf, &read) != 0
 		|| read != DEV_BSIZE
 		|| (errmsg = getdisklabel(b.buf, &label))) {
-			if (errmsg) printf("devopen: getdisklabel returned %s\n", errmsg);
+			if (errmsg) {
+DPRINTF(("devopen: getdisklabel returned %s\n",
+	errmsg));
+			}
 			/* Else try MBR partitions */
 			errmsg = search_label(&ofdev, 0, b.buf, &label, 0);
 			if (errmsg) {



CVS commit: src/sys/arch/sparc/stand/ofwboot

2010-04-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr  2 18:41:52 UTC 2010

Modified Files:
src/sys/arch/sparc/stand/ofwboot: version

Log Message:
Bump version


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/version
diff -u src/sys/arch/sparc/stand/ofwboot/version:1.18 src/sys/arch/sparc/stand/ofwboot/version:1.19
--- src/sys/arch/sparc/stand/ofwboot/version:1.18	Wed Jan 27 22:18:37 2010
+++ src/sys/arch/sparc/stand/ofwboot/version	Fri Apr  2 18:41:52 2010
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.18 2010/01/27 22:18:37 martin Exp $
+$NetBSD: version,v 1.19 2010/04/02 18:41:52 martin 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
@@ -19,3 +19,4 @@
 1.13:	Deal with kernels missing a separate read-only text segment
 1.14:	Make 3 attempts at BOOTP/DHCP for to allow for bridges and clear prior data read
 1.15:	Properly close the firmware handle before starting the kernel
+1.16:	Add support to boot with root on cd9660



CVS commit: src/sys/arch/sparc/stand/ofwboot

2010-04-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr  2 18:39:44 UTC 2010

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile boot.c ofdev.c

Log Message:
Add support for /boot.cfg. Implement a single command for now: override
the boot partition, which will be used for bootable CDs. Add cd9660
support.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/stand/ofwboot/Makefile
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc/stand/ofwboot/boot.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.22 src/sys/arch/sparc/stand/ofwboot/Makefile:1.23
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.22	Fri Nov 27 11:14:23 2009
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Fri Apr  2 18:39:44 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.22 2009/11/27 11:14:23 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.23 2010/04/02 18:39:44 martin Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
@@ -59,7 +59,7 @@
 CPPFLAGS+=	-DSPARC_BOOT_ELF
 CPPFLAGS+=	-DSPARC_BOOT_UFS
 CPPFLAGS+=	-DSPARC_BOOT_NFS
-#CPPFLAGS+=	-DSPARC_BOOT_CD9660
+CPPFLAGS+=	-DSPARC_BOOT_CD9660
 
 ### find out what to use for libkern
 KERN_AS=	library

Index: src/sys/arch/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.21 src/sys/arch/sparc/stand/ofwboot/boot.c:1.22
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.21	Wed Jan 27 22:18:37 2010
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Fri Apr  2 18:39:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.21 2010/01/27 22:18:37 martin Exp $	*/
+/*	$NetBSD: boot.c,v 1.22 2010/04/02 18:39:44 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -89,6 +89,8 @@
 };
 
 char bootdev[PROM_MAX_PATH];
+bool root_fs_quickseekable = true;	/* unset for tftp boots */
+static bool bootinfo_pass_bootdev = false;
 
 int debug  = 0;
 int compatmode = 0;
@@ -272,6 +274,17 @@
 	bi_add(&bi_sym, BTINFO_SYMTAB, sizeof(bi_sym));
 	bi_kend.addr= bootinfo + BOOTINFO_SIZE;
 	bi_add(&bi_kend, BTINFO_KERNEND, sizeof(bi_kend));
+	if (bootinfo_pass_bootdev) {
+		struct {
+			struct btinfo_common common;
+			char name[256];
+		} info;
+		
+		strcpy(info.name, bootdev);
+		bi_add(&info, BTINFO_BOOTDEV, strlen(bootdev)
+			+sizeof(struct btinfo_bootdev));
+	}
+
 	sparc64_finalize_tlb(marks[MARK_DATA]);
 	sparc64_bi_add();
 
@@ -383,6 +396,95 @@
 		"  disk:a netbsd -s\n");
 }
 
+static void
+do_config_command(const char *cmd, const char *arg)
+{
+	DPRINTF(("do_config_command: %s\n", cmd));
+	if (strcmp(cmd, "bootpartition") == 0) {
+		char *c;
+
+		DPRINTF(("switching boot partition to %s from %s\n",
+		arg, bootdev));
+		c = strrchr(bootdev, ':');
+		if (!c) return;
+		if (c[1] == 0) return;
+		if (strlen(arg) > strlen(c)) return;
+		strcpy(c, arg);
+		DPRINTF(("new boot device: %s\n", bootdev));
+		bootinfo_pass_bootdev = true;
+	}
+}
+
+static void
+parse_boot_config(char *cfg, size_t len)
+{
+	const char *cmd = NULL, *arg = NULL;
+
+	while (len) {
+		if (isspace(*cfg)) {
+			cfg++; len--; continue;
+		}
+		if (*cfg == ';' || *cfg == '#') {
+			while (len && *cfg != '\r' && *cfg != '\n') {
+cfg++; len--;
+			}
+			continue;
+		}
+		cmd = cfg;
+		while (len && !isspace(*cfg)) {
+			cfg++; len--;
+		}
+		*cfg = 0;
+		if (len > 0) {
+			cfg++; len--;
+			while (isspace(*cfg) && len) {
+cfg++; len--;
+			}
+			if (len > 0 ) {
+arg = cfg;
+while (len && !isspace(*cfg)) {
+	cfg++; len--;
+}
+*cfg = 0;
+			}
+		}
+		do_config_command(cmd, arg);
+		if (len > 0) {
+			cfg++; len--;
+		}
+	}
+}
+
+static void
+check_boot_config(void)
+{
+	int fd, err, off, len;
+	struct stat st;
+	char *bc;
+
+	if (!root_fs_quickseekable) return;
+	DPRINTF(("checking for /boot.cfg...\n"));
+	fd = open("/boot.cfg", 0);
+	if (fd < 0) return;
+	DPRINTF(("found /boot.cfg\n"));
+	if (fstat(fd, &st) == -1 || st.st_size > 32*1024) {
+		close(fd);
+		return;
+	}
+	bc = alloc(st.st_size+1);
+	off = 0;
+	do {
+		len = read(fd, bc+off, 1024);
+		if (len <= 0)
+			break;
+		off += len;
+	} while (len > 0);
+	bc[off] = 0;
+	close(fd);
+
+	parse_boot_config(bc, off);
+}
+
 void
 main(void *ofw)
 {
@@ -438,6 +540,7 @@
 			boothowto |= RB_ASKNAME;
 		}
 
+		check_boot_config();
 		start_kernel(kernel, bootline, ofw);
 
 		/*

Index: src/sys/arch/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.26 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.27
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.26	Wed Feb 17 15:50:06 2010
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Fri Apr  2 18:39:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.26 2010/02/17 15:50:06 eeh Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.27 2010/04/02 18:39:44 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang

CVS commit: src/sys/arch/sparc/stand/ofwboot

2010-02-17 Thread Eduardo Horvath
Module Name:src
Committed By:   eeh
Date:   Wed Feb 17 15:50:06 UTC 2010

Modified Files:
src/sys/arch/sparc/stand/ofwboot: ofdev.c

Log Message:
Add support for ffsv2 and lfs.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.25 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.26
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.25	Wed Jan 27 22:18:37 2010
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Wed Feb 17 15:50:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.25 2010/01/27 22:18:37 martin Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.26 2010/02/17 15:50:06 eeh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -41,6 +41,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #ifdef NETBOOT
 #include 
@@ -188,8 +189,10 @@
 };
 int ndevs = sizeof ofdevsw / sizeof ofdevsw[0];
 
+
 #ifdef SPARC_BOOT_UFS
-static struct fs_ops file_system_ufs = FS_OPS(ufs);
+static struct fs_ops file_system_ufs[] = 
+{ FS_OPS(ufs), FS_OPS(ffsv2), FS_OPS(lfsv1), FS_OPS(lfsv2) };
 #endif
 #ifdef SPARC_BOOT_CD9660
 static struct fs_ops file_system_cd9660 = FS_OPS(cd9660);
@@ -199,7 +202,7 @@
 static struct fs_ops file_system_tftp = FS_OPS(tftp);
 #endif
 
-struct fs_ops file_system[3];
+struct fs_ops file_system[7];
 int nfsys;
 
 static struct of_dev ofdev = {
@@ -515,11 +518,13 @@
 		of->f_dev = ofdevsw;
 		of->f_devdata = &ofdev;
 #ifdef SPARC_BOOT_UFS
-		memcpy(&file_system[nfsys++], &file_system_ufs, sizeof file_system[0]);
+		memcpy(&file_system[nfsys++], &file_system_ufs[0], sizeof file_system[0]);
+		memcpy(&file_system[nfsys++], &file_system_ufs[1], sizeof file_system[0]);
+		memcpy(&file_system[nfsys++], &file_system_ufs[2], sizeof file_system[0]);
+		memcpy(&file_system[nfsys++], &file_system_ufs[3], sizeof file_system[0]);
 #endif
 #ifdef SPARC_BOOT_CD9660
-		memcpy(&file_system[nfsys++], &file_system_cd9660,
-		sizeof file_system[0]);
+		memcpy(&file_system[nfsys++], &file_system_cd9660, sizeof file_system[0]);
 #endif
 		DPRINTF(("devopen: return 0\n"));
 		return 0;



CVS commit: src/sys/arch/sparc/stand/ofwboot

2010-01-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan 27 22:18:37 UTC 2010

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.c ofdev.c version

Log Message:
Properly close the firmware handle before starting the kernel.
This makes netbooting via bge* work.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sparc/stand/ofwboot/boot.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.20 src/sys/arch/sparc/stand/ofwboot/boot.c:1.21
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.20	Mon Oct 26 19:16:57 2009
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Wed Jan 27 22:18:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.20 2009/10/26 19:16:57 cegger Exp $	*/
+/*	$NetBSD: boot.c,v 1.21 2010/01/27 22:18:37 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -359,6 +359,7 @@
 		(void)printf("Loading %s: ", kernel);
 
 		if (fdloadfile(fd, marks, LOAD_ALL) != -1) {
+			close(fd);
 			jump_to_kernel(marks, kernel, bootline, ofw);
 		}
 	}

Index: src/sys/arch/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.24 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.25
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.24	Mon Oct 26 19:16:57 2009
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Wed Jan 27 22:18:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.24 2009/10/26 19:16:57 cegger Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.25 2010/01/27 22:18:37 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -531,7 +531,7 @@
 
 		ofdev.type = OFDEV_NET;
 		of->f_dev = ofdevsw;
-		of->f_devdata = NULL;
+		of->f_devdata = &ofdev;
 
 		if (!strncmp(*file,"/tftp:",6)) {
 			*file += 6;

Index: src/sys/arch/sparc/stand/ofwboot/version
diff -u src/sys/arch/sparc/stand/ofwboot/version:1.17 src/sys/arch/sparc/stand/ofwboot/version:1.18
--- src/sys/arch/sparc/stand/ofwboot/version:1.17	Thu May  7 00:01:31 2009
+++ src/sys/arch/sparc/stand/ofwboot/version	Wed Jan 27 22:18:37 2010
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.17 2009/05/07 00:01:31 roy Exp $
+$NetBSD: version,v 1.18 2010/01/27 22:18:37 martin 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
@@ -18,3 +18,4 @@
 1.12:	Add support to boot from newer Solaris UFS partitions
 1.13:	Deal with kernels missing a separate read-only text segment
 1.14:	Make 3 attempts at BOOTP/DHCP for to allow for bridges and clear prior data read
+1.15:	Properly close the firmware handle before starting the kernel



CVS commit: src/sys/arch/sparc/stand/ofwboot

2009-11-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 27 11:14:23 UTC 2009

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
Add src/common/include to -Ipath for proplib(3) so that build works
even without installed DESTDIR.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.21 src/sys/arch/sparc/stand/ofwboot/Makefile:1.22
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.21	Wed Oct 17 19:57:16 2007
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Fri Nov 27 11:14:23 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2007/10/17 19:57:16 garbled Exp $
+#	$NetBSD: Makefile,v 1.22 2009/11/27 11:14:23 tsutsui Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
@@ -49,6 +49,7 @@
 ENTRY=		_start
 
 CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
+CPPFLAGS+=	-I${CURDIR}/../../../../../common/include
 CPPFLAGS+=	-DRELOC=0x${RELOC}
 
 #



CVS commit: src/sys/arch/sparc/stand/ofwboot

2009-05-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu May  7 00:01:31 UTC 2009

Modified Files:
src/sys/arch/sparc/stand/ofwboot: net.c version

Log Message:
Make 3 attempts at bootp before trying bootparams which allows slow
bridges a chance to work.
Clear variables when changing bootp/bootparams.
Displayed variables are cleaned up so they don't overflow the right of
the screen.

ok: martin


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/stand/ofwboot/net.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/stand/ofwboot/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/sparc/stand/ofwboot/net.c
diff -u src/sys/arch/sparc/stand/ofwboot/net.c:1.4 src/sys/arch/sparc/stand/ofwboot/net.c:1.5
--- src/sys/arch/sparc/stand/ofwboot/net.c:1.4	Mon May 12 11:16:31 2008
+++ src/sys/arch/sparc/stand/ofwboot/net.c	Thu May  7 00:01:31 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: net.c,v 1.4 2008/05/12 11:16:31 mlelstv Exp $	*/
+/*	$NetBSD: net.c,v 1.5 2009/05/07 00:01:31 roy Exp $	*/
 
 /*
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -116,24 +116,31 @@
 		}
 }
 
+static void
+net_clear_params(void)
+{
+	
+	myip.s_addr = 0;
+	netmask = 0;
+	gateip.s_addr = 0;
+	*hostname = '\0';
+	rootip.s_addr = 0;
+	*rootpath = '\0';
+}
+
 int
 net_mountroot_bootparams(void)
 {
 
+	net_clear_params();
+
 	/* Get our IP address.  (rarp.c) */
 	if (rarp_getipaddress(netdev_sock) == -1)
 		return (errno);
-
-	printf("Using BOOTPARAMS protocol: ");
-	printf("ip address: %s", inet_ntoa(myip));
-
-	/* Get our hostname, server IP address. */
+	printf("Using BOOTPARAMS protocol:\n  ip addr=%s\n", inet_ntoa(myip));
 	if (bp_whoami(netdev_sock))
 		return (errno);
-
-	printf(", hostname: %s\n", hostname);
-
-	/* Get the root pathname. */
+	printf("  hostname=%s\n", hostname);
 	if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
 		return (errno);
 
@@ -143,22 +150,27 @@
 int
 net_mountroot_bootp(void)
 {
+	int attempts;
 
-	bootp(netdev_sock);
-
+	/* We need a few attempts here as some DHCP servers
+	 * require >1 packet and my wireless bridge is always
+	 * in learning mode until the 2nd attempt ... */
+	for (attempts = 0; attempts < 3; attempts++) {
+		net_clear_params();
+		bootp(netdev_sock);
+		if (myip.s_addr != 0)
+			break;
+	}
 	if (myip.s_addr == 0)
 		return(ENOENT);
 
-	printf("Using BOOTP protocol: ");
-	printf("ip address: %s", inet_ntoa(myip));
-
+	printf("Using BOOTP protocol:\n ip addr=%s\n", inet_ntoa(myip));
 	if (hostname[0])
-		printf(", hostname: %s", hostname);
+		printf("  hostname=%s\n", hostname);
 	if (netmask)
-		printf(", netmask: %s", intoa(netmask));
+		printf("  netmask=%s\n", intoa(netmask));
 	if (gateip.s_addr)
-		printf(", gateway: %s", inet_ntoa(gateip));
-	printf("\n");
+		printf("  gateway=%s\n", inet_ntoa(gateip));
 
 	return (0);
 }
@@ -167,22 +179,10 @@
 net_tftp_bootp(int **sock)
 {
 
-	bootp(netdev_sock);
-
+	net_mountroot_bootp();
 	if (myip.s_addr == 0)
 		return(ENOENT);
 
-	printf("Using BOOTP protocol: ");
-	printf("ip address: %s", inet_ntoa(myip));
-
-	if (hostname[0])
-		printf(", hostname: %s", hostname);
-	if (netmask)
-		printf(", netmask: %s", intoa(netmask));
-	if (gateip.s_addr)
-		printf(", gateway: %s", inet_ntoa(gateip));
-	printf("\n");
-
 	*sock = &netdev_sock;
 	return (0);
 }
@@ -211,7 +211,7 @@
 	if (error != 0)
 		return (error);
 
-	printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
+	printf("  root addr=%s\n  path=%s\n", inet_ntoa(rootip), rootpath);
 
 	/* Get the NFS file handle (mount). */
 	if (nfs_mount(netdev_sock, rootip, rootpath) != 0)

Index: src/sys/arch/sparc/stand/ofwboot/version
diff -u src/sys/arch/sparc/stand/ofwboot/version:1.16 src/sys/arch/sparc/stand/ofwboot/version:1.17
--- src/sys/arch/sparc/stand/ofwboot/version:1.16	Mon Aug 25 22:31:12 2008
+++ src/sys/arch/sparc/stand/ofwboot/version	Thu May  7 00:01:31 2009
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.16 2008/08/25 22:31:12 martin Exp $
+$NetBSD: version,v 1.17 2009/05/07 00:01:31 roy 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
@@ -17,3 +17,4 @@
 1.11:	Improve partition handling and allow changing the device at the boot prompt
 1.12:	Add support to boot from newer Solaris UFS partitions
 1.13:	Deal with kernels missing a separate read-only text segment
+1.14:	Make 3 attempts at BOOTP/DHCP for to allow for bridges and clear prior data read