CVS commit: src/sys/arch/sandpoint/stand/altboot

2024-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  9 16:12:02 UTC 2024

Modified Files:
src/sys/arch/sandpoint/stand/altboot: Makefile

Log Message:
PR/57915: Jan-Benedict Glaw: Use $MKREPRO_TIMESTAMP for repro builds in uBoot
images


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/Makefile
diff -u src/sys/arch/sandpoint/stand/altboot/Makefile:1.18 src/sys/arch/sandpoint/stand/altboot/Makefile:1.19
--- src/sys/arch/sandpoint/stand/altboot/Makefile:1.18	Tue Mar 23 22:53:16 2021
+++ src/sys/arch/sandpoint/stand/altboot/Makefile	Fri Feb  9 11:12:02 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2021/03/24 02:53:16 rin Exp $
+#	$NetBSD: Makefile,v 1.19 2024/02/09 16:12:02 christos Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -56,13 +56,19 @@ cleandir distclean: .WAIT cleanlibdir
 cleanlibdir:
 	-rm -rf lib
 
+.if ${MKREPRO_TIMESTAMP:Uno} != "no"
+MKUBOOTIMAGE_TIMESTAMP=-t "${MKREPRO_TIMESTAMP}"
+.endif
+
 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${_MKTARGET_LINK}
 	${LD} -N -Ttext ${RELOC} -Bstatic -e ${ENTRY} -o ${PROG} \
 	${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${OBJCOPY} -S -O binary ${PROG} ${PROG}.bin
 	${TOOL_MKUBOOTIMAGE} -A powerpc -T kernel -C none -O linux \
-	-a 0x${RELOC} -n ${PROG} ${PROG}.bin ${PROG}.img
+	-a 0x${RELOC} ${MKUBOOTIMAGE_TIMESTAMP} -n ${PROG} \
+	${PROG}.bin ${PROG}.img
+
 
 VERSIONFLAGS+=-k
 .include "${S}/conf/newvers_stand.mk"



CVS commit: src/sys/arch/sandpoint/stand/altboot

2024-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  9 16:12:02 UTC 2024

Modified Files:
src/sys/arch/sandpoint/stand/altboot: Makefile

Log Message:
PR/57915: Jan-Benedict Glaw: Use $MKREPRO_TIMESTAMP for repro builds in uBoot
images


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

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:27:02 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
sandpoint: Teach altboot to handle 9.99.100 modules.

Not tested, but something here will be necessary to make it work, and
the same change does work in x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.33 src/sys/arch/sandpoint/stand/altboot/main.c:1.34
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.33	Tue Mar 23 07:21:40 2021
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Thu Sep 22 14:27:02 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.33 2021/03/23 07:21:40 rin Exp $ */
+/* $NetBSD: main.c,v 1.34 2022/09/22 14:27:02 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -516,7 +516,7 @@ module_load(const char *kernel_path)
 		"/stand/sandpoint/%d.%d.%d/modules",
 		netbsd_version / 1,
 		netbsd_version / 100 % 100,
-		netbsd_version / 100 % 100);
+		netbsd_version / 100 % 1);
 	}
 	 else if (netbsd_version != 0) {
 		/* release */



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:27:02 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
sandpoint: Teach altboot to handle 9.99.100 modules.

Not tested, but something here will be necessary to make it work, and
the same change does work in x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:52:41 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Do not use NULL for integer 0.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/dsk.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/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.18 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.19
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.18	Tue Sep 29 15:12:52 2015
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Sat Apr 30 03:52:41 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.18 2015/09/29 15:12:52 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.19 2022/04/30 03:52:41 rin Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -473,7 +473,7 @@ dlabel_valid(int unit)
 
 	dsk = lookup_disk(unit);
 	if (dsk == NULL)
-		return NULL;
+		return 0;
 	return dsk->dlabel != NULL;
 }
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:52:41 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Do not use NULL for integer 0.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/dsk.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-04-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Apr  5 06:43:54 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: version

Log Message:
s/confortable/comfortable/


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/version
diff -u src/sys/arch/sandpoint/stand/altboot/version:1.10 src/sys/arch/sandpoint/stand/altboot/version:1.11
--- src/sys/arch/sandpoint/stand/altboot/version:1.10	Mon Apr  4 19:33:45 2022
+++ src/sys/arch/sandpoint/stand/altboot/version	Tue Apr  5 06:43:54 2022
@@ -2,7 +2,7 @@
 1.1:	PCI autoconf for multiple NIC device drivers
 1.2:	Synology-DS support, Marvell-Yukon driver, fixed aligned alloc
 1.3:	allow to have boot options, brdsetup.c cleanup to make brdtype
-	maintenance more confortable
+	maintenance more comfortable
 1.4:	load kernels from local disk
 1.5:	altboot is the new name as this is capable of handling net & dsk.
 1.6:	build altboot.img to fake a Linux kernel module, supports bootargs



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-04-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Apr  5 06:43:54 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: version

Log Message:
s/confortable/comfortable/


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sandpoint/stand/altboot/version

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2021-03-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar 25 03:44:25 UTC 2021

Modified Files:
src/sys/arch/sandpoint/stand/altboot: rge.c

Log Message:
Fix tftp boot with RTL8169/8110.

When sending frame shorter than 60 octets, we add trailing \0's to
payload to construct 60-octet frame.

rge.c rev 1.4--1.7 did this tail-padding on buffer provided by caller,
which results in memory corruption if buffer is shorter than 60 bytes.

Instead, allocate temporary buffer on stack, and work on it.

This bug affects tftp_getnextblock() compiled by GCC8 and later, by
which stack layout has drastically changed. However, even with GCC7,
if tftp.c is compiled with -O0, the bug becomes tangible.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sandpoint/stand/altboot/rge.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/sandpoint/stand/altboot/rge.c
diff -u src/sys/arch/sandpoint/stand/altboot/rge.c:1.7 src/sys/arch/sandpoint/stand/altboot/rge.c:1.8
--- src/sys/arch/sandpoint/stand/altboot/rge.c:1.7	Tue Dec 25 17:07:06 2012
+++ src/sys/arch/sandpoint/stand/altboot/rge.c	Thu Mar 25 03:44:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rge.c,v 1.7 2012/12/25 17:07:06 phx Exp $ */
+/* $NetBSD: rge.c,v 1.8 2021/03/25 03:44:25 rin Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -235,11 +235,15 @@ rge_send(void *dev, char *buf, unsigned 
 	struct local *l = dev;
 	volatile struct desc *txd;
 	unsigned loop, ret;
+	char tmp[60];
 
 	ret = len;
+	/* RTL does not stretch <60 Tx frame */
 	if (len < 60) {
+		memcpy(tmp, buf, len);
+		buf = tmp;
 		memset(buf + len, 0, 60 - len);
-		len = 60; /* RTL does not stretch <60 Tx frame */
+		len = 60;
 	}
 	wbinv(buf, len);
 	txd = >txd[l->tx];



CVS commit: src/sys/arch/sandpoint/stand/altboot

2021-03-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar 25 03:44:25 UTC 2021

Modified Files:
src/sys/arch/sandpoint/stand/altboot: rge.c

Log Message:
Fix tftp boot with RTL8169/8110.

When sending frame shorter than 60 octets, we add trailing \0's to
payload to construct 60-octet frame.

rge.c rev 1.4--1.7 did this tail-padding on buffer provided by caller,
which results in memory corruption if buffer is shorter than 60 bytes.

Instead, allocate temporary buffer on stack, and work on it.

This bug affects tftp_getnextblock() compiled by GCC8 and later, by
which stack layout has drastically changed. However, even with GCC7,
if tftp.c is compiled with -O0, the bug becomes tangible.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sandpoint/stand/altboot/rge.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2021-03-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Mar 24 02:53:16 UTC 2021

Modified Files:
src/sys/arch/sandpoint/stand/altboot: Makefile

Log Message:
Remove "lib" directory for cleandir.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/Makefile
diff -u src/sys/arch/sandpoint/stand/altboot/Makefile:1.17 src/sys/arch/sandpoint/stand/altboot/Makefile:1.18
--- src/sys/arch/sandpoint/stand/altboot/Makefile:1.17	Sat Apr  8 19:53:22 2017
+++ src/sys/arch/sandpoint/stand/altboot/Makefile	Wed Mar 24 02:53:16 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2017/04/08 19:53:22 christos Exp $
+#	$NetBSD: Makefile,v 1.18 2021/03/24 02:53:16 rin Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -51,6 +51,11 @@ SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA=		${SALIB}
 
+cleandir distclean: .WAIT cleanlibdir
+
+cleanlibdir:
+	-rm -rf lib
+
 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${_MKTARGET_LINK}
 	${LD} -N -Ttext ${RELOC} -Bstatic -e ${ENTRY} -o ${PROG} \



CVS commit: src/sys/arch/sandpoint/stand/altboot

2021-03-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Mar 24 02:53:16 UTC 2021

Modified Files:
src/sys/arch/sandpoint/stand/altboot: Makefile

Log Message:
Remove "lib" directory for cleandir.


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

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2021-03-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Mar 23 07:21:41 UTC 2021

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Make this compile with -DDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2021-03-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Mar 23 07:21:41 UTC 2021

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Make this compile with -DDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.32 src/sys/arch/sandpoint/stand/altboot/main.c:1.33
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.32	Tue Mar 23 07:21:15 2021
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Tue Mar 23 07:21:40 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.32 2021/03/23 07:21:15 rin Exp $ */
+/* $NetBSD: main.c,v 1.33 2021/03/23 07:21:40 rin Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -40,6 +40,10 @@
 
 #include "globals.h"
 
+#ifdef DEBUG
+int debug = 1;
+#endif
+
 static const struct bootarg {
 	const char *name;
 	int value;



CVS commit: src/sys/arch/sandpoint/stand/altboot

2021-03-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Mar 23 07:21:16 UTC 2021

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Make sure not to run kernel if fdloadfile() fails;
it returns *non-zero* value on error.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.31 src/sys/arch/sandpoint/stand/altboot/main.c:1.32
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.31	Wed Jun 26 22:04:12 2019
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Tue Mar 23 07:21:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.31 2019/06/26 22:04:12 christos Exp $ */
+/* $NetBSD: main.c,v 1.32 2021/03/23 07:21:15 rin Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -345,7 +345,7 @@ main(int argc, char *argv[], char *boota
 
 		err = fdloadfile(fd, marks, LOAD_KERNEL);
 		close(fd);
-		if (err < 0)
+		if (err != 0)
 			continue;
 
 		printf("entry=%p, ssym=%p, esym=%p\n",



CVS commit: src/sys/arch/sandpoint/stand/altboot

2021-03-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Mar 23 07:21:16 UTC 2021

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Make sure not to run kernel if fdloadfile() fails;
it returns *non-zero* value on error.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 22:04:12 UTC 2019

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
make this compile again


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2019-06-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jun 26 00:54:04 UTC 2019

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Similar to changes made for x86, allow for the boot-loader to auto-push
a list of modules for file-system support.  This allows, for example,
booting from an ext2fs file-system when the kernel has no built-in ufs
or ext2fs modules.

XXX Untested, as I have no sandpoint hardware.  I'd appreciate it if
XXX someone with hardware can build and test.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.29 src/sys/arch/sandpoint/stand/altboot/main.c:1.30
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.29	Thu Feb  8 09:05:18 2018
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Wed Jun 26 00:54:04 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.29 2018/02/08 09:05:18 dholland Exp $ */
+/* $NetBSD: main.c,v 1.30 2019/06/26 00:54:04 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -90,6 +90,7 @@ uint32_t kmodloadp;
 int modules_enabled = 0;
 
 void module_add(const char *);
+void module_add_split(const char *);
 void module_load(const char *);
 int module_open(struct boot_module *);
 
@@ -367,7 +368,7 @@ main(int argc, char *argv[], char *boota
 
 		if (modules_enabled) {
 			if (fsmod != NULL)
-module_add(fsmod);
+module_add_split(fsmod);
 			kmodloadp = marks[MARK_END];
 			btinfo_modulelist = NULL;
 			module_load(bname);
@@ -423,6 +424,42 @@ bi_add(void *new, int type, int size)
 	bi_next += size;
 }
 
+/*
+ * Add a /-separated list of module names to the boot list
+ */
+static void
+module_add_split(const char *name)
+{
+	char mod_name[MAXMODNAME];
+	int i;
+	const char *mp = name;
+	char *ep;
+
+	while (*mp) {/* scan list of module names */
+		i = MAXMODNAME;
+		ep = mod_name;
+		while (--i) {			/* scan for end of first name */
+			*ep = *mp;
+			if (*ep == '/')		/* NUL-terminate the name */
+*ep = '\0';
+
+			if (*ep == 0 ) {	/* add non-empty name */
+if (ep != mod_name)
+	module_add(mod_name);
+break;
+			}
+			ep++; mp++;
+		}
+		if (*ep != 0) {
+			printf("module name too long\n");
+			return;
+		}
+		if  (*mp == '/') {		/* skip separator if more */
+			mp++;
+		}
+	}
+}
+
 void
 module_add(const char *name)
 {



CVS commit: src/sys/arch/sandpoint/stand/altboot

2017-08-03 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Aug  3 19:51:00 UTC 2017

Modified Files:
src/sys/arch/sandpoint/stand/altboot: skg.c

Log Message:
This driver should also support Schneider & Koch SK-9821 v2.0, besides
Marvell SKnet.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/altboot/skg.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/sandpoint/stand/altboot/skg.c
diff -u src/sys/arch/sandpoint/stand/altboot/skg.c:1.4 src/sys/arch/sandpoint/stand/altboot/skg.c:1.5
--- src/sys/arch/sandpoint/stand/altboot/skg.c:1.4	Sun Oct 30 21:08:33 2011
+++ src/sys/arch/sandpoint/stand/altboot/skg.c	Thu Aug  3 19:51:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: skg.c,v 1.4 2011/10/30 21:08:33 phx Exp $ */
+/* $NetBSD: skg.c,v 1.5 2017/08/03 19:51:00 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 Frank Wille.
@@ -193,6 +193,7 @@ skg_match(unsigned tag, void *data)
 
 	v = pcicfgread(tag, PCI_ID_REG);
 	switch (v) {
+	case PCI_DEVICE(0x1148, 0x4320):
 	case PCI_DEVICE(0x11ab, 0x4320):
 		return 1;
 	}



CVS commit: src/sys/arch/sandpoint/stand/altboot

2017-08-03 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Aug  3 19:51:00 UTC 2017

Modified Files:
src/sys/arch/sandpoint/stand/altboot: skg.c

Log Message:
This driver should also support Schneider & Koch SK-9821 v2.0, besides
Marvell SKnet.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/altboot/skg.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2017-08-03 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Aug  3 19:22:15 UTC 2017

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c siisata.c version

Log Message:
Some Synology network devices show vendor 0x1148 (Schneider & Koch) instead
of 0x11ab (Marvell). Detect both.
Improve spinning up of both disk drives on Synology DS20x by adding some
more delays (directly at the start and after powering up the second drive).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/siisata.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/altboot/version

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2017-08-03 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Aug  3 19:22:15 UTC 2017

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c siisata.c version

Log Message:
Some Synology network devices show vendor 0x1148 (Schneider & Koch) instead
of 0x11ab (Marvell). Detect both.
Improve spinning up of both disk drives on Synology DS20x by adding some
more delays (directly at the start and after powering up the second drive).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/siisata.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.38 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.39
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.38	Thu Aug  3 09:42:34 2017
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Thu Aug  3 19:22:15 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.38 2017/08/03 09:42:34 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.39 2017/08/03 19:22:15 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -269,7 +269,8 @@ brdsetup(void)
 brdtype = BRD_KUROBOXT4;
 		}
 	}
-	else if (PCI_VENDOR(pcicfgread(dev15, PCI_ID_REG)) == 0x11ab) {
+	else if (PCI_VENDOR(pcicfgread(dev15, PCI_ID_REG)) == 0x1148
+	|| PCI_VENDOR(pcicfgread(dev15, PCI_ID_REG)) == 0x11ab) {
 		/* SKnet/Marvell (sk) at dev 15 */
 		brdtype = BRD_SYNOLOGY;
 	}
@@ -873,8 +874,11 @@ synopcifix(struct brdprop *brd)
 		 * with several seconds delay, but no CPLD register to
 		 * monitor the power state. So all we can do is to
 		 * wait some more seconds during SATA-init.
+		 * Also wait some seconds now, to make sure the first
+		 * disk is ready after a cold start.
 		 */
 		sata_delay[1] = SYNO_DISK_DELAY;
+		delay(10 * 1024 * 1024);
 	}
 
   cpld_done:

Index: src/sys/arch/sandpoint/stand/altboot/siisata.c
diff -u src/sys/arch/sandpoint/stand/altboot/siisata.c:1.6 src/sys/arch/sandpoint/stand/altboot/siisata.c:1.7
--- src/sys/arch/sandpoint/stand/altboot/siisata.c:1.6	Wed Sep 30 14:14:32 2015
+++ src/sys/arch/sandpoint/stand/altboot/siisata.c	Thu Aug  3 19:22:15 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.6 2015/09/30 14:14:32 phx Exp $ */
+/* $NetBSD: siisata.c,v 1.7 2017/08/03 19:22:15 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -125,6 +125,15 @@ siisata_init(unsigned tag, void *data)
 			if (l->presense[n] == 0) {
 DPRINTF(("port %d not present\n", n));
 continue;
+			} else {
+/*
+ * XXX perform_atareset() does not work
+ * when the drive is not completely spun up?
+ * So insert another delay here.
+ */
+printf("Waiting 15 seconds for port %d "
+"to spin up.\n", n);
+delay(15 * 1000 * 1000);
 			}
 		}
 		if (atachkpwr(l, n) != ATA_PWR_ACTIVE) {

Index: src/sys/arch/sandpoint/stand/altboot/version
diff -u src/sys/arch/sandpoint/stand/altboot/version:1.8 src/sys/arch/sandpoint/stand/altboot/version:1.9
--- src/sys/arch/sandpoint/stand/altboot/version:1.8	Wed Sep 30 14:14:32 2015
+++ src/sys/arch/sandpoint/stand/altboot/version	Thu Aug  3 19:22:15 2017
@@ -18,3 +18,5 @@
 	NIC.
 1.11:	Pass precise model information and flags with bootinfo.
 	Synology DS207/209 LED and 2nd disk power-up support.
+1.12:	Some more Synology DS20x fixes, to make sure both drives have been
+	spun up. Also detect PCI-vendor 0x1148 (S) as Synology.



CVS commit: src/sys/arch/sandpoint/stand/altboot

2017-08-03 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Aug  3 09:42:34 UTC 2017

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
Fixed overflow in delay() for delays greater than 2 seconds.
Replaced u_long by uint32_t and u_quad by uint64_t whenever the exact
32- or 64-bit word is needed.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.37 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.38
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.37	Thu Oct 15 12:00:02 2015
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Thu Aug  3 09:42:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.37 2015/10/15 12:00:02 nisimura Exp $ */
+/* $NetBSD: brdsetup.c,v 1.38 2017/08/03 09:42:34 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@ static void send_iomega(int, int, int, i
 static inline uint32_t mfmsr(void);
 static inline void mtmsr(uint32_t);
 static inline uint32_t cputype(void);
-static inline u_quad_t mftb(void);
+static inline uint64_t mftb(void);
 static void init_uart(unsigned, unsigned, uint8_t);
 static void send_sat(char *);
 static unsigned mpc107memsize(void);
@@ -1012,7 +1012,7 @@ _rtt(void)
 satime_t
 getsecs(void)
 {
-	u_quad_t tb = mftb();
+	uint64_t tb = mftb();
 
 	return (tb / ticks_per_sec);
 }
@@ -1021,13 +1021,13 @@ getsecs(void)
  * Wait for about n microseconds (at least!).
  */
 void
-delay(u_int n)
+delay(unsigned n)
 {
-	u_quad_t tb;
-	u_long scratch, tbh, tbl;
+	uint64_t tb;
+	uint32_t scratch, tbh, tbl;
 
 	tb = mftb();
-	tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick;
+	tb += ((uint64_t)n * 1000 + ns_per_tick - 1) / ns_per_tick;
 	tbh = tb >> 32;
 	tbl = tb;
 	asm volatile ("1: mftbu %0; cmpw %0,%1; blt 1b; bgt 2f; mftb %0; cmpw 0, %0,%2; blt 1b; 2:" : "="(scratch) : "r"(tbh), "r"(tbl));
@@ -1113,11 +1113,11 @@ cputype(void)
 	return pvr >> 16;
 }
 
-static inline u_quad_t
+static inline uint64_t
 mftb(void)
 {
-	u_long scratch;
-	u_quad_t tb;
+	uint32_t scratch;
+	uint64_t tb;
 
 	asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw %0,%1; bne 1b"
 	: "=r"(tb), "=r"(scratch));



CVS commit: src/sys/arch/sandpoint/stand/altboot

2017-08-03 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Aug  3 09:42:34 UTC 2017

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
Fixed overflow in delay() for delays greater than 2 seconds.
Replaced u_long by uint32_t and u_quad by uint64_t whenever the exact
32- or 64-bit word is needed.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sandpoint/stand/altboot/brdsetup.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

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

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

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

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.27 src/sys/arch/sandpoint/stand/altboot/main.c:1.28
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.27	Wed Sep 30 14:14:32 2015
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Sat Jun 11 06:40:24 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.27 2015/09/30 14:14:32 phx Exp $ */
+/* $NetBSD: main.c,v 1.28 2016/06/11 06:40:24 dholland Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -643,7 +643,7 @@ static int input_cmdline(char **argv, in
 
 	printf("\nbootargs> ");
 	cmdline = alloc(256);
-	gets(cmdline);
+	kgets(cmdline, 256);
 
 	return parse_cmdline(argv, maxargc, cmdline,
 	cmdline + strlen(cmdline));
@@ -686,7 +686,7 @@ findflash(void)
 
 	for (;;) {
 		printf("\nfind> ");
-		gets(buf);
+		kgets(buf, sizeof(buf));
 		if (tolower((unsigned)buf[0]) == 'x')
 			break;
 		for (i = 0, n = 0, c = 0; buf[i]; i++) {
@@ -744,7 +744,7 @@ sat_test(void)
 		}
 
 		printf("controller> ");
-		gets(buf);
+		kgets(buf, sizeof(buf));
 		if (buf[0] == '*' && buf[1] == 'X')
 			break;
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2015-10-15 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Thu Oct 15 12:00:02 UTC 2015

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
fix a board type check logic error that affected Linkstation and Kurobox (HG).
They were mistakenly recognized kurot4 type and ended up with kernel boot
failure.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sandpoint/stand/altboot/brdsetup.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2015-10-15 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Thu Oct 15 12:00:02 UTC 2015

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
fix a board type check logic error that affected Linkstation and Kurobox (HG).
They were mistakenly recognized kurot4 type and ended up with kernel boot
failure.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.36 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.37
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.36	Wed Sep 30 14:14:32 2015
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Thu Oct 15 12:00:02 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.36 2015/09/30 14:14:32 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.37 2015/10/15 12:00:02 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -260,10 +260,14 @@ brdsetup(void)
 	}
 	else if (PCI_CLASS(pcicfgread(dev11, PCI_CLASS_REG)) == PCI_CLASS_ETH) {
 		/* ADMtek AN985 (tlp) or RealTek 8169S (re) at dev 11 */
-		if (PCI_VENDOR(pcicfgread(dev12, PCI_ID_REG)) != 0x1095)
+		if (PCI_VENDOR(pcicfgread(dev11, PCI_ID_REG)) == 0x1317)
 			brdtype = BRD_KUROBOX;
-		else
-			brdtype = BRD_KUROBOXT4;
+		else if (PCI_VENDOR(pcicfgread(dev11, PCI_ID_REG)) == 0x10ec) {
+			if (PCI_PRODUCT(pcicfgread(dev12,PCI_ID_REG)) != 0x3512)
+brdtype = BRD_KUROBOX;
+			else
+brdtype = BRD_KUROBOXT4;
+		}
 	}
 	else if (PCI_VENDOR(pcicfgread(dev15, PCI_ID_REG)) == 0x11ab) {
 		/* SKnet/Marvell (sk) at dev 15 */



CVS commit: src/sys/arch/sandpoint/stand/altboot

2015-09-29 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Sep 29 15:12:53 UTC 2015

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c globals.h

Log Message:
The disk's unittag is not equal to the channel, so we need an additional
unitchan entry to make lba_read() work in all cases.
The libsa-printf() does not seem to support 64-bit output, so cast the
block number to unsigned when printing an error message.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sandpoint/stand/altboot/globals.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/sandpoint/stand/altboot

2015-09-29 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Sep 29 15:12:53 UTC 2015

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c globals.h

Log Message:
The disk's unittag is not equal to the channel, so we need an additional
unitchan entry to make lba_read() work in all cases.
The libsa-printf() does not seem to support 64-bit output, so cast the
block number to unsigned when printing an error message.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sandpoint/stand/altboot/globals.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/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.17 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.18
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.17	Tue Aug  5 17:55:20 2014
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Tue Sep 29 15:12:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.17 2014/08/05 17:55:20 joerg Exp $ */
+/* $NetBSD: dsk.c,v 1.18 2015/09/29 15:12:52 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -125,6 +125,7 @@ disk_scan(void *drv)
 		}
 		d = [ndrive];
 		d->dvops = l;
+		d->unitchan = n;
 		d->unittag = ndrive;
 		snprintf(d->xname, sizeof(d->xname), "wd%d", d->unittag);
 		set_xfermode(l, n);
@@ -404,7 +405,7 @@ lba_read(struct disk *d, int64_t bno, in
 	int error;
 
 	l = d->dvops;
-	n = d->unittag;
+	n = d->unitchan;
 	p = (uint16_t *)buf;
 	chan = >chan[n];
 	error = 0;
@@ -414,7 +415,8 @@ lba_read(struct disk *d, int64_t bno, in
 		(*issue)(chan, bno, rdcnt);
 		for (k = 0; k < rdcnt; k++) {
 			if (spinwait_unbusy(l, n, 1000, ) == 0) {
-printf("%s blk %lld %s\n", d->xname, bno, err);
+printf("%s blk %u %s\n",
+   d->xname, (unsigned)bno, err);
 error = EIO;
 break;
 			}

Index: src/sys/arch/sandpoint/stand/altboot/globals.h
diff -u src/sys/arch/sandpoint/stand/altboot/globals.h:1.19 src/sys/arch/sandpoint/stand/altboot/globals.h:1.20
--- src/sys/arch/sandpoint/stand/altboot/globals.h:1.19	Thu Apr 26 19:59:37 2012
+++ src/sys/arch/sandpoint/stand/altboot/globals.h	Tue Sep 29 15:12:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.h,v 1.19 2012/04/26 19:59:37 phx Exp $ */
+/* $NetBSD: globals.h,v 1.20 2015/09/29 15:12:52 phx Exp $ */
 
 #ifdef DEBUG
 #define	DPRINTF(x)	printf x
@@ -172,6 +172,7 @@ NIF_DECL(stg);
 struct disk {
 	char xname[8];
 	void *dvops;
+	unsigned unitchan;
 	unsigned unittag;
 	uint16_t ident[128];
 	uint64_t nsect;



CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-08-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Aug  8 21:18:10 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
Use __unreachable().


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.34 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.35
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.34	Tue Aug  5 17:55:20 2014
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Fri Aug  8 21:18:10 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.34 2014/08/05 17:55:20 joerg Exp $ */
+/* $NetBSD: brdsetup.c,v 1.35 2014/08/08 21:18:10 joerg Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -859,7 +859,7 @@ _rtt(void)
 		asm volatile (sync; isync);
 		run(0, 0, 0, 0, (void *)0xFFF00100); /* reset entry */
 	}
-	/*NOTREACHED*/
+	__unreachable();
 }
 
 satime_t



CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-08-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Aug  8 21:18:10 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
Use __unreachable().


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sandpoint/stand/altboot/brdsetup.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-08-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Aug  5 17:55:20 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c dev_net.c dsk.c main.c
nif.c

Log Message:
Don't use non-literal strings as format strings.
XXX Switch to strlcpy.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sandpoint/stand/altboot/dev_net.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sandpoint/stand/altboot/main.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/nif.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.33 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.34
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.33	Thu Nov  7 14:51:36 2013
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Tue Aug  5 17:55:20 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.33 2013/11/07 14:51:36 nisimura Exp $ */
+/* $NetBSD: brdsetup.c,v 1.34 2014/08/05 17:55:20 joerg Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -319,11 +319,11 @@ brdsetup(void)
 	brdfixup();
 
 	bi_mem.memsize = mpc107memsize();
-	snprintf(bi_cons.devname, sizeof(bi_cons.devname), consname);
+	snprintf(bi_cons.devname, sizeof(bi_cons.devname), %s, consname);
 	bi_cons.addr = consport;
 	bi_cons.speed = brdprop-consspeed;
 	bi_clk.ticks_per_sec = ticks_per_sec;
-	snprintf(bi_fam.name, sizeof(bi_fam.name), brdprop-family);
+	snprintf(bi_fam.name, sizeof(bi_fam.name), %s, brdprop-family);
 }
 
 struct brdprop *

Index: src/sys/arch/sandpoint/stand/altboot/dev_net.c
diff -u src/sys/arch/sandpoint/stand/altboot/dev_net.c:1.2 src/sys/arch/sandpoint/stand/altboot/dev_net.c:1.3
--- src/sys/arch/sandpoint/stand/altboot/dev_net.c:1.2	Sun Jul 17 20:54:46 2011
+++ src/sys/arch/sandpoint/stand/altboot/dev_net.c	Tue Aug  5 17:55:20 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dev_net.c,v 1.2 2011/07/17 20:54:46 joerg Exp $ */
+/* $NetBSD: dev_net.c,v 1.3 2014/08/05 17:55:20 joerg Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@ net_open(struct open_file *f, ...)
 	}
 
 	if (file[0] != '\0') 
-		snprintf(bootfile, sizeof(bootfile), file);
+		snprintf(bootfile, sizeof(bootfile), %s, file);
 	else if (bootfile[0] == '\0')
 		snprintf(bootfile, sizeof(bootfile), netbsd);
 
@@ -83,7 +83,7 @@ net_open(struct open_file *f, ...)
 	 (error = nfs_mount(netdev_sock, rootip, rootpath)) != 0)
 		goto bad;
 
-	snprintf(bi_path.bootpath, sizeof(bi_path.bootpath), bootfile);
+	snprintf(bi_path.bootpath, sizeof(bi_path.bootpath), %s, bootfile);
 	f-f_devdata = netdev_sock;
 	netdev_opens++;
 	return 0;

Index: src/sys/arch/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.16 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.17
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.16	Thu Apr 26 19:59:37 2012
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Tue Aug  5 17:55:20 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.16 2012/04/26 19:59:37 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.17 2014/08/05 17:55:20 joerg Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -502,7 +502,7 @@ dsk_open(struct open_file *f, ...)
 	d-part = part;
 	f-f_devdata = d;
 
-	snprintf(bi_path.bootpath, sizeof(bi_path.bootpath), name);
+	snprintf(bi_path.bootpath, sizeof(bi_path.bootpath), %s, name);
 	if (dlp-d_partitions[part].p_fstype == FS_BSDFFS) {
 		if ((error = ffsv2_open(name, f)) == 0) {
 			fs = fs_ffsv2;

Index: src/sys/arch/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.25 src/sys/arch/sandpoint/stand/altboot/main.c:1.26
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.25	Wed Mar 26 17:35:08 2014
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Tue Aug  5 17:55:20 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.25 2014/03/26 17:35:08 christos Exp $ */
+/* $NetBSD: main.c,v 1.26 2014/08/05 17:55:20 joerg Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -525,7 +525,7 @@ module_load(const char *kernel_path)
 		if (size  bm-bm_len)
 			printf(WARNING: couldn't load);
 		else {
-			snprintf(bi-kmod, sizeof(bi-kmod), bm-bm_kmod);
+			snprintf(bi-kmod, sizeof(bi-kmod), %s, bm-bm_kmod);
 			bi-type = BI_MODULE_ELF;
 			bi-len = size;
 			bi-base = kmodloadp;

Index: src/sys/arch/sandpoint/stand/altboot/nif.c
diff -u src/sys/arch/sandpoint/stand/altboot/nif.c:1.5 src/sys/arch/sandpoint/stand/altboot/nif.c:1.6
--- src/sys/arch/sandpoint/stand/altboot/nif.c:1.5	Sat Mar 12 16:41:23 2011
+++ src/sys/arch/sandpoint/stand/altboot/nif.c	Tue Aug  5 17:55:20 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: nif.c,v 1.5 2011/03/12 16:41:23 phx Exp $ */
+/* $NetBSD: nif.c,v 1.6 

CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-03-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Mar 22 18:54:28 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
drop trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.23 src/sys/arch/sandpoint/stand/altboot/main.c:1.24
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.23	Sun Jan  5 21:10:50 2014
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Sat Mar 22 18:54:28 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.23 2014/01/05 21:10:50 jakllsch Exp $ */
+/* $NetBSD: main.c,v 1.24 2014/03/22 18:54:28 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -430,8 +430,8 @@ module_add(const char *name)
 
 	bm = alloc(sizeof(struct boot_module) + strlen(name) + 1);
 	if (bm == NULL) {
-		printf(couldn't allocate module %s\n, name); 
-		return; 
+		printf(couldn't allocate module %s\n, name);
+		return;
 	}
 
 	bm-bm_kmod = (char *)(bm + 1);
@@ -451,12 +451,12 @@ module_add(const char *name)
 #define alignpg(x)	(((x)+PAGE_SIZE-1)  ~(PAGE_SIZE-1))
 
 void
-module_load(const char *kernel_path) 
+module_load(const char *kernel_path)
 {
 	struct boot_module *bm;
 	struct bi_modulelist_entry *bi;
 	struct stat st;
-	char *p; 
+	char *p;
 	int size, fd;
 
 	strcpy(module_base, kernel_path);
@@ -496,7 +496,7 @@ module_load(const char *kernel_path) 
 		}
 		bm-bm_len = (int)st.st_size;
 		close(fd);
-		size += sizeof(struct bi_modulelist_entry); 
+		size += sizeof(struct bi_modulelist_entry);
 	}
 	if (size == 0)
 		return;



CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-03-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Mar 22 18:54:28 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
drop trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-01-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  5 21:09:33 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: devopen.c

Log Message:
Drop duplicate and unused extern global variable.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/devopen.c
diff -u src/sys/arch/sandpoint/stand/altboot/devopen.c:1.2 src/sys/arch/sandpoint/stand/altboot/devopen.c:1.3
--- src/sys/arch/sandpoint/stand/altboot/devopen.c:1.2	Sun Mar  6 18:22:13 2011
+++ src/sys/arch/sandpoint/stand/altboot/devopen.c	Sun Jan  5 21:09:33 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.2 2011/03/06 18:22:13 phx Exp $ */
+/* $NetBSD: devopen.c,v 1.3 2014/01/05 21:09:33 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -52,7 +52,6 @@ struct fs_ops fs_tftp  = FS_OPS(tftp);
 struct fs_ops fs_ffsv2 = FS_OPS(ffsv2);
 struct fs_ops fs_ffsv1 = FS_OPS(ffsv1);
 struct fs_ops fs_mem   = FS_OPS(mem);
-extern char *fsmod;
 
 static void parseunit(const char *, int *, int *, char **);
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-01-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  5 21:10:50 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
sprinkle const


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.22 src/sys/arch/sandpoint/stand/altboot/main.c:1.23
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.22	Tue Dec 25 17:02:35 2012
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Sun Jan  5 21:10:50 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.22 2012/12/25 17:02:35 phx Exp $ */
+/* $NetBSD: main.c,v 1.23 2014/01/05 21:10:50 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -88,8 +88,8 @@ char module_base[80];
 uint32_t kmodloadp;
 int modules_enabled = 0;
 
-void module_add(char *);
-void module_load(char *);
+void module_add(const char *);
+void module_load(const char *);
 int module_open(struct boot_module *);
 
 void main(int, char **, char *, char *);
@@ -421,7 +421,7 @@ bi_add(void *new, int type, int size)
 }
 
 void
-module_add(char *name)
+module_add(const char *name)
 {
 	struct boot_module *bm, *bmp;
 
@@ -451,7 +451,7 @@ module_add(char *name)
 #define alignpg(x)	(((x)+PAGE_SIZE-1)  ~(PAGE_SIZE-1))
 
 void
-module_load(char *kernel_path) 
+module_load(const char *kernel_path) 
 {
 	struct boot_module *bm;
 	struct bi_modulelist_entry *bi;



CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-01-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  5 21:09:33 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: devopen.c

Log Message:
Drop duplicate and unused extern global variable.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sandpoint/stand/altboot/devopen.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2014-01-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  5 21:10:50 UTC 2014

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
sprinkle const


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2013-11-07 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Thu Nov  7 14:51:36 UTC 2013

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
shut off gcc 4.8 unused variable warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.32 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.33
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.32	Tue Dec 25 17:07:06 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Thu Nov  7 14:51:36 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.32 2012/12/25 17:07:06 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.33 2013/11/07 14:51:36 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -446,6 +446,9 @@ encbrdfix(struct brdprop *brd)
 	val = pcicfgread(ac97, 0x3c) ~ 0xff;
 	val |= 5;
 	pcicfgwrite(ac97, 0x3c, val);
+
+	(void) pcicfgread(ide, 0x08);
+	(void) pcicfgread(pmgt, 0x08);
 }
 
 void



CVS commit: src/sys/arch/sandpoint/stand/altboot

2013-11-07 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Thu Nov  7 14:51:36 UTC 2013

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
shut off gcc 4.8 unused variable warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sandpoint/stand/altboot/brdsetup.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2013-09-15 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Sep 15 18:22:57 UTC 2013

Modified Files:
src/sys/arch/sandpoint/stand/altboot: version

Log Message:
New version can read the MAC address for QNAP systems from flash.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/version
diff -u src/sys/arch/sandpoint/stand/altboot/version:1.6 src/sys/arch/sandpoint/stand/altboot/version:1.7
--- src/sys/arch/sandpoint/stand/altboot/version:1.6	Sun Jan 22 13:08:17 2012
+++ src/sys/arch/sandpoint/stand/altboot/version	Sun Sep 15 18:22:57 2013
@@ -14,3 +14,5 @@
 1.9:	Support PATA drive configuration option. Wait until drives are
 ready after cold-start. Wake up drives from standby mode.
 A default command line can be saved to flash as initrd image.
+1.10:	Read correct MAC address from flash on QNAP-TS systems with re(4)
+	NIC.



CVS commit: src/sys/arch/sandpoint/stand/altboot

2013-09-15 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Sep 15 18:22:57 UTC 2013

Modified Files:
src/sys/arch/sandpoint/stand/altboot: version

Log Message:
New version can read the MAC address for QNAP systems from flash.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/version

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2013-08-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 21 06:44:02 UTC 2013

Modified Files:
src/sys/arch/sandpoint/stand/altboot: Makefile

Log Message:
Use bsd.klinks.mk


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/Makefile
diff -u src/sys/arch/sandpoint/stand/altboot/Makefile:1.12 src/sys/arch/sandpoint/stand/altboot/Makefile:1.13
--- src/sys/arch/sandpoint/stand/altboot/Makefile:1.12	Sun Oct 30 20:42:09 2011
+++ src/sys/arch/sandpoint/stand/altboot/Makefile	Wed Aug 21 06:44:02 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2011/10/30 20:42:09 phx Exp $
+#	$NetBSD: Makefile,v 1.13 2013/08/21 06:44:02 matt Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -19,6 +19,7 @@ CPPFLAGS+=	-nostdinc -I. -I${.OBJDIR} -I
 DBG=		-Os
 
 .include bsd.own.mk
+.include bsd.klinks.mk
 
 # XXX SHOULD NOT NEED TO DEFINE THESE!
 LIBCRT0=
@@ -32,14 +33,6 @@ BINMODE=	444
 RELOC=		100
 ENTRY=		_start
 
-.if !make(obj)  !make(clean)  !make(cleandir)
-.BEGIN:
-	@[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
-	@[ -h powerpc ] || ln -s ${S}/arch/powerpc/include powerpc
-.NOPATH: machine powerpc
-.endif
-CLEANFILES+= machine powerpc
-
 ### find out what to use for libkern
 KERN_AS=	library
 .include ${S}/lib/libkern/Makefile.inc
@@ -62,6 +55,7 @@ vers.c: version
 	${${MKREPRO} == yes :?:-D} ${.CURDIR}/version sandpoint
 
 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
+	${_MKTARGET_LINK}
 	${LD} -N -Ttext ${RELOC} -Bstatic -e ${ENTRY} -o ${PROG} \
 	${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${OBJCOPY} -S -O binary ${PROG} ${PROG}.bin



CVS commit: src/sys/arch/sandpoint/stand/altboot

2013-08-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 21 06:44:02 UTC 2013

Modified Files:
src/sys/arch/sandpoint/stand/altboot: Makefile

Log Message:
Use bsd.klinks.mk


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

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-12-25 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Dec 25 17:02:35 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Add a DEBUG function to search the Flash for byte-streams, as U-Boot usually
doesn't offer a search function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.21 src/sys/arch/sandpoint/stand/altboot/main.c:1.22
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.21	Mon May 21 21:34:16 2012
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Tue Dec 25 17:02:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.21 2012/05/21 21:34:16 dsl Exp $ */
+/* $NetBSD: main.c,v 1.22 2012/12/25 17:02:35 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -111,6 +111,7 @@ static int parse_cmdline(char **, int, c
 static int is_space(char);
 #ifdef DEBUG
 static void sat_test(void);
+static void findflash(void);
 #endif
 
 #define	BNAME_DEFAULT wd0:
@@ -236,12 +237,21 @@ main(int argc, char *argv[], char *boota
 			n / 100);
 		if (tstchar()) {
 #ifdef DEBUG
-			if (toupper(getchar()) == 'C') {
+			unsigned c;
+
+			c = toupper(getchar());
+			if (c == 'C') {
 /* controller test terminal */
 sat_test();
 n = 200;
 continue;
 			}
+			else if (c == 'F') {
+/* find strings in Flash ROM */
+findflash();
+n = 200;
+continue;
+			}
 #else
 			(void)getchar();
 #endif
@@ -665,6 +675,40 @@ is_space(char c)
 
 #ifdef DEBUG
 static void
+findflash(void)
+{
+	char buf[256];
+	int i, n;
+	unsigned char c, *p;
+
+	for (;;) {
+		printf(\nfind );
+		gets(buf);
+		if (tolower((unsigned)buf[0]) == 'x')
+			break;
+		for (i = 0, n = 0, c = 0; buf[i]; i++) {
+			c = 4;
+			c |= hex2nibble(buf[i]);
+			if (i  1)
+buf[n++] = c;
+		}
+		printf(Searching for:);
+		for (i = 0; i  n; i++)
+			printf( %02x, buf[i]);
+		printf(\n);
+		for (p = (unsigned char *)0xff00;
+		 p = (unsigned char *)(0x-n); p++) {
+			for (i = 0; i  n; i++) {
+if (p[i] != buf[i])
+	break;
+			}
+			if (i = n)
+printf(Found at %08x\n, (unsigned)p);
+		}
+	}
+}
+
+static void
 sat_test(void)
 {
 	char buf[1024];



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-12-25 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Dec 25 17:07:07 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c rge.c

Log Message:
QNAP V200 boards have no EEPROM for the MAC address, so all devices default
to the same address (00:e0:4c:69:20:01).
Now we read the real MAC address from the flash ROM. It is stored at the
beginning of a 512-byte block in ASCII format. Some QNAP's have a broken
ext2 file system, so we cannot look for the file ETH0.MAC_ADDR therein,
but have to search the whole flash in 512-byte steps for candidates...


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/rge.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.31 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.32
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.31	Mon Apr 16 16:55:29 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Tue Dec 25 17:07:06 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.31 2012/04/16 16:55:29 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.32 2012/12/25 17:07:06 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -1254,6 +1254,41 @@ read_mac_string(uint8_t *mac, char *p)
 }
 
 /*
+ * Scan through the Flash memory and look for a string starting at 512 bytes
+ * block boundaries, matching the format: xx:xx:xx:xx:xx:xxNUL, where x
+ * are hexadecimal digits.
+ * Read the first match as our MAC address.
+ * The start address of the search, p, *must* be dividable by 512!
+ * Return false when no suitable MAC string was found.
+ */
+static int
+find_mac_string(uint8_t *mac, char *p)
+{
+	int i;
+
+	for (;;) {
+		for (i = 0; i  3 * 6; i += 3) {
+			if (!isxdigit((unsigned)p[i]) ||
+			!isxdigit((unsigned)p[i + 1]))
+break;
+			if ((i  5  p[i + 2] != ':') ||
+			(i = 5  p[i + 2] != '\0'))
+break;
+		}
+		if (i = 6) {
+			/* found a valid MAC address */
+			read_mac_string(mac, p);
+			return 1;
+		}
+		if (p = (char *)0xfe00)
+			break;
+		p += 0x200;
+	}
+	return 0;
+}
+
+
+/*
  * For cost saving reasons some NAS boxes lack SEEPROM for NIC's
  * ethernet address and keep it in their Flash memory instead.
  */
@@ -1272,6 +1307,10 @@ read_mac_from_flash(uint8_t *mac)
 	case BRD_DLINKDSM:
 		read_mac_string(mac, (char *)0xfff0ff80);
 		return;
+	case BRD_QNAPTS:
+		if (find_mac_string(mac, (char *)0xfff0))
+			return;
+		break;
 	default:
 		printf(Warning: This board has no known method defined 
 		to determine its MAC address!\n);

Index: src/sys/arch/sandpoint/stand/altboot/rge.c
diff -u src/sys/arch/sandpoint/stand/altboot/rge.c:1.6 src/sys/arch/sandpoint/stand/altboot/rge.c:1.7
--- src/sys/arch/sandpoint/stand/altboot/rge.c:1.6	Sun Oct 30 21:08:33 2011
+++ src/sys/arch/sandpoint/stand/altboot/rge.c	Tue Dec 25 17:07:06 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: rge.c,v 1.6 2011/10/30 21:08:33 phx Exp $ */
+/* $NetBSD: rge.c,v 1.7 2012/12/25 17:07:06 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -102,6 +102,9 @@ struct desc {
 #define	 RCR_AM		(1U  2)	/* accept multicast frame */
 #define	 RCR_APM	(1U  1)	/* accept unicast frame */
 #define	 RCR_AAP	(1U  0)	/* promiscuous */
+#define RGE_EECMD	0x50		/* EEPROM command register */
+#define  EECMD_LOCK	0x00
+#define  EECMD_UNLOCK	0xc0
 #define RGE_PHYAR	0x60		/* PHY access */
 #define RGE_PHYSR	0x6c		/* PHY status */
 #define RGE_RMS		0xda		/* Rx maximum frame size */
@@ -146,7 +149,8 @@ rge_init(unsigned tag, void *data)
 	unsigned val;
 	struct local *l;
 	struct desc *txd, *rxd;
-	uint8_t *en = data;
+	uint32_t reg;
+	uint8_t *en;
 
 	l = ALLOC(struct local, 256);	/* desc alignment */
 	memset(l, 0, sizeof(struct local));
@@ -158,14 +162,27 @@ rge_init(unsigned tag, void *data)
 	} while (val  CR_RESET);
 
 	mii_initphy(l);
-
 	en = data;
-	en[0] = CSR_READ_1(l, RGE_IDR0);
-	en[1] = CSR_READ_1(l, RGE_IDR1);
-	en[2] = CSR_READ_1(l, RGE_IDR2);
-	en[3] = CSR_READ_1(l, RGE_IDR3);
-	en[4] = CSR_READ_1(l, RGE_IDR4);
-	en[5] = CSR_READ_1(l, RGE_IDR5);
+
+	if (brdtype == BRD_QNAPTS) {
+		/* read the MAC from flash and write it into the ID-Regs */
+		read_mac_from_flash(en);
+
+		CSR_WRITE_1(l, RGE_EECMD, EECMD_UNLOCK);
+		reg = en[0] | (en[1]  8) | (en[2]  16) | (en[3]  24);
+		CSR_WRITE_4(l, RGE_IDR0, reg);
+		reg = en[4] | (en[5]  8);
+		CSR_WRITE_4(l, RGE_IDR4, reg);
+		CSR_WRITE_1(l, RGE_EECMD, EECMD_LOCK);
+	} else {
+		/* pretent the ID-Regs have the correct address */
+		en[0] = CSR_READ_1(l, RGE_IDR0);
+		en[1] = CSR_READ_1(l, RGE_IDR1);
+		en[2] = CSR_READ_1(l, RGE_IDR2);
+		en[3] = CSR_READ_1(l, RGE_IDR3);
+		en[4] = CSR_READ_1(l, RGE_IDR4);
+		en[5] = CSR_READ_1(l, RGE_IDR5);
+	}
 
 	printf(MAC address 

CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-12-25 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Dec 25 17:02:35 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Add a DEBUG function to search the Flash for byte-streams, as U-Boot usually
doesn't offer a search function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-12-25 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Dec 25 17:07:07 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c rge.c

Log Message:
QNAP V200 boards have no EEPROM for the MAC address, so all devices default
to the same address (00:e0:4c:69:20:01).
Now we read the real MAC address from the flash ROM. It is stored at the
beginning of a 512-byte block in ASCII format. Some QNAP's have a broken
ext2 file system, so we cannot look for the file ETH0.MAC_ADDR therein,
but have to search the whole flash in 512-byte steps for candidates...


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/rge.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-26 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Apr 26 19:59:37 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot dsk.c globals.h
main.c

Log Message:
Multiple boot devices and/or paths may be specified, which are booted one
after another until success. When no boot device is specified altboot tries
to boot from all disk devices with a valid NetBSD disklabel, starting with
unit 0.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/arch/sandpoint/stand/altboot/README.altboot
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/globals.h \
src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/README.altboot
diff -u src/sys/arch/sandpoint/stand/altboot/README.altboot:1.10 src/sys/arch/sandpoint/stand/altboot/README.altboot:1.11
--- src/sys/arch/sandpoint/stand/altboot/README.altboot:1.10	Tue Apr 24 14:56:07 2012
+++ src/sys/arch/sandpoint/stand/altboot/README.altboot	Thu Apr 26 19:59:36 2012
@@ -1,6 +1,6 @@
 /// notes about altboot ///
 
-$NetBSD: README.altboot,v 1.10 2012/04/24 14:56:07 nisimura Exp $
+$NetBSD: README.altboot,v 1.11 2012/04/26 19:59:36 phx Exp $
 
 Altboot is a functional bridge to fill the gap between a NAS product
 custom bootloader and the NetBSD kernel startup environment.  Altboot
@@ -61,11 +61,11 @@ that the original U-Boot/PPCboot still r
 as a functional extension for them.
 
 In case the firmware was crippled by the vendor so that it only boots
-Linux U-Boot images (D-Link), you can still use altboot by uploading
-altboot.img instead of the Linux kernel.
+Linux U-Boot images (D-Link, Synology 2007), you can still use altboot by
+overwriting the Linux kernel with altboot.img.
 
 Altboot passes the following bootinfo records to the NetBSD/sandpoint
-kernel.
+kernel:
 - processor clock tick value driving MPC8241/8245.
 - serial console selection.
 - booted kernel filename and which device it was fetched from.
@@ -104,7 +104,12 @@ restarts itself. Mainly useful for altbo
 Multiple arguments may be specified at once, although not all combinations
 make sense. The format of an altboot command line is:
 
-  [[bootargs ...] devicename:[bootfile]]
+  [[bootargs ...] devicename:[bootfile] ...]
+
+Multiple boot devices and/or paths may be specified, which are booted one
+after another until success. When no boot device is specified altboot tries
+to boot from all disk devices with a valid NetBSD disklabel, starting with
+unit 0.
 
 The following device names are supported:
 - tftp			boot from TFTP (address retrieved by DHCP)

Index: src/sys/arch/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.15 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.16
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.15	Mon Apr  9 12:40:55 2012
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Thu Apr 26 19:59:37 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.15 2012/04/09 12:40:55 nisimura Exp $ */
+/* $NetBSD: dsk.c,v 1.16 2012/04/26 19:59:37 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -83,7 +83,6 @@ static void issue48(struct dvata_chan *,
 static void issue28(struct dvata_chan *, int64_t, int);
 static struct disk *lookup_disk(int);
 
-#define MAX_UNITS 8
 static struct disk ldisk[MAX_UNITS];
 
 int
@@ -462,7 +461,18 @@ static struct disk *
 lookup_disk(int unit)
 {
 
-	return ldisk[unit];
+	return (unit = 0  unit  MAX_UNITS) ? ldisk[unit] : NULL;
+}
+
+int
+dlabel_valid(int unit)
+{
+	struct disk *dsk;
+
+	dsk = lookup_disk(unit);
+	if (dsk == NULL)
+		return NULL;
+	return dsk-dlabel != NULL;
 }
 
 int
@@ -487,10 +497,10 @@ dsk_open(struct open_file *f, ...)
 
 	if ((d = lookup_disk(unit)) == NULL)
 		return ENXIO;
-	f-f_devdata = d;
 	if ((dlp = d-dlabel) == NULL || part = dlp-d_npartitions)
 		return ENXIO;
 	d-part = part;
+	f-f_devdata = d;
 
 	snprintf(bi_path.bootpath, sizeof(bi_path.bootpath), name);
 	if (dlp-d_partitions[part].p_fstype == FS_BSDFFS) {

Index: src/sys/arch/sandpoint/stand/altboot/globals.h
diff -u src/sys/arch/sandpoint/stand/altboot/globals.h:1.18 src/sys/arch/sandpoint/stand/altboot/globals.h:1.19
--- src/sys/arch/sandpoint/stand/altboot/globals.h:1.18	Mon Apr 16 16:55:29 2012
+++ src/sys/arch/sandpoint/stand/altboot/globals.h	Thu Apr 26 19:59:37 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.h,v 1.18 2012/04/16 16:55:29 phx Exp $ */
+/* $NetBSD: globals.h,v 1.19 2012/04/26 19:59:37 phx Exp $ */
 
 #ifdef DEBUG
 #define	DPRINTF(x)	printf x
@@ -167,8 +167,23 @@ NIF_DECL(skg);
 NIF_DECL(stg);
 
 /* DSK support */
-int dskdv_init(void *);
+#define MAX_UNITS 4
+
+struct disk {
+	char xname[8];
+	void *dvops;
+	unsigned unittag;
+	uint16_t ident[128];
+	uint64_t nsect;
+	uint64_t first;
+	void *dlabel;
+	

CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-26 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Fri Apr 27 00:35:43 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Comment improvement. altboot(8) is now aware of the disk removal
for mirrored drive configuration.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.19 src/sys/arch/sandpoint/stand/altboot/main.c:1.20
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.19	Thu Apr 26 19:59:37 2012
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Fri Apr 27 00:35:43 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.19 2012/04/26 19:59:37 phx Exp $ */
+/* $NetBSD: main.c,v 1.20 2012/04/27 00:35:43 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -272,11 +272,11 @@ main(int argc, char *argv[], char *boota
 			break;	/* break on first unknown string */
 	}
 
+	/*
+	 * If no device name is given, we construct a list of drives
+	 * which have valid disklabels.
+	 */
 	if (n = argc) {
-		/*
-		 * If no device name is given we construct a list of drives
-		 * which have valid disklabels.
-		 */
 		n = 0;
 		argc = 0;
 		argv = alloc(MAX_UNITS * (sizeof(char *) + sizeof(wdN:)));
@@ -295,6 +295,7 @@ main(int argc, char *argv[], char *boota
 		}
 	}
 
+	/* try to boot off kernel from the drive list */
 	while (n  argc) {
 		bname = argv[n++];
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-26 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Apr 26 19:59:37 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot dsk.c globals.h
main.c

Log Message:
Multiple boot devices and/or paths may be specified, which are booted one
after another until success. When no boot device is specified altboot tries
to boot from all disk devices with a valid NetBSD disklabel, starting with
unit 0.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/arch/sandpoint/stand/altboot/README.altboot
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/globals.h \
src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-26 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Fri Apr 27 00:35:43 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Comment improvement. altboot(8) is now aware of the disk removal
for mirrored drive configuration.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-24 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Apr 24 14:56:07 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot

Log Message:
Add KURO-BOX/T4 vendor custom U-Boot version message.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sandpoint/stand/altboot/README.altboot

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/sandpoint/stand/altboot/README.altboot
diff -u src/sys/arch/sandpoint/stand/altboot/README.altboot:1.9 src/sys/arch/sandpoint/stand/altboot/README.altboot:1.10
--- src/sys/arch/sandpoint/stand/altboot/README.altboot:1.9	Sat Jan 14 22:36:54 2012
+++ src/sys/arch/sandpoint/stand/altboot/README.altboot	Tue Apr 24 14:56:07 2012
@@ -1,6 +1,6 @@
 /// notes about altboot ///
 
-$NetBSD: README.altboot,v 1.9 2012/01/14 22:36:54 phx Exp $
+$NetBSD: README.altboot,v 1.10 2012/04/24 14:56:07 nisimura Exp $
 
 Altboot is a functional bridge to fill the gap between a NAS product
 custom bootloader and the NetBSD kernel startup environment.  Altboot
@@ -48,6 +48,10 @@ Altboot is known working on at least the
 
PPCBoot 2.0.0-A9 (Feb 13 2006 - 14:56:11)
 
+- KURO-BOX/T4 vendor custom U-Boot
+
+   U-Boot 2009.06-BUFFALO-svn1376 (Jul 11 2009 - 04:11:01) KURO-NAS/T4
+
 The standard use of altboot is to invoke it with a short script from
 U-Boot/PPCboot, where the altboot.bin image is stored in an unoccupied 128KB
 section of the target's HW NOR flash.  Combined with standard



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-24 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Apr 24 14:56:07 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot

Log Message:
Add KURO-BOX/T4 vendor custom U-Boot version message.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sandpoint/stand/altboot/README.altboot

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-16 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Mon Apr 16 16:55:29 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c globals.h main.c

Log Message:
Improved Synology CS/RS support: watch power-state of all SATA drives before
initializing them, configure drive LEDs to reflect SATA activity.
Configure drives on all ATA PCI devices, not only on the first one.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sandpoint/stand/altboot/globals.h \
src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.30 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.31
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.30	Mon Apr  9 14:02:04 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Mon Apr 16 16:55:29 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.30 2012/04/09 14:02:04 nisimura Exp $ */
+/* $NetBSD: brdsetup.c,v 1.31 2012/04/16 16:55:29 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -46,6 +46,7 @@
 void xxx ## setup(struct brdprop *); \
 void xxx ## brdfix(struct brdprop *); \
 void xxx ## pcifix(struct brdprop *); \
+void xxx ## launch(struct brdprop *); \
 void xxx ## reset(void)
 
 BRD_DECL(mot);
@@ -119,28 +120,28 @@ static struct brdprop brdlist[] = {
 	BRD_SANDPOINTX3,
 	0,
 	com, 0x3f8, 115200,
-	motsetup, motbrdfix, motpcifix, NULL },
+	motsetup, motbrdfix, motpcifix, NULL, NULL },
 {
 	encpp1,
 	EnCore PP1,
 	BRD_ENCOREPP1,
 	0,
 	com, 0x3f8, 115200,
-	encsetup, encbrdfix, encpcifix, NULL },
+	encsetup, encbrdfix, encpcifix, NULL, NULL },
 {
 	kurobox,
 	KuroBox,
 	BRD_KUROBOX,
 	0,
 	eumb, 0x4600, 57600,
-	kurosetup, kurobrdfix, NULL, kuroreset },
+	kurosetup, kurobrdfix, NULL, NULL, kuroreset },
 {
 	synology,
-	Synology DS,
+	Synology CS/DS/RS,
 	BRD_SYNOLOGY,
 	0,
 	eumb, 0x4500, 115200,
-	synosetup, synobrdfix, NULL, synoreset },
+	synosetup, synobrdfix, synopcifix, synolaunch, synoreset },
 {
 	qnap,
 	QNAP TS,
@@ -148,42 +149,42 @@ static struct brdprop brdlist[] = {
 	33164691,	/* Linux source says 3300, but the Synology  */
 			/* clock value delivers a much better precision. */
 	eumb, 0x4500, 115200,
-	NULL, qnapbrdfix, NULL, qnapreset },
+	NULL, qnapbrdfix, NULL, NULL, qnapreset },
 {
 	iomega,
 	IOMEGA StorCenter G2,
 	BRD_STORCENTER,
 	0,
 	eumb, 0x4500, 115200,
-	NULL, iomegabrdfix, NULL, iomegareset },
+	NULL, iomegabrdfix, NULL, NULL, iomegareset },
 {
 	dlink,
 	D-Link DSM-G600,
 	BRD_DLINKDSM,
 	3300,
 	eumb, 0x4500, 9600,
-	NULL, dlinkbrdfix, NULL, NULL },
+	NULL, dlinkbrdfix, NULL, NULL, NULL },
 {
 	nhnas,
 	Netronix NH-230/231,
 	BRD_NH230NAS,
 	3300,
 	eumb, 0x4500, 9600,
-	NULL, nhnasbrdfix, NULL, nhnasreset },
+	NULL, nhnasbrdfix, NULL, NULL, nhnasreset },
 {
 	kurot4,
 	KuroBox/T4,
 	BRD_KUROBOXT4,
 	32768000,
 	eumb, 0x4600, 57600,
-	NULL, kurot4brdfix, NULL, NULL },
+	NULL, kurot4brdfix, NULL, NULL, NULL },
 {
 	unknown,
 	Unknown board,
 	BRD_UNKNOWN,
 	0,
 	eumb, 0x4500, 115200,
-	NULL, NULL, NULL, NULL }, /* must be the last */
+	NULL, NULL, NULL, NULL, NULL }, /* must be the last */
 };
 
 static struct brdprop *brdprop;
@@ -365,6 +366,15 @@ pcifixup()
 }
 
 void
+launchfixup()
+{
+
+	if (brdprop-launch == NULL)
+		return;
+	(*brdprop-launch)(brdprop);
+}
+
+void
 encsetup(struct brdprop *brd)
 {
 
@@ -707,6 +717,50 @@ synobrdfix(struct brdprop *brd)
 }
 
 void
+synopcifix(struct brdprop *brd)
+{
+	static const char csmodel[4][7] = {
+		CS406e, CS406, RS406, CS407e
+	};
+	volatile uint8_t *cpld = (volatile uint8_t *)0xff00;
+	uint8_t pwrstate;
+
+	if (nata  1) {
+		/*
+		 * CS/RS stations power-up their disks one after another.
+		 * We have to watch over the current power state in a CPLD
+		 * register, until all disks become available.
+		 */
+		printf(CPLD V1.%d for model %s\n, cpld[2]  3,
+		csmodel[(cpld[2]  0x0c)  2]);
+		cpld[0] = 0x00; /* all drive LEDs blinking yellow */
+		do {
+			delay(1000 * 1000);
+			pwrstate = cpld[1];
+			printf(Power state: %02x\r, pwrstate);
+		} while (pwrstate != 0xff);
+		putchar('\n');
+	}
+}
+
+void
+synolaunch(struct brdprop *brd)
+{
+	volatile uint8_t *cpld = (volatile uint8_t *)0xff00;
+	struct dkdev_ata *sata1, *sata2;
+
+	if (nata  1) {
+		/* enable drive LEDs for active disk drives on CS/RS models */
+		sata1 = lata[0].drv;
+		sata2 = lata[1].drv;
+		cpld[0] = (sata1-presense[0] ? 0x80 : 0xc0) |
+		(sata1-presense[1] ? 0x20 : 0x30) |
+		(sata2-presense[0] ? 0x08 : 0x0c) |
+		(sata2-presense[1] ? 0x02 : 0x03);
+	}
+}
+
+void
 synoreset()
 {
 

Index: src/sys/arch/sandpoint/stand/altboot/globals.h
diff -u 

CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-16 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Mon Apr 16 16:55:29 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c globals.h main.c

Log Message:
Improved Synology CS/RS support: watch power-state of all SATA drives before
initializing them, configure drive LEDs to reflect SATA activity.
Configure drives on all ATA PCI devices, not only on the first one.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sandpoint/stand/altboot/globals.h \
src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-09 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Apr  9 12:40:56 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Refactor disklabel decode logic.  RAIDFRAME case needs more attention
as it's not certain whether a general solution.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sandpoint/stand/altboot/dsk.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/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.14 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.15
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.14	Sun Jan 22 13:16:54 2012
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Mon Apr  9 12:40:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.14 2012/01/22 13:16:54 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.15 2012/04/09 12:40:55 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -77,6 +77,7 @@ static void drive_ident(struct disk *, c
 static char *mkident(char *, int);
 static void set_xfermode(struct dkdev_ata *, int);
 static void decode_dlabel(struct disk *, char *);
+static struct disklabel *search_dmagic(char *);
 static int lba_read(struct disk *, int64_t, int, void *);
 static void issue48(struct dvata_chan *, int64_t, int);
 static void issue28(struct dvata_chan *, int64_t, int);
@@ -306,7 +307,6 @@ decode_dlabel(struct disk *d, char *iobu
 struct mbr_partition *mp, *bsdp;
 	struct disklabel *dlp;
 	struct partition *pp;
-	char *dp;
 	int i, first, rf_offset;
 
 	bsdp = NULL;
@@ -324,39 +324,26 @@ decode_dlabel(struct disk *d, char *iobu
 	rf_offset = 0;
 	first = (bsdp) ? bswap32(bsdp-mbrp_start) : 0;
 	(*d-lba_read)(d, first + LABELSECTOR, 1, iobuf);
-	dp = iobuf /* + LABELOFFSET */;
-	for (i = 0; i  512 - sizeof(struct disklabel); i++, dp += 4) {
-		dlp = (struct disklabel *)dp;
-		if (dlp-d_magic == DISKMAGIC  dlp-d_magic2 == DISKMAGIC) {
-			if (dlp-d_partitions[0].p_fstype == FS_RAID) {
-printf(%s%c: raid\n, d-xname, i + 'a');
-snprintf(d-xname, sizeof(d-xname), raid.);
-rf_offset = dlp-d_partitions[0].p_offset +
-RF_PROTECTED_SECTORS;
-(*d-lba_read)(d, rf_offset + LABELSECTOR, 1,
-iobuf);
-dp = iobuf /* + LABELOFFSET */;
-for (i = 0; i  512 - sizeof(struct disklabel); i++, dp += 4) {
-	dlp = (struct disklabel *)dp;
-	if (dlp-d_magic == DISKMAGIC 
-	dlp-d_magic2 == DISKMAGIC)
-		goto found;
-}
-			} else	/* Not RAID */
-goto found;
-		}
+	dlp = search_dmagic(iobuf);
+	if (dlp == NULL)
+		goto notfound;
+	if (dlp-d_partitions[0].p_fstype == FS_RAID) {
+		printf(%s%c: raid\n, d-xname, 0 + 'a');
+		snprintf(d-xname, sizeof(d-xname), raid.);
+		rf_offset
+		= dlp-d_partitions[0].p_offset + RF_PROTECTED_SECTORS;
+		(*d-lba_read)(d, rf_offset + LABELSECTOR, 1, iobuf);
+		dlp = search_dmagic(iobuf);
+		if (dlp == NULL)
+			goto notfound;
 	}
-	d-dlabel = NULL;
-	printf(%s: no disklabel\n, d-xname);
-	return;
-  found:
 	for (i = 0; i  dlp-d_npartitions; i += 1) {
 		const char *type;
 		pp = dlp-d_partitions[i];
 		pp-p_offset += rf_offset;
 		type = NULL;
 		switch (pp-p_fstype) {
-		case FS_SWAP: /* swap */
+		case FS_SWAP:
 			type = swap;
 			break;
 		case FS_BSDFFS:
@@ -372,6 +359,25 @@ decode_dlabel(struct disk *d, char *iobu
 	}
 	d-dlabel = allocaligned(sizeof(struct disklabel), 4);
 	memcpy(d-dlabel, dlp, sizeof(struct disklabel));
+	return;
+  notfound:
+	d-dlabel = NULL;
+	printf(%s: no disklabel\n, d-xname);
+	return;
+}
+
+struct disklabel *
+search_dmagic(char *dp)
+{
+	int i;
+	struct disklabel *dlp;
+
+	for (i = 0; i  512 - sizeof(struct disklabel); i += 4, dp += 4) {
+		dlp = (struct disklabel *)dp;
+		if (dlp-d_magic == DISKMAGIC  dlp-d_magic2 == DISKMAGIC)
+			return dlp;
+	}
+	return NULL;
 }
 
 static void



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-09 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Apr  9 14:02:04 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
The processor ExtClk value of Kurobox/T4 is comfirmed as 32768000.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.29 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.30
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.29	Mon Apr  9 13:26:37 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Mon Apr  9 14:02:04 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.29 2012/04/09 13:26:37 nisimura Exp $ */
+/* $NetBSD: brdsetup.c,v 1.30 2012/04/09 14:02:04 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -174,9 +174,9 @@ static struct brdprop brdlist[] = {
 	kurot4,
 	KuroBox/T4,
 	BRD_KUROBOXT4,
-	0,
+	32768000,
 	eumb, 0x4600, 57600,
-	kurot4setup, kurot4brdfix, NULL, NULL },
+	NULL, kurot4brdfix, NULL, NULL },
 {
 	unknown,
 	Unknown board,
@@ -776,16 +776,6 @@ nhnasreset()
 }
 
 void
-kurot4setup(struct brdprop *brd)
-{
-
-	if (PCI_VENDOR(pcicfgread(pcimaketag(0, 11, 0), PCI_ID_REG)) == 0x10ec)
-		brd-extclk = 32768000; /* decr 2457600Hz */
-	else
-		brd-extclk = 32521333; /* decr 2439100Hz */
-}
-
-void
 kurot4brdfix(struct brdprop *brd)
 {
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-09 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Apr  9 12:40:56 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Refactor disklabel decode logic.  RAIDFRAME case needs more attention
as it's not certain whether a general solution.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sandpoint/stand/altboot/dsk.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-09 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Apr  9 14:02:04 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
The processor ExtClk value of Kurobox/T4 is comfirmed as 32768000.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sandpoint/stand/altboot/brdsetup.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-08 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sun Apr  8 10:38:34 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c globals.h

Log Message:
Add an entry for Terastation TGL miconv2 satellite processor which
features a more complex protocol than Linkstation/Kurobox.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sandpoint/stand/altboot/globals.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.27 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.28
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.27	Sat Jan 14 22:36:54 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sun Apr  8 10:38:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.27 2012/01/14 22:36:54 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.28 2012/04/08 10:38:34 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -56,6 +56,7 @@ BRD_DECL(qnap);
 BRD_DECL(iomega);
 BRD_DECL(dlink);
 BRD_DECL(nhnas);
+BRD_DECL(kurot4);
 
 static void brdfixup(void);
 static void setup(void);
@@ -170,6 +171,13 @@ static struct brdprop brdlist[] = {
 	eumb, 0x4500, 9600,
 	NULL, nhnasbrdfix, NULL, nhnasreset },
 {
+	miconv2,
+	KuroBox/T4,
+	BRD_KUROBOXT4,
+	0,
+	eumb, 0x4600, 57600,
+	kurot4setup, kurot4brdfix, NULL, NULL },
+{
 	unknown,
 	Unknown board,
 	BRD_UNKNOWN,
@@ -207,7 +215,7 @@ brdsetup(void)
 	char *consname;
 	int consport;
 	uint32_t extclk;
-	unsigned pchb, pcib, dev11, dev13, dev15, dev16, val;
+	unsigned pchb, pcib, dev11, dev12, dev13, dev15, dev16, val;
 	extern struct btinfo_memory bi_mem;
 	extern struct btinfo_console bi_cons;
 	extern struct btinfo_clock bi_clk;
@@ -229,6 +237,7 @@ brdsetup(void)
 	busclock = 0;
 
 	dev11 = pcimaketag(0, 11, 0);
+	dev12 = pcimaketag(0, 12, 0);
 	dev13 = pcimaketag(0, 13, 0);
 	dev15 = pcimaketag(0, 15, 0);
 	dev16 = pcimaketag(0, 16, 0);
@@ -243,7 +252,10 @@ brdsetup(void)
 	}
 	else if (PCI_CLASS(pcicfgread(dev11, PCI_CLASS_REG)) == PCI_CLASS_ETH) {
 		/* ADMtek AN985 (tlp) or RealTek 8169S (re) at dev 11 */
-		brdtype = BRD_KUROBOX;
+		if (PCI_VENDOR(pcicfgread(dev12, PCI_ID_REG)) != 0x1095)
+			brdtype = BRD_KUROBOX;
+		else
+			brdtype = BRD_KUROBOXT4;
 	}
 	else if (PCI_VENDOR(pcicfgread(dev15, PCI_ID_REG)) == 0x11ab) {
 		/* SKnet/Marvell (sk) at dev 15 */
@@ -764,6 +776,23 @@ nhnasreset()
 }
 
 void
+kurot4setup(struct brdprop *brd)
+{
+
+	if (PCI_VENDOR(pcicfgread(pcimaketag(0, 11, 0), PCI_ID_REG)) == 0x10ec)
+		brd-extclk = 32768000; /* decr 2457600Hz */
+	else
+		brd-extclk = 32521333; /* decr 2439100Hz */
+}
+
+void
+kurot4brdfix(struct brdprop *brd)
+{
+
+	init_uart(uart2base, 38400, LCR_8BITS | LCR_PEVEN);
+}
+
+void
 _rtt(void)
 {
 	uint32_t msr;

Index: src/sys/arch/sandpoint/stand/altboot/globals.h
diff -u src/sys/arch/sandpoint/stand/altboot/globals.h:1.16 src/sys/arch/sandpoint/stand/altboot/globals.h:1.17
--- src/sys/arch/sandpoint/stand/altboot/globals.h:1.16	Sun Jan 22 13:08:16 2012
+++ src/sys/arch/sandpoint/stand/altboot/globals.h	Sun Apr  8 10:38:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.h,v 1.16 2012/01/22 13:08:16 phx Exp $ */
+/* $NetBSD: globals.h,v 1.17 2012/04/08 10:38:34 nisimura Exp $ */
 
 #ifdef DEBUG
 #define	DPRINTF(x)	printf x
@@ -22,6 +22,7 @@ extern int brdtype;
 #define BRD_STORCENTER		103
 #define BRD_DLINKDSM		104
 #define BRD_NH230NAS		105
+#define BRD_KUROBOXT4		106
 #define BRD_UNKNOWN		-1
 
 struct brdprop {



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-04-08 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sun Apr  8 10:38:34 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c globals.h

Log Message:
Add an entry for Terastation TGL miconv2 satellite processor which
features a more complex protocol than Linkstation/Kurobox.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sandpoint/stand/altboot/globals.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/sandpoint/stand/altboot

2012-01-22 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan 22 13:08:17 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c globals.h main.c pciide.c
siisata.c version

Log Message:
Support PATA drive configuration option (ide:N[N...]).
Wait until drives are ready after cold-start.
Wake up drives from standby mode.
A default command line can be saved to flash as initrd image.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sandpoint/stand/altboot/globals.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sandpoint/stand/altboot/main.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sandpoint/stand/altboot/pciide.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/altboot/siisata.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.12 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.13
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.12	Thu Jan 19 07:38:05 2012
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Sun Jan 22 13:08:16 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.12 2012/01/19 07:38:05 nisimura Exp $ */
+/* $NetBSD: dsk.c,v 1.13 2012/01/22 13:08:16 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -179,34 +179,46 @@ int
 perform_atareset(struct dkdev_ata *l, int n)
 {
 	struct dvata_chan *chan = l-chan[n];
+//	int retries;
 
-	CSR_WRITE_1(chan-ctl, ATA_DREQ);
-	delay(10);
-	CSR_WRITE_1(chan-ctl, ATA_SRST|ATA_DREQ);
-	delay(10);
-	CSR_WRITE_1(chan-ctl, ATA_DREQ);
+//	for (retries = 0; retries  10; retries++) {
+		CSR_WRITE_1(chan-ctl, ATA_DREQ);
+		delay(10);
+		CSR_WRITE_1(chan-ctl, ATA_SRST|ATA_DREQ);
+		delay(10);
+		CSR_WRITE_1(chan-ctl, ATA_DREQ);
+//		if (spinwait_unbusy(l, n, 1000/*250*/, NULL) != 0)
+//			return 1;
+//		delay(1000 * 1000);
+//	}
+	return spinwait_unbusy(l, n, 1000/*250*/, NULL);
+}
+
+/* clear idle and standby timers to spin up the drive */
+void
+wakeup_drive(struct dkdev_ata *l, int n)
+{
+	struct dvata_chan *chan = l-chan[n];
 
-	return spinwait_unbusy(l, n, 250, NULL);
+	CSR_WRITE_1(chan-cmd + _NSECT, 0);
+	CSR_WRITE_1(chan-cmd + _CMD, ATA_CMD_IDLE);
+	(void)CSR_READ_1(chan-alt);
+	delay(10 * 1000);
+	CSR_WRITE_1(chan-cmd + _NSECT, 0);
+	CSR_WRITE_1(chan-cmd + _CMD, ATA_CMD_STANDBY);
+	(void)CSR_READ_1(chan-alt);
+	delay(10 * 1000);
 }
 
 int
-satapresense(struct dkdev_ata *l, int n)
+atachkpwr(struct dkdev_ata *l, int n)
 {
-#define VND_CH(n) (((n02)8)+((n01)7))
-#define VND_SC(n) (0x100+VND_CH(n))
-#define VND_SS(n) (0x104+VND_CH(n))
-
-	uint32_t sc = l-bar[5] + VND_SC(n);
-	uint32_t ss = l-bar[5] + VND_SS(n);
-	unsigned val;
-
-	val = (00  4) | (03  8);	/* any speed, no pwrmgt */
-	CSR_WRITE_4(sc, val | 01);	/* perform init */
-	delay(50 * 1000);
-	CSR_WRITE_4(sc, val);
-	delay(50 * 1000);	
-	val = CSR_READ_4(ss);		/* has completed */
-	return ((val  03) == 03);	/* active drive found */
+	struct dvata_chan *chan = l-chan[n];
+
+	CSR_WRITE_1(chan-cmd + _CMD, ATA_CMD_CHKPWR);
+	(void)CSR_READ_1(chan-alt);
+	delay(10 * 1000);
+	return CSR_READ_1(chan-cmd + _NSECT);
 }
 
 static int

Index: src/sys/arch/sandpoint/stand/altboot/globals.h
diff -u src/sys/arch/sandpoint/stand/altboot/globals.h:1.15 src/sys/arch/sandpoint/stand/altboot/globals.h:1.16
--- src/sys/arch/sandpoint/stand/altboot/globals.h:1.15	Sat Jan  7 19:57:49 2012
+++ src/sys/arch/sandpoint/stand/altboot/globals.h	Sun Jan 22 13:08:16 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.h,v 1.15 2012/01/07 19:57:49 phx Exp $ */
+/* $NetBSD: globals.h,v 1.16 2012/01/22 13:08:16 phx Exp $ */
 
 #ifdef DEBUG
 #define	DPRINTF(x)	printf x
@@ -42,6 +42,7 @@ extern uint32_t cpuclock, busclock;
 
 /* board specific support code */
 struct brdprop *brd_lookup(int);
+int get_drive_config(int);
 int tstchar(void);
 #ifdef DEBUG
 void sat_write(char *, int);
@@ -177,16 +178,23 @@ DSK_DECL(siisata);
 #define ATA_STS_DRDY		0x40
 #define ATA_STS_ERR 		0x01
 /* command */
+#define ATA_CMD_CHKPWR		0xe5
 #define ATA_CMD_IDENT		0xec
+#define ATA_CMD_IDLE		0xe3
 #define ATA_CMD_READ		0x20
 #define ATA_CMD_READ_EXT	0x24
 #define ATA_CMD_SETF		0xef
+#define ATA_CMD_STANDBY		0xe2
 /* device */
 #define ATA_DEV_LBA		0xe0
 #define ATA_DEV_OBS		0x90
 /* control */
 #define ATA_DREQ		0x08
 #define ATA_SRST		0x04
+/* power state */
+#define ATA_PWR_ACTIVE		0xff
+#define ATA_PWR_IDLE		0x80
+#define ATA_PWR_STANDBY		0x00
 
 #define ATA_XFER		0x03
 #define XFER_PIO4		0x0c
@@ -229,4 +237,5 @@ struct disk {
 
 int spinwait_unbusy(struct dkdev_ata *, int, int, const char **);
 int perform_atareset(struct dkdev_ata *, int);
-int satapresense(struct dkdev_ata *, int);
+void wakeup_drive(struct dkdev_ata *, int);
+int atachkpwr(struct dkdev_ata *, int);

Index: 

CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-22 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan 22 13:16:54 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Cleanup in perform_atareset().


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sandpoint/stand/altboot/dsk.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/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.13 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.14
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.13	Sun Jan 22 13:08:16 2012
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Sun Jan 22 13:16:54 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.13 2012/01/22 13:08:16 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.14 2012/01/22 13:16:54 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -179,19 +179,14 @@ int
 perform_atareset(struct dkdev_ata *l, int n)
 {
 	struct dvata_chan *chan = l-chan[n];
-//	int retries;
 
-//	for (retries = 0; retries  10; retries++) {
-		CSR_WRITE_1(chan-ctl, ATA_DREQ);
-		delay(10);
-		CSR_WRITE_1(chan-ctl, ATA_SRST|ATA_DREQ);
-		delay(10);
-		CSR_WRITE_1(chan-ctl, ATA_DREQ);
-//		if (spinwait_unbusy(l, n, 1000/*250*/, NULL) != 0)
-//			return 1;
-//		delay(1000 * 1000);
-//	}
-	return spinwait_unbusy(l, n, 1000/*250*/, NULL);
+	CSR_WRITE_1(chan-ctl, ATA_DREQ);
+	delay(10);
+	CSR_WRITE_1(chan-ctl, ATA_SRST|ATA_DREQ);
+	delay(10);
+	CSR_WRITE_1(chan-ctl, ATA_DREQ);
+
+	return spinwait_unbusy(l, n, 1000, NULL);
 }
 
 /* clear idle and standby timers to spin up the drive */



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-22 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan 22 13:08:17 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c globals.h main.c pciide.c
siisata.c version

Log Message:
Support PATA drive configuration option (ide:N[N...]).
Wait until drives are ready after cold-start.
Wake up drives from standby mode.
A default command line can be saved to flash as initrd image.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sandpoint/stand/altboot/globals.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sandpoint/stand/altboot/main.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sandpoint/stand/altboot/pciide.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/altboot/siisata.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/version

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-22 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan 22 13:16:54 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Cleanup in perform_atareset().


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sandpoint/stand/altboot/dsk.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan 14 20:03:12 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c entry.S

Log Message:
Add 0x7000 BAT-mapping for NH230/231.
NH23x: Initialize LEDs on startup (status off, to indicate the bootloader
is running). Hardware reset routine.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/entry.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.25 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.26
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.25	Sun Jan  8 14:53:54 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sat Jan 14 20:03:11 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.25 2012/01/08 14:53:54 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.26 2012/01/14 20:03:11 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,6 +57,60 @@ BRD_DECL(iomega);
 BRD_DECL(dlink);
 BRD_DECL(nhnas);
 
+static void brdfixup(void);
+static void setup(void);
+static void send_iomega(int, int, int, int, int, int);
+static inline uint32_t mfmsr(void);
+static inline void mtmsr(uint32_t);
+static inline uint32_t cputype(void);
+static inline u_quad_t mftb(void);
+static void init_uart(unsigned, unsigned, uint8_t);
+static void send_sat(char *);
+static unsigned mpc107memsize(void);
+
+/* UART registers */
+#define RBR		0
+#define THR		0
+#define DLB		0
+#define DMB		1
+#define IER		1
+#define FCR		2
+#define LCR		3
+#define  LCR_DLAB	0x80
+#define  LCR_PEVEN	0x18
+#define  LCR_PNONE	0x00
+#define  LCR_8BITS	0x03
+#define MCR		4
+#define  MCR_RTS	0x02
+#define  MCR_DTR	0x01
+#define LSR		5
+#define  LSR_THRE	0x20
+#define  LSR_DRDY	0x01
+#define DCR		0x11
+#define UART_READ(base, r)	in8(base + (r))
+#define UART_WRITE(base, r, v)	out8(base + (r), (v))
+
+/* MPC106 and MPC824x PCI bridge memory configuration */
+#define MPC106_MEMSTARTADDR1	0x80
+#define MPC106_EXTMEMSTARTADDR1	0x88
+#define MPC106_MEMENDADDR1	0x90
+#define MPC106_EXTMEMENDADDR1	0x98
+#define MPC106_MEMEN		0xa0
+
+/* Iomega StorCenter MC68HC908 microcontroller data packet */
+#define IOMEGA_POWER		0
+#define IOMEGA_LED		1
+#define IOMEGA_FLASH_RATE	2
+#define IOMEGA_FAN		3
+#define IOMEGA_HIGH_TEMP	4
+#define IOMEGA_LOW_TEMP		5
+#define IOMEGA_ID		6
+#define IOMEGA_CHECKSUM		7
+#define IOMEGA_PACKETSIZE	8
+
+/* NH230/231 GPIO */
+#define NHGPIO_WRITE(x)		*((uint8_t *)0x7000) = x
+
 static struct brdprop brdlist[] = {
 {
 	sandpoint,
@@ -78,7 +132,7 @@ static struct brdprop brdlist[] = {
 	BRD_KUROBOX,
 	0,
 	eumb, 0x4600, 57600,
-	kurosetup, kurobrdfix, NULL, NULL },
+	kurosetup, kurobrdfix, NULL, kuroreset },
 {
 	synology,
 	Synology DS,
@@ -114,7 +168,7 @@ static struct brdprop brdlist[] = {
 	BRD_NH230NAS,
 	3300,
 	eumb, 0x4500, 9600,
-	NULL, nhnasbrdfix, NULL, NULL },
+	NULL, nhnasbrdfix, NULL, nhnasreset },
 {
 	unknown,
 	Unknown board,
@@ -124,63 +178,14 @@ static struct brdprop brdlist[] = {
 	NULL, NULL, NULL, NULL }, /* must be the last */
 };
 
-/* MPC106 and MPC824x PCI bridge memory configuration */
-#define MPC106_MEMSTARTADDR1	0x80
-#define MPC106_EXTMEMSTARTADDR1	0x88
-#define MPC106_MEMENDADDR1	0x90
-#define MPC106_EXTMEMENDADDR1	0x98
-#define MPC106_MEMEN		0xa0
-
-/* Iomega StorCenter MC68HC908 microcontroller data packet */
-#define IOMEGA_POWER		0
-#define IOMEGA_LED		1
-#define IOMEGA_FLASH_RATE	2
-#define IOMEGA_FAN		3
-#define IOMEGA_HIGH_TEMP	4
-#define IOMEGA_LOW_TEMP		5
-#define IOMEGA_ID		6
-#define IOMEGA_CHECKSUM		7
-#define IOMEGA_PACKETSIZE	8
-
 static struct brdprop *brdprop;
 static uint32_t ticks_per_sec, ns_per_tick;
 
-static void brdfixup(void);
-static void setup(void);
-static void send_iomega(int, int, int, int, int, int);
-static inline uint32_t mfmsr(void);
-static inline void mtmsr(uint32_t);
-static inline uint32_t cputype(void);
-static inline u_quad_t mftb(void);
-static void init_uart(unsigned, unsigned, uint8_t);
-static void send_sat(char *);
-static unsigned mpc107memsize(void);
-
 const unsigned dcache_line_size = 32;		/* 32B linesize */
 const unsigned dcache_range_size = 4 * 1024;	/* 16KB / 4-way */
 
 unsigned uart1base;	/* console */
 unsigned uart2base;	/* optional satellite processor */
-#define RBR		0
-#define THR		0
-#define DLB		0
-#define DMB		1
-#define IER		1
-#define FCR		2
-#define LCR		3
-#define  LCR_DLAB	0x80
-#define  LCR_PEVEN	0x18
-#define  LCR_PNONE	0x00
-#define  LCR_8BITS	0x03
-#define MCR		4
-#define  MCR_RTS	0x02
-#define  MCR_DTR	0x01
-#define LSR		5
-#define  LSR_THRE	0x20
-#define  LSR_DRDY	0x01
-#define DCR		0x11
-#define UART_READ(base, r)	in8(base + (r))
-#define UART_WRITE(base, r, v)	out8(base + (r), (v))
 
 void 

CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan 14 20:16:53 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot

Log Message:
Add NH230 PPCboot version.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sandpoint/stand/altboot/README.altboot

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/sandpoint/stand/altboot/README.altboot
diff -u src/sys/arch/sandpoint/stand/altboot/README.altboot:1.7 src/sys/arch/sandpoint/stand/altboot/README.altboot:1.8
--- src/sys/arch/sandpoint/stand/altboot/README.altboot:1.7	Sun Jan  1 14:16:41 2012
+++ src/sys/arch/sandpoint/stand/altboot/README.altboot	Sat Jan 14 20:16:53 2012
@@ -1,6 +1,6 @@
 /// notes about altboot ///
 
-$NetBSD: README.altboot,v 1.7 2012/01/01 14:16:41 phx Exp $
+$NetBSD: README.altboot,v 1.8 2012/01/14 20:16:53 phx Exp $
 
 Altboot is a functional bridge to fill the gap between a NAS product
 custom bootloader and the NetBSD kernel startup environment.  Altboot
@@ -44,6 +44,10 @@ Altboot is known working on at least the
 
U-Boot 1.0.0 (Sep  2 2005 - 14:49:11)
 
+- Netronics NH230/231 and compatible with restricted vendor custom PPCboot
+
+   PPCBoot 2.0.0-A9 (Feb 13 2006 - 14:56:11)
+
 The standard use of altboot is to invoke it with a short script from
 U-Boot/PPCboot, where the altboot.bin image is stored in an unoccupied 128KB
 section of the target's HW NOR flash.  Combined with standard



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan 14 22:36:54 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot brdsetup.c

Log Message:
Netronics is spelled Netronix.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/altboot/README.altboot
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/README.altboot
diff -u src/sys/arch/sandpoint/stand/altboot/README.altboot:1.8 src/sys/arch/sandpoint/stand/altboot/README.altboot:1.9
--- src/sys/arch/sandpoint/stand/altboot/README.altboot:1.8	Sat Jan 14 20:16:53 2012
+++ src/sys/arch/sandpoint/stand/altboot/README.altboot	Sat Jan 14 22:36:54 2012
@@ -1,6 +1,6 @@
 /// notes about altboot ///
 
-$NetBSD: README.altboot,v 1.8 2012/01/14 20:16:53 phx Exp $
+$NetBSD: README.altboot,v 1.9 2012/01/14 22:36:54 phx Exp $
 
 Altboot is a functional bridge to fill the gap between a NAS product
 custom bootloader and the NetBSD kernel startup environment.  Altboot
@@ -44,7 +44,7 @@ Altboot is known working on at least the
 
U-Boot 1.0.0 (Sep  2 2005 - 14:49:11)
 
-- Netronics NH230/231 and compatible with restricted vendor custom PPCboot
+- Allnet 6250 and compatible with restricted vendor custom PPCboot
 
PPCBoot 2.0.0-A9 (Feb 13 2006 - 14:56:11)
 

Index: src/sys/arch/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.26 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.27
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.26	Sat Jan 14 20:03:11 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sat Jan 14 22:36:54 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.26 2012/01/14 20:03:11 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.27 2012/01/14 22:36:54 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -164,7 +164,7 @@ static struct brdprop brdlist[] = {
 	NULL, dlinkbrdfix, NULL, NULL },
 {
 	nhnas,
-	Netronics NH230/231,
+	Netronix NH-230/231,
 	BRD_NH230NAS,
 	3300,
 	eumb, 0x4500, 9600,



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan 14 20:03:12 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c entry.S

Log Message:
Add 0x7000 BAT-mapping for NH230/231.
NH23x: Initialize LEDs on startup (status off, to indicate the bootloader
is running). Hardware reset routine.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/entry.S

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan 14 20:16:53 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot

Log Message:
Add NH230 PPCboot version.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sandpoint/stand/altboot/README.altboot

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan 14 22:36:54 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot brdsetup.c

Log Message:
Netronics is spelled Netronix.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/altboot/README.altboot
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sandpoint/stand/altboot/brdsetup.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-08 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan  8 14:53:54 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
Set the extclk for NH230 to 3300Hz.
Prepare a synosetup() function which should set a different extclk for
the 400MHz models, as soon as we find a method to check for them.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.24 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.25
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.24	Sat Jan  7 19:57:49 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sun Jan  8 14:53:54 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.24 2012/01/07 19:57:49 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.25 2012/01/08 14:53:54 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -76,17 +76,16 @@ static struct brdprop brdlist[] = {
 	kurobox,
 	KuroBox,
 	BRD_KUROBOX,
-	32768000,
+	0,
 	eumb, 0x4600, 57600,
 	kurosetup, kurobrdfix, NULL, NULL },
 {
 	synology,
 	Synology DS,
 	BRD_SYNOLOGY,
-	33164691,	/* from Synology/Linux source*/
-			/* XXX should be 33165343 for the CS-406 */
+	0,
 	eumb, 0x4500, 115200,
-	NULL, synobrdfix, NULL, synoreset },
+	synosetup, synobrdfix, NULL, synoreset },
 {
 	qnap,
 	QNAP TS,
@@ -113,7 +112,7 @@ static struct brdprop brdlist[] = {
 	nhnas,
 	Netronics NH230/231,
 	BRD_NH230NAS,
-	0,
+	3300,
 	eumb, 0x4500, 9600,
 	NULL, nhnasbrdfix, NULL, NULL },
 {
@@ -664,6 +663,16 @@ kurobrdfix(struct brdprop *brd)
 }
 
 void
+synosetup(struct brdprop *brd)
+{
+
+	if (1) /* 200 and 266MHz models */
+		brd-extclk = 33164691; /* from Synology/Linux source */
+	else   /* 400MHz models XXX how to check? */
+		brd-extclk = 33165343;
+}
+
+void
 synobrdfix(struct brdprop *brd)
 {
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-08 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan  8 14:53:54 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
Set the extclk for NH230 to 3300Hz.
Prepare a synosetup() function which should set a different extclk for
the 400MHz models, as soon as we find a method to check for them.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sandpoint/stand/altboot/brdsetup.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-07 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan  7 19:57:49 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c globals.h

Log Message:
NH230 PPCBoot configures the memory boundary registers for 128MB, although
the board has only 64MB. Fix that.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sandpoint/stand/altboot/globals.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.23 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.24
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.23	Sat Nov 12 23:52:54 2011
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sat Jan  7 19:57:49 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.23 2011/11/12 23:52:54 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.24 2012/01/07 19:57:49 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -125,6 +125,13 @@ static struct brdprop brdlist[] = {
 	NULL, NULL, NULL, NULL }, /* must be the last */
 };
 
+/* MPC106 and MPC824x PCI bridge memory configuration */
+#define MPC106_MEMSTARTADDR1	0x80
+#define MPC106_EXTMEMSTARTADDR1	0x88
+#define MPC106_MEMENDADDR1	0x90
+#define MPC106_EXTMEMENDADDR1	0x98
+#define MPC106_MEMEN		0xa0
+
 /* Iomega StorCenter MC68HC908 microcontroller data packet */
 #define IOMEGA_POWER		0
 #define IOMEGA_LED		1
@@ -148,6 +155,7 @@ static inline uint32_t cputype(void);
 static inline u_quad_t mftb(void);
 static void init_uart(unsigned, unsigned, uint8_t);
 static void send_sat(char *);
+static unsigned mpc107memsize(void);
 
 const unsigned dcache_line_size = 32;		/* 32B linesize */
 const unsigned dcache_range_size = 4 * 1024;	/* 16KB / 4-way */
@@ -1002,8 +1010,49 @@ tstchar(void)
 	return (UART_READ(uart1base, LSR)  LSR_DRDY) != 0;
 }
 
-unsigned
-mpc107memsize()
+#define SAR_MASK 0x0ff0
+#define SAR_SHIFT20
+#define EAR_MASK 0x3000
+#define EAR_SHIFT28
+#define AR(v, s) v)  SAR_MASK)  SAR_SHIFT)  (s))
+#define XR(v, s) v)  EAR_MASK)  EAR_SHIFT)  (s))
+static void
+set_mem_bounds(unsigned tag, unsigned bk_en, ...)
+{
+	unsigned mbst, mbxst, mben, mbxen;
+	unsigned start, end;
+	va_list ap;
+	int i, sh;
+
+	va_start(ap, bk_en);
+	mbst = mbxst = mben = mbxen = 0;
+
+	for (i = 0; i  4; i++) {
+		if ((bk_en  (1U  i)) != 0) {
+			start = va_arg(ap, unsigned);
+			end = va_arg(ap, unsigned);
+		} else {
+			start = 0x3ff0;
+			end = 0x3fff;
+		}
+		sh = i  3;
+		mbst |= AR(start, sh);
+		mbxst |= XR(start, sh);
+		mben |= AR(end, sh);
+		mbxen |= XR(end, sh);
+	}
+	va_end(ap);
+
+	pcicfgwrite(tag, MPC106_MEMSTARTADDR1, mbst);
+	pcicfgwrite(tag, MPC106_EXTMEMSTARTADDR1, mbxst);
+	pcicfgwrite(tag, MPC106_MEMENDADDR1, mben);
+	pcicfgwrite(tag, MPC106_EXTMEMENDADDR1,	mbxen);
+	pcicfgwrite(tag, MPC106_MEMEN,
+	(pcicfgread(tag, MPC106_MEMEN)  ~0xff) | (bk_en  0xff));
+}
+
+static unsigned
+mpc107memsize(void)
 {
 	unsigned bankn, end, n, tag, val;
 
@@ -1011,37 +1060,13 @@ mpc107memsize()
 
 	if (brdtype == BRD_ENCOREPP1) {
 		/* the brd's PPCBOOT looks to have erroneous values */
-		unsigned tbl[] = {
-#define MPC106_MEMSTARTADDR1	0x80
-#define MPC106_EXTMEMSTARTADDR1	0x88
-#define MPC106_MEMENDADDR1	0x90
-#define MPC106_EXTMEMENDADDR1	0x98
-#define MPC106_MEMEN		0xa0
-#define	BK0_S	0x
-#define	BK0_E	(128  20) - 1
-#define BK1_S	0x3ff0
-#define BK1_E	0x3fff
-#define BK2_S	0x3ff0
-#define BK2_E	0x3fff
-#define BK3_S	0x3ff0
-#define BK3_E	0x3fff
-#define AR(v, s) v)  SAR_MASK)  SAR_SHIFT)  (s))
-#define XR(v, s) v)  EAR_MASK)  EAR_SHIFT)  (s))
-#define SAR_MASK 0x0ff0
-#define SAR_SHIFT20
-#define EAR_MASK 0x3000
-#define EAR_SHIFT28
-		AR(BK0_S, 0) | AR(BK1_S, 8) | AR(BK2_S, 16) | AR(BK3_S, 24),
-		XR(BK0_S, 0) | XR(BK1_S, 8) | XR(BK2_S, 16) | XR(BK3_S, 24),
-		AR(BK0_E, 0) | AR(BK1_E, 8) | AR(BK2_E, 16) | AR(BK3_E, 24),
-		XR(BK0_E, 0) | XR(BK1_E, 8) | XR(BK2_E, 16) | XR(BK3_E, 24),
-		};
-		tag = pcimaketag(0, 0, 0);
-		pcicfgwrite(tag, MPC106_MEMSTARTADDR1, tbl[0]);
-		pcicfgwrite(tag, MPC106_EXTMEMSTARTADDR1, tbl[1]);
-		pcicfgwrite(tag, MPC106_MEMENDADDR1, tbl[2]);
-		pcicfgwrite(tag, MPC106_EXTMEMENDADDR1,	tbl[3]);
-		pcicfgwrite(tag, MPC106_MEMEN, 1);
+		set_mem_bounds(tag, 1, 0x, (128  20) - 1);
+	} else if (brdtype == BRD_NH230NAS) {
+		/*
+		 * PPCBoot sets the end address to 0x7ff, although the
+		 * board has just 64MB (0x3ff).
+		 */
+		set_mem_bounds(tag, 1, 0x, 0x03ff);
 	}
 
 	bankn = 0;
@@ -1051,7 +1076,7 @@ mpc107memsize()
 			break;
 		bankn = n;
 	}
-	bankn = bankn * 8;
+	bankn = 3;
 
 	val = pcicfgread(tag, MPC106_EXTMEMENDADDR1);
 	end =  ((val  bankn)  0x03)  28;

Index: src/sys/arch/sandpoint/stand/altboot/globals.h

CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-07 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan  7 19:57:49 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c globals.h

Log Message:
NH230 PPCBoot configures the memory boundary registers for 128MB, although
the board has only 64MB. Fix that.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sandpoint/stand/altboot/globals.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/sandpoint/stand/altboot

2012-01-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan  1 14:16:41 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot

Log Message:
Add Iomega StorCenter.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/README.altboot

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/sandpoint/stand/altboot/README.altboot
diff -u src/sys/arch/sandpoint/stand/altboot/README.altboot:1.6 src/sys/arch/sandpoint/stand/altboot/README.altboot:1.7
--- src/sys/arch/sandpoint/stand/altboot/README.altboot:1.6	Sun Nov 13 16:22:18 2011
+++ src/sys/arch/sandpoint/stand/altboot/README.altboot	Sun Jan  1 14:16:41 2012
@@ -1,6 +1,6 @@
 /// notes about altboot ///
 
-$NetBSD: README.altboot,v 1.6 2011/11/13 16:22:18 phx Exp $
+$NetBSD: README.altboot,v 1.7 2012/01/01 14:16:41 phx Exp $
 
 Altboot is a functional bridge to fill the gap between a NAS product
 custom bootloader and the NetBSD kernel startup environment.  Altboot
@@ -19,8 +19,8 @@ NetBSD kernels.
 
 Altboot is known working on at least these models:
 
-- KuroBox or LinkStation with a popular U-Boot as the replacement of
-  vendor proprietary
+- KuroBox or LinkStation with a popular U-Boot as replacement of
+  the vendor's proprietary one
 
U-Boot 1.1.4 LiSt 2.1.0 (Sep 21 2006 - 00:22:56) LinkStation / KuroBox
 
@@ -40,6 +40,10 @@ Altboot is known working on at least the
 
U-Boot 1.1.2 (Aug 28 2005 - 13:37:25) QNAP System, Inc.
 
+- Iomega StorCenter with vendor custom U-Boot
+
+   U-Boot 1.0.0 (Sep  2 2005 - 14:49:11)
+
 The standard use of altboot is to invoke it with a short script from
 U-Boot/PPCboot, where the altboot.bin image is stored in an unoccupied 128KB
 section of the target's HW NOR flash.  Combined with standard
@@ -52,7 +56,7 @@ In case the firmware was crippled by the
 Linux U-Boot images (D-Link), you can still use altboot by uploading
 altboot.img instead of the Linux kernel.
 
-Altboot hands the following bootinfo records to the NetBSD/sandpoint
+Altboot passes the following bootinfo records to the NetBSD/sandpoint
 kernel.
 - processor clock tick value driving MPC8241/8245.
 - serial console selection.



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan  1 18:25:03 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Handle devices with two network interfaces (e.g. a DSM-G600 with stge(4)
and ath(4)).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.15 src/sys/arch/sandpoint/stand/altboot/main.c:1.16
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.15	Sun Nov  6 20:20:57 2011
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Sun Jan  1 18:25:03 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.15 2011/11/06 20:20:57 phx Exp $ */
+/* $NetBSD: main.c,v 1.16 2012/01/01 18:25:03 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@ extern char bootprog_name[], bootprog_re
 extern char newaltboot[], newaltboot_end[];
 
 struct pcidev lata[2];
-struct pcidev lnif[1];
+struct pcidev lnif[2];
 struct pcidev lusb[3];
 int nata, nnif, nusb;
 
@@ -137,7 +137,7 @@ main(int argc, char *argv[], char *boota
 		nata = pcilookup(PCI_CLASS_MISCSTORAGE, lata, 2);
 	if (nata == 0)
 		nata = pcilookup(PCI_CLASS_SCSI, lata, 2);
-	nnif = pcilookup(PCI_CLASS_ETH, lnif, 1);
+	nnif = pcilookup(PCI_CLASS_ETH, lnif, 2);
 	nusb = pcilookup(PCI_CLASS_USB, lusb, 3);
 
 #ifdef DEBUG
@@ -153,10 +153,10 @@ main(int argc, char *argv[], char *boota
 	}
 	if (nnif == 0)
 		printf(no NET found\n);
-	else {
+	else for (n = 0; n  nnif; n++) {
 		int b, d, f, bdf, pvd;
-		bdf = lnif[0].bdf;
-		pvd = lnif[0].pvd;
+		bdf = lnif[n].bdf;
+		pvd = lnif[n].pvd;
 		pcidecomposetag(bdf, b, d, f);
 		printf(%04x.%04x NET %02d:%02d:%02d\n,
 		PCI_VENDOR(pvd), PCI_PRODUCT(pvd), b, d, f);
@@ -176,11 +176,18 @@ main(int argc, char *argv[], char *boota
 	pcisetup();
 	pcifixup();
 
-	if (dskdv_init(lata[0]) == 0
-	|| (nata == 2  dskdv_init(lata[1]) == 0))
+	/* intialize a disk driver */
+	for (n = 0; n  nata; n++)
+		if (dskdv_init(lata[n]) != 0)
+			break;
+	if (n = nata)
 		printf(IDE/SATA device driver was not found\n);
 
-	if (netif_init(lnif[0]) == 0)
+	/* initialize a network interface */
+	for (n = 0; n  nnif; n++)
+		if (netif_init(lnif[n]) != 0)
+			break;
+	if (n = nnif)
 		printf(no NET device driver was found\n);
 
 	/*



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan  1 14:16:41 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot

Log Message:
Add Iomega StorCenter.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/README.altboot

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-01-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan  1 18:25:03 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Handle devices with two network interfaces (e.g. a DSM-G600 with stge(4)
and ath(4)).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-13 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Nov 13 16:22:18 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot

Log Message:
Add DS-106j.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/README.altboot

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/sandpoint/stand/altboot/README.altboot
diff -u src/sys/arch/sandpoint/stand/altboot/README.altboot:1.5 src/sys/arch/sandpoint/stand/altboot/README.altboot:1.6
--- src/sys/arch/sandpoint/stand/altboot/README.altboot:1.5	Thu Jun  2 16:41:32 2011
+++ src/sys/arch/sandpoint/stand/altboot/README.altboot	Sun Nov 13 16:22:18 2011
@@ -1,6 +1,6 @@
 /// notes about altboot ///
 
-$NetBSD: README.altboot,v 1.5 2011/06/02 16:41:32 phx Exp $
+$NetBSD: README.altboot,v 1.6 2011/11/13 16:22:18 phx Exp $
 
 Altboot is a functional bridge to fill the gap between a NAS product
 custom bootloader and the NetBSD kernel startup environment.  Altboot
@@ -28,7 +28,7 @@ Altboot is known working on at least the
 
PPCBoot 2.0.0 (Mar  1 2005 - 15:31:41)
 
-- Synology 207, 407e with vendor custom PPCboot
+- Synology 106j, 207, 407e with vendor custom PPCboot
 
PPCBoot 2.0.0 (Jan 30 2007 - xx:xx:xx)
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-13 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Nov 13 16:22:18 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: README.altboot

Log Message:
Add DS-106j.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/README.altboot

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-12 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Nov 12 16:56:12 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c pciide.c

Log Message:
Add support for IT821x IDE.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sandpoint/stand/altboot/pciide.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/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.10 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.11
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.10	Tue Nov  1 16:32:57 2011
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Sat Nov 12 16:56:12 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.10 2011/11/01 16:32:57 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.11 2011/11/12 16:56:12 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -186,7 +186,7 @@ perform_atareset(struct dkdev_ata *l, in
 	delay(10);
 	CSR_WRITE_1(chan-ctl, ATA_DREQ);
 
-	return spinwait_unbusy(l, n, 150, NULL);
+	return spinwait_unbusy(l, n, 250, NULL);
 }
 
 int

Index: src/sys/arch/sandpoint/stand/altboot/pciide.c
diff -u src/sys/arch/sandpoint/stand/altboot/pciide.c:1.9 src/sys/arch/sandpoint/stand/altboot/pciide.c:1.10
--- src/sys/arch/sandpoint/stand/altboot/pciide.c:1.9	Wed Nov  2 04:10:33 2011
+++ src/sys/arch/sandpoint/stand/altboot/pciide.c	Sat Nov 12 16:56:12 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.9 2011/11/02 04:10:33 nisimura Exp $ */
+/* $NetBSD: pciide.c,v 1.10 2011/11/12 16:56:12 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,6 +37,7 @@
 
 static int cmdidefix(struct dkdev_ata *);
 static int apoidefix(struct dkdev_ata *);
+static int iteidefix(struct dkdev_ata *);
 
 static uint32_t pciiobase = PCI_XIOBASE;
 
@@ -47,6 +48,7 @@ struct myops {
 static struct myops defaultops = { NULL, NULL };
 static struct myops cmdideops = { cmdidefix, NULL };
 static struct myops apoideops = { apoidefix, NULL };
+static struct myops iteideops = { iteidefix, NULL };
 static struct myops *myops;
 
 int
@@ -65,6 +67,8 @@ pciide_match(unsigned tag, void *data)
 		myops = apoideops;
 		return 1;
 	case PCI_DEVICE(0x1283, 0x8211): /* ITE 8211 IDE */
+		myops = iteideops;
+		return 1;
 	case PCI_DEVICE(0x10ad, 0x0105): /* Symphony Labs 82C105 IDE */
 	case PCI_DEVICE(0x10b8, 0x5229): /* ALi IDE */
 	case PCI_DEVICE(0x1191, 0x0008): /* ACARD ATP865 */
@@ -127,10 +131,10 @@ pciide_init(unsigned tag, void *data)
 	for (n = 0; n  2; n++) {
 		if (myops-presense  (*myops-presense)(l, n) == 0)
 			l-presense[n] = 0; /* found not exist */
-		else {
+		else
 			/* check to see whether soft reset works */
 			l-presense[n] = perform_atareset(l, n);
-		}
+
 		if (l-presense[n])
 			printf(channel %d present\n, n);
 	}
@@ -166,3 +170,19 @@ apoidefix(struct dkdev_ata *l)
 
 	return 1;
 }
+
+static int
+iteidefix(struct dkdev_ata *l)
+{
+	unsigned v;
+
+	/* set PCI mode and 66Mhz reference clock, disable IT8212 RAID */
+	v = pcicfgread(l-tag, 0x50);
+	pcicfgwrite(l-tag, 0x50, v  ~0x83);
+
+	/* i/o configuration, enable channels, cables, IORDY */
+	v = pcicfgread(l-tag, 0x40);
+	pcicfgwrite(l-tag, 0x40, (v  ~0xff) | 0x36a0f3);
+
+	return 1;
+}



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-12 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Nov 12 23:52:54 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c version

Log Message:
Improved Iomega microcontroller support. Bumped version to 1.8.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/altboot/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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.22 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.23
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.22	Mon Nov  7 21:11:55 2011
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sat Nov 12 23:52:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.22 2011/11/07 21:11:55 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.23 2011/11/12 23:52:54 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -141,7 +141,7 @@ static uint32_t ticks_per_sec, ns_per_ti
 
 static void brdfixup(void);
 static void setup(void);
-static int send_iomega(int, int, int, int, int, int);
+static void send_iomega(int, int, int, int, int, int);
 static inline uint32_t mfmsr(void);
 static inline void mtmsr(uint32_t);
 static inline uint32_t cputype(void);
@@ -694,15 +694,15 @@ iomegabrdfix(struct brdprop *brd)
 {
 
 	init_uart(uart2base, 9600, LCR_8BITS | LCR_PNONE);
-	/* LED flashing blue, fan auto, turn on at 60C, turn off at 50C */
-	(void)send_iomega('b', 'd', 2, 'a', 60, 50);
+	/* LED flashing blue, fan auto, turn on at 50C, turn off at 45C */
+	send_iomega('b', 'd', 2, 'a', 50, 45);
 }
 
 void
 iomegareset()
 {
 
-	(void)send_iomega('g', 0, 0, 0, 0, 0);
+	send_iomega('g', 0, 0, 0, 0, 0);
 	/*NOTREACHED*/
 }
 
@@ -901,7 +901,7 @@ iomega_debug(const char *txt, uint8_t bu
 }
 #endif /* DEBUG */
 
-static int
+static void
 send_iomega(int power, int led, int rate, int fan, int high, int low)
 {
 	uint8_t buf[IOMEGA_PACKETSIZE];
@@ -923,7 +923,7 @@ send_iomega(int power, int led, int rate
 	 */
 	do {
 		putchar(0);
-		delay(25000);
+		delay(5);
 	} while (!tstchar());
 
 	for (i = 0; i  IOMEGA_PACKETSIZE; i++)
@@ -935,18 +935,12 @@ send_iomega(int power, int led, int rate
 #endif
 
 	/* send command */
-	if (power = 0)
-		buf[IOMEGA_POWER] = power;
-	if (led = 0)
-		buf[IOMEGA_LED] = led;
-	if (rate = 0)
-		buf[IOMEGA_FLASH_RATE] = rate;
-	if (fan = 0)
-		buf[IOMEGA_FAN] = fan;
-	if (high = 0)
-		buf[IOMEGA_HIGH_TEMP] = high;
-	if (low = 0)
-		buf[IOMEGA_LOW_TEMP] = low;
+	buf[IOMEGA_POWER] = power;
+	buf[IOMEGA_LED] = led;
+	buf[IOMEGA_FLASH_RATE] = rate;
+	buf[IOMEGA_FAN] = fan;
+	buf[IOMEGA_HIGH_TEMP] = high;
+	buf[IOMEGA_LOW_TEMP] = low;
 	buf[IOMEGA_ID] = 7;	/* host id */
 	buf[IOMEGA_CHECKSUM] = (buf[IOMEGA_POWER] + buf[IOMEGA_LED] +
 	buf[IOMEGA_FLASH_RATE] + buf[IOMEGA_FAN] +
@@ -963,12 +957,15 @@ send_iomega(int power, int led, int rate
 	/* receive the reply */
 	for (i = 0; i  IOMEGA_PACKETSIZE; i++)
 		buf[i] = getchar();
-
-	uart1base = savedbase;
 #ifdef DEBUG
+	uart1base = savedbase;
 	iomega_debug(68HC908 reply, buf);
+	uart1base = uart2base;
 #endif
-	return buf[0] != '#';  /* error? */
+
+	if (buf[0] == '#')
+		goto again;  /* try again on error */
+	uart1base = savedbase;
 }
 
 void

Index: src/sys/arch/sandpoint/stand/altboot/version
diff -u src/sys/arch/sandpoint/stand/altboot/version:1.4 src/sys/arch/sandpoint/stand/altboot/version:1.5
--- src/sys/arch/sandpoint/stand/altboot/version:1.4	Sun Mar 13 15:23:43 2011
+++ src/sys/arch/sandpoint/stand/altboot/version	Sat Nov 12 23:52:54 2011
@@ -9,3 +9,5 @@
 1.7:	ST1023/IP1000A driver, load kernels from memory (mem:), possibility
 	to replace altboot with a new version while running, interactive
 	mode, default boot path is now wd0:netbsd in multiuser mode
+1.8:	Iomega support, IT821x  VT6410 IDE support, fixed interrupt
+	issue, exception handler and sat-controller test mode (DEBUG)



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-12 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Nov 13 00:06:54 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: pciide.c

Log Message:
Make the chipfix() functions return void instead of int, as the return
value is useless. Suggested by nisimura.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sandpoint/stand/altboot/pciide.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/sandpoint/stand/altboot/pciide.c
diff -u src/sys/arch/sandpoint/stand/altboot/pciide.c:1.10 src/sys/arch/sandpoint/stand/altboot/pciide.c:1.11
--- src/sys/arch/sandpoint/stand/altboot/pciide.c:1.10	Sat Nov 12 16:56:12 2011
+++ src/sys/arch/sandpoint/stand/altboot/pciide.c	Sun Nov 13 00:06:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.10 2011/11/12 16:56:12 phx Exp $ */
+/* $NetBSD: pciide.c,v 1.11 2011/11/13 00:06:54 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -35,14 +35,14 @@
 
 #include globals.h
 
-static int cmdidefix(struct dkdev_ata *);
-static int apoidefix(struct dkdev_ata *);
-static int iteidefix(struct dkdev_ata *);
+static void cmdidefix(struct dkdev_ata *);
+static void apoidefix(struct dkdev_ata *);
+static void iteidefix(struct dkdev_ata *);
 
 static uint32_t pciiobase = PCI_XIOBASE;
 
 struct myops {
-	int (*chipfix)(struct dkdev_ata *);
+	void (*chipfix)(struct dkdev_ata *);
 	int (*presense)(struct dkdev_ata *, int);
 };
 static struct myops defaultops = { NULL, NULL };
@@ -93,8 +93,7 @@ pciide_init(unsigned tag, void *data)
 
 	/* chipset specific fixes */
 	if (myops-chipfix)
-		if (!(*myops-chipfix)(l))
-			return NULL;
+		(*myops-chipfix)(l);
 
 	val = pcicfgread(tag, PCI_CLASS_REG);
 	native = PCI_CLASS(val) != PCI_CLASS_IDE ||
@@ -142,7 +141,7 @@ pciide_init(unsigned tag, void *data)
 	return l;
 }
 
-static int
+static void
 cmdidefix(struct dkdev_ata *l)
 {
 	unsigned v;
@@ -155,11 +154,9 @@ cmdidefix(struct dkdev_ata *l)
 	pcicfgwrite(l-tag, 0xa4, (v  ~0x) | 0x328a);
 	v = pcicfgread(l-tag, 0xb4);
 	pcicfgwrite(l-tag, 0xb4, (v  ~0x) | 0x328a);
-
-	return 1;
 }
 
-static int
+static void
 apoidefix(struct dkdev_ata *l)
 {
 	unsigned v;
@@ -167,11 +164,9 @@ apoidefix(struct dkdev_ata *l)
 	/* enable primary and secondary channel */
 	v = pcicfgread(l-tag, 0x40)  ~0x03;
 	pcicfgwrite(l-tag, 0x40, v | 0x03);
-
-	return 1;
 }
 
-static int
+static void
 iteidefix(struct dkdev_ata *l)
 {
 	unsigned v;
@@ -183,6 +178,4 @@ iteidefix(struct dkdev_ata *l)
 	/* i/o configuration, enable channels, cables, IORDY */
 	v = pcicfgread(l-tag, 0x40);
 	pcicfgwrite(l-tag, 0x40, (v  ~0xff) | 0x36a0f3);
-
-	return 1;
 }



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-12 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Nov 12 16:56:12 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c pciide.c

Log Message:
Add support for IT821x IDE.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sandpoint/stand/altboot/pciide.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-12 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Nov 12 23:52:54 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c version

Log Message:
Improved Iomega microcontroller support. Bumped version to 1.8.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/altboot/version

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-12 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Nov 13 00:06:54 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: pciide.c

Log Message:
Make the chipfix() functions return void instead of int, as the return
value is useless. Suggested by nisimura.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sandpoint/stand/altboot/pciide.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-07 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Mon Nov  7 21:11:56 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
Fixed Iomega microcontroller support. Implemented Iomega reboot function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.21 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.22
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.21	Sun Nov  6 20:20:57 2011
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Mon Nov  7 21:11:55 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.21 2011/11/06 20:20:57 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.22 2011/11/07 21:11:55 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@ static struct brdprop brdlist[] = {
 	BRD_STORCENTER,
 	0,
 	eumb, 0x4500, 115200,
-	NULL, iomegabrdfix, NULL, NULL },
+	NULL, iomegabrdfix, NULL, iomegareset },
 {
 	dlink,
 	D-Link DSM-G600,
@@ -141,7 +141,7 @@ static uint32_t ticks_per_sec, ns_per_ti
 
 static void brdfixup(void);
 static void setup(void);
-static int send_iomega(int, int, int, int, int, int, uint8_t *);
+static int send_iomega(int, int, int, int, int, int);
 static inline uint32_t mfmsr(void);
 static inline void mtmsr(uint32_t);
 static inline uint32_t cputype(void);
@@ -694,8 +694,16 @@ iomegabrdfix(struct brdprop *brd)
 {
 
 	init_uart(uart2base, 9600, LCR_8BITS | LCR_PNONE);
-	/* illuminate LEDs */
-	if (0) (void)send_iomega('b', 'd', 2, 'a', 60, 50, NULL);
+	/* LED flashing blue, fan auto, turn on at 60C, turn off at 50C */
+	(void)send_iomega('b', 'd', 2, 'a', 60, 50);
+}
+
+void
+iomegareset()
+{
+
+	(void)send_iomega('g', 0, 0, 0, 0, 0);
+	/*NOTREACHED*/
 }
 
 void
@@ -880,44 +888,87 @@ send_sat(char *msg)
 	uart1base = savedbase;
 }
 
+#ifdef DEBUG
+static void
+iomega_debug(const char *txt, uint8_t buf[])
+{
+	int i;
+
+	printf(%s:, txt);
+	for (i = 0; i  IOMEGA_PACKETSIZE; i++)
+		printf( %02x, buf[i]);
+	putchar('\n');
+}
+#endif /* DEBUG */
+
 static int
-send_iomega(int power, int led, int rate, int fan, int high, int low,
-uint8_t *st)
+send_iomega(int power, int led, int rate, int fan, int high, int low)
 {
-	unsigned i, savedbase;
-	static uint8_t cur_state[IOMEGA_PACKETSIZE];
 	uint8_t buf[IOMEGA_PACKETSIZE];
+	unsigned i, savedbase;
 
-	buf[IOMEGA_POWER] =
-	power = 0 ? power : cur_state[IOMEGA_POWER];
-	buf[IOMEGA_LED] =
-	led = 0 ? led : cur_state[IOMEGA_LED];
-	buf[IOMEGA_FLASH_RATE] =
-	rate = 0 ? rate : cur_state[IOMEGA_FLASH_RATE];
-	buf[IOMEGA_FAN] =
-	fan = 0 ? fan : cur_state[IOMEGA_FAN];
-	buf[IOMEGA_HIGH_TEMP] =
-	high = 0 ? high : cur_state[IOMEGA_HIGH_TEMP];
-	buf[IOMEGA_LOW_TEMP] =
-	low = 0 ? low : cur_state[IOMEGA_LOW_TEMP];
+	savedbase = uart1base;
+	uart1base = uart2base;
+
+	/* first flush the receive buffer */
+  again:
+	while (tstchar())
+		(void)getchar();
+	delay(2);
+	if (tstchar())
+		goto again;
+	/*
+	 * Now synchronize the transmitter by sending 0x00
+	 * until we receive a status reply.
+	 */
+	do {
+		putchar(0);
+		delay(25000);
+	} while (!tstchar());
+
+	for (i = 0; i  IOMEGA_PACKETSIZE; i++)
+		buf[i] = getchar();
+#ifdef DEBUG
+	uart1base = savedbase;
+	iomega_debug(68HC908 status, buf);
+	uart1base = uart2base;
+#endif
+
+	/* send command */
+	if (power = 0)
+		buf[IOMEGA_POWER] = power;
+	if (led = 0)
+		buf[IOMEGA_LED] = led;
+	if (rate = 0)
+		buf[IOMEGA_FLASH_RATE] = rate;
+	if (fan = 0)
+		buf[IOMEGA_FAN] = fan;
+	if (high = 0)
+		buf[IOMEGA_HIGH_TEMP] = high;
+	if (low = 0)
+		buf[IOMEGA_LOW_TEMP] = low;
 	buf[IOMEGA_ID] = 7;	/* host id */
 	buf[IOMEGA_CHECKSUM] = (buf[IOMEGA_POWER] + buf[IOMEGA_LED] +
 	buf[IOMEGA_FLASH_RATE] + buf[IOMEGA_FAN] +
 	buf[IOMEGA_HIGH_TEMP] + buf[IOMEGA_LOW_TEMP] +
 	buf[IOMEGA_ID])  0x7f;
-
-	savedbase = uart1base;
+#ifdef DEBUG
+	uart1base = savedbase;
+	iomega_debug(G2 sending, buf);
 	uart1base = uart2base;
+#endif
 	for (i = 0; i  IOMEGA_PACKETSIZE; i++)
 		putchar(buf[i]);
+
+	/* receive the reply */
 	for (i = 0; i  IOMEGA_PACKETSIZE; i++)
 		buf[i] = getchar();
-	uart1base = savedbase;
-	for (i = 0; i  IOMEGA_PACKETSIZE; i++)
-		printf(%02x, buf[i]);
-	printf(\n);
 
-	return 0;
+	uart1base = savedbase;
+#ifdef DEBUG
+	iomega_debug(68HC908 reply, buf);
+#endif
+	return buf[0] != '#';  /* error? */
 }
 
 void



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-06 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Nov  6 20:20:57 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c globals.h main.c

Log Message:
Added a test terminal for communicating with the satellite microcontroller.
When compiled with DEBUG option it can be entered by typing 'C'.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sandpoint/stand/altboot/globals.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.20 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.21
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.20	Tue Nov  1 16:32:57 2011
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sun Nov  6 20:20:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.20 2011/11/01 16:32:57 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.21 2011/11/06 20:20:57 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -695,7 +695,7 @@ iomegabrdfix(struct brdprop *brd)
 
 	init_uart(uart2base, 9600, LCR_8BITS | LCR_PNONE);
 	/* illuminate LEDs */
-	(void)send_iomega('b', 'd', 2, 'a', 60, 50, NULL);
+	if (0) (void)send_iomega('b', 'd', 2, 'a', 60, 50, NULL);
 }
 
 void
@@ -950,6 +950,7 @@ getchar(void)
 int
 tstchar(void)
 {
+
 	return (UART_READ(uart1base, LSR)  LSR_DRDY) != 0;
 }
 
@@ -1101,3 +1102,35 @@ read_mac_from_flash(uint8_t *mac)
 	/* set to 00:00:00:00:00:00 in case of error */
 	memset(mac, 0, 6);
 }
+
+#ifdef DEBUG
+void
+sat_write(char *p, int len)
+{
+	unsigned savedbase;
+
+	savedbase = uart1base;
+	uart1base = uart2base;
+	while (len--)
+		putchar(*p++);
+	uart1base = savedbase;
+}
+
+int
+sat_getch(void)
+{
+	unsigned lsr;
+
+	do {
+		lsr = UART_READ(uart2base, LSR);
+	} while ((lsr  LSR_DRDY) == 0);
+	return UART_READ(uart2base, RBR);
+}
+
+int
+sat_tstch(void)
+{
+
+	return (UART_READ(uart2base, LSR)  LSR_DRDY) != 0;
+}
+#endif /* DEBUG */

Index: src/sys/arch/sandpoint/stand/altboot/globals.h
diff -u src/sys/arch/sandpoint/stand/altboot/globals.h:1.13 src/sys/arch/sandpoint/stand/altboot/globals.h:1.14
--- src/sys/arch/sandpoint/stand/altboot/globals.h:1.13	Sun Oct 30 21:08:33 2011
+++ src/sys/arch/sandpoint/stand/altboot/globals.h	Sun Nov  6 20:20:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.h,v 1.13 2011/10/30 21:08:33 phx Exp $ */
+/* $NetBSD: globals.h,v 1.14 2011/11/06 20:20:57 phx Exp $ */
 
 #ifdef DEBUG
 #define	DPRINTF(x)	printf x
@@ -43,6 +43,11 @@ extern uint32_t cpuclock, busclock;
 /* board specific support code */
 struct brdprop *brd_lookup(int);
 int tstchar(void);
+#ifdef DEBUG
+void sat_write(char *, int);
+int sat_getch(void);
+int sat_tstch(void);
+#endif
 unsigned mpc107memsize(void);
 void read_mac_from_flash(uint8_t *);
 

Index: src/sys/arch/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.14 src/sys/arch/sandpoint/stand/altboot/main.c:1.15
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.14	Mon Apr 25 18:29:33 2011
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Sun Nov  6 20:20:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.14 2011/04/25 18:29:33 phx Exp $ */
+/* $NetBSD: main.c,v 1.15 2011/11/06 20:20:57 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -106,6 +106,9 @@ static int check_bootname(char *);
 static int input_cmdline(char **, int);
 static int parse_cmdline(char **, int, char *, char *);
 static int is_space(char);
+#ifdef DEBUG
+static void sat_test(void);
+#endif
 
 #define	BNAME_DEFAULT wd0:
 #define MAX_ARGS 10
@@ -206,7 +209,17 @@ main(int argc, char *argv[], char *boota
 			printf(Hit any key to enter interactive mode: %d\r,
 			n / 100);
 		if (tstchar()) {
+#ifdef DEBUG
+			if (toupper(getchar()) == 'C') {
+/* controller test terminal */
+sat_test();
+n = 200;
+continue;
+			}
+#else
 			(void)getchar();
+#endif
+			/* enter command line */
 			argv = new_argv;
 			argc = input_cmdline(argv, MAX_ARGS);
 			break;
@@ -617,5 +630,60 @@ parse_cmdline(char **argv, int maxargc, 
 static int
 is_space(char c)
 {
+
 	return c  '\0'  c = ' ';
 }
+
+#ifdef DEBUG
+static void
+sat_test(void)
+{
+	char buf[1024];
+	int i, j, n, pos;
+	unsigned char c;
+
+	putchar('\n');
+	for (;;) {
+		do {
+			for (pos = 0; pos  1024  sat_tstch() != 0; pos++)
+buf[pos] = sat_getch();
+			if (pos  1023)
+break;
+			delay(10);
+		} while (sat_tstch());
+
+		for (i = 0; i  pos; i += 16) {
+			if ((n = i + 16)  pos)
+n = pos;
+			for (j = 0; j  n; j++)
+printf(%02x , (unsigned)buf[i + j]);
+			for (; j  16; j++)
+printf(   );
+			putchar('\');
+			for (j = 0; j  n; j++) {
+c = buf[i + j];
+putchar((c = 0x20  c = 0x7e) ? c : '.');
+			}
+			

CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-06 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Nov  6 20:20:57 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c globals.h main.c

Log Message:
Added a test terminal for communicating with the satellite microcontroller.
When compiled with DEBUG option it can be entered by typing 'C'.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sandpoint/stand/altboot/globals.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Nov  1 16:32:57 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c dsk.c pciide.c

Log Message:
The Apollo family of IDE interface chips has both channels disabled by
default, so we have to enable them in a new chipfix function. Also move
the channel enable code for the 82C686B from encpcifix() to pciide.c.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sandpoint/stand/altboot/pciide.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.19 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.20
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.19	Sun Oct 30 21:08:33 2011
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Tue Nov  1 16:32:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.19 2011/10/30 21:08:33 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.20 2011/11/01 16:32:57 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -454,25 +454,20 @@ encpcifix(struct brdprop *brd)
 	/*
 	 *  IDE fixup 
 	 * - native mode (ide 0x09)
-	 * - use primary only (ide 0x40)
 	 */
+
 	/* ide: 0x09 - programming interface; 1000'SsPp */
 	val = pcicfgread(ide, 0x08)  0x00ff;
 	pcicfgwrite(ide, 0x08, val | (0x8f  8));
 
 	/* ide: 0x10-20 - leave them PCI memory space assigned */
-
-	/* ide: 0x40 - use primary only */
-	val = pcicfgread(ide, 0x40) ~ 03;
-	val |= 02;
-	pcicfgwrite(ide, 0x40, val);
 #else
 	/*
 	 *  IDE fixup 
 	 * - compatiblity mode (ide 0x09)
-	 * - use primary only (ide 0x40)
 	 * - remove PCI pin assignment (ide 0x3d)
 	 */
+
 	/* ide: 0x09 - programming interface; 1000'SsPp */
 	val = pcicfgread(ide, 0x08)  0x00ff;
 	val |= (0x8a  8);
@@ -480,22 +475,17 @@ encpcifix(struct brdprop *brd)
 
 	/* ide: 0x10-20 */
 	/*
-	experiment shows writing ide: 0x09 changes these
-	register behaviour. The pcicfgwrite() above writes
-	0x8a at ide: 0x09 to make sure legacy IDE.  Then
-	reading BAR0-3 is to return value 0s even though
-	pcisetup() has written range assignments.  Value
-	overwrite makes no effect. Having 0x8f for native
-	PCIIDE doesn't change register values and brings no
-	weirdness.
+	 * experiment shows writing ide: 0x09 changes these
+	 * register behaviour. The pcicfgwrite() above writes
+	 * 0x8a at ide: 0x09 to make sure legacy IDE.  Then
+	 * reading BAR0-3 is to return value 0s even though
+	 * pcisetup() has written range assignments.  Value
+	 * overwrite makes no effect. Having 0x8f for native
+	 * PCIIDE doesn't change register values and brings no
+	 * weirdness.
 	 */
 
-	/* ide: 0x40 - use primary only */
-	val = pcicfgread(ide, 0x40) ~ 03;
-	val |= 02;
-	pcicfgwrite(ide, 0x40, val);
-
-		/* ide: 0x3d/3c - turn off PCI pin */
+	/* ide: 0x3d/3c - turn off PCI pin */
 	val = pcicfgread(ide, 0x3c)  0x00ff;
 	pcicfgwrite(ide, 0x3c, val);
 #endif

Index: src/sys/arch/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.9 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.10
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.9	Sun Oct 30 21:08:33 2011
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Tue Nov  1 16:32:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.9 2011/10/30 21:08:33 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.10 2011/11/01 16:32:57 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -102,6 +102,8 @@ dskdv_init(void *self)
 	return 0;
   found:
 	pci-drv = (*dv-init)(tag, NULL);
+	if (pci-drv == NULL)
+		return 0;
 	disk_scan(pci-drv);
 	return 1;
 }

Index: src/sys/arch/sandpoint/stand/altboot/pciide.c
diff -u src/sys/arch/sandpoint/stand/altboot/pciide.c:1.7 src/sys/arch/sandpoint/stand/altboot/pciide.c:1.8
--- src/sys/arch/sandpoint/stand/altboot/pciide.c:1.7	Mon Apr 25 18:30:18 2011
+++ src/sys/arch/sandpoint/stand/altboot/pciide.c	Tue Nov  1 16:32:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.7 2011/04/25 18:30:18 phx Exp $ */
+/* $NetBSD: pciide.c,v 1.8 2011/11/01 16:32:57 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 #include globals.h
 
 static int cmdidefix(struct dkdev_ata *);
+static int apoidefix(struct dkdev_ata *);
 
 static uint32_t pciiobase = PCI_XIOBASE;
 
@@ -45,6 +46,7 @@ struct myops {
 };
 static struct myops defaultops = { NULL, NULL };
 static struct myops cmdideops = { cmdidefix, NULL };
+static struct myops apoideops = { apoidefix, NULL };
 static struct myops *myops;
 
 int
@@ -57,9 +59,12 @@ pciide_match(unsigned tag, void *data)
 	case PCI_DEVICE(0x1095, 0x0680): /* SiI 0680 IDE */
 		myops = cmdideops;
 		return 1;
-	case PCI_DEVICE(0x1283, 0x8211): /* ITE 8211 IDE */
+	

CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-01 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Nov  2 04:10:33 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: pciide.c

Log Message:
VIA 82C586A/B 82C686A/B SouthBridges share PCI ID 0x1066-0571.
They are distinguishable by looking at PCI-ISA bridge PCI ID and
revision number.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/altboot/pciide.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/sandpoint/stand/altboot/pciide.c
diff -u src/sys/arch/sandpoint/stand/altboot/pciide.c:1.8 src/sys/arch/sandpoint/stand/altboot/pciide.c:1.9
--- src/sys/arch/sandpoint/stand/altboot/pciide.c:1.8	Tue Nov  1 16:32:57 2011
+++ src/sys/arch/sandpoint/stand/altboot/pciide.c	Wed Nov  2 04:10:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.8 2011/11/01 16:32:57 phx Exp $ */
+/* $NetBSD: pciide.c,v 1.9 2011/11/02 04:10:33 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@ pciide_match(unsigned tag, void *data)
 	case PCI_DEVICE(0x1095, 0x0680): /* SiI 0680 IDE */
 		myops = cmdideops;
 		return 1;
-	case PCI_DEVICE(0x1106, 0x0571): /* VIA 82C586A IDE */
+	case PCI_DEVICE(0x1106, 0x0571): /* VIA 82C586A/B/686A/B IDE */
 	case PCI_DEVICE(0x1106, 0x1571): /* VIA 82C586 IDE */
 	case PCI_DEVICE(0x1106, 0x3164): /* VIA VT6410 RAID IDE */
 		myops = apoideops;



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Nov  1 16:32:57 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c dsk.c pciide.c

Log Message:
The Apollo family of IDE interface chips has both channels disabled by
default, so we have to enable them in a new chipfix function. Also move
the channel enable code for the 82C686B from encpcifix() to pciide.c.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sandpoint/stand/altboot/pciide.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-11-01 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Nov  2 04:10:33 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: pciide.c

Log Message:
VIA 82C586A/B 82C686A/B SouthBridges share PCI ID 0x1066-0571.
They are distinguishable by looking at PCI-ISA bridge PCI ID and
revision number.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/altboot/pciide.c

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



Re: CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-10-31 Thread David Laight
On Sun, Oct 30, 2011 at 09:08:33PM +, Frank Wille wrote:
 Module Name:  src
 Committed By: phx
 Date: Sun Oct 30 21:08:33 UTC 2011
 
 Modified Files:
   src/sys/arch/sandpoint/stand/altboot: brdsetup.c dsk.c entry.S fxp.c
   globals.h nvt.c rge.c skg.c stg.c vge.c
 
 Log Message:
 Added in8() and out8() to access a byte with reorder-protection.
 Use it in all drivers instead of (volatile uint8_t *).

This isn't really an ideal solution, I've have to fight membar
instructions embedded into byteswapping accesses on ppc linux.
Drivers may want to do several accesses that can be reordered
before/after one that matters - so need greater control than
enforcing specific membars.

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-10-31 Thread Frank Wille
David Laight wrote:

 This isn't really an ideal solution, I've have to fight membar
 instructions embedded into byteswapping accesses on ppc linux.
 Drivers may want to do several accesses that can be reordered
 before/after one that matters - so need greater control than
 enforcing specific membars.

Hm. What would you suggest? Is it better to revert this change?

If it is only a matter of performance, I would prefer a slower driver
with increased stability. This is just the boot loader, which reads from
disks with PIO0.

-- 
Frank Wille


CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-10-30 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Oct 30 20:42:09 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: Makefile entry.S
Added Files:
src/sys/arch/sandpoint/stand/altboot: exception.c

Log Message:
Make sure to disable interrupts, as U-Boot may call us with interrupts
enabled, causing quite unpleasant effects (e.g. by decrementer interrupts).

When DEBUG is defined, an exception handler will be installed, which reports
about all exceptions while altboot is running, including register dump and
stack frame backtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sandpoint/stand/altboot/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sandpoint/stand/altboot/entry.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/sandpoint/stand/altboot/exception.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/sandpoint/stand/altboot/Makefile
diff -u src/sys/arch/sandpoint/stand/altboot/Makefile:1.11 src/sys/arch/sandpoint/stand/altboot/Makefile:1.12
--- src/sys/arch/sandpoint/stand/altboot/Makefile:1.11	Wed May 25 19:26:21 2011
+++ src/sys/arch/sandpoint/stand/altboot/Makefile	Sun Oct 30 20:42:09 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2011/05/25 19:26:21 phx Exp $
+#	$NetBSD: Makefile,v 1.12 2011/10/30 20:42:09 phx Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -8,7 +8,7 @@ NOMAN=		# defined
 SRCS=		entry.S main.c brdsetup.c pci.c devopen.c dev_net.c memfs.c
 SRCS+=		nif.c fxp.c tlp.c rge.c skg.c stg.c
 SRCS+=		dsk.c pciide.c siisata.c
-SRCS+=		vers.c
+SRCS+=		exception.c vers.c
 CLEANFILES+=	vers.c ${PROG} ${PROG}.bin ${PROG}.img
 CFLAGS+=	-Wall -Wno-main -ffreestanding -msoft-float -mmultiple
 CFLAGS+=	-Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith

Index: src/sys/arch/sandpoint/stand/altboot/entry.S
diff -u src/sys/arch/sandpoint/stand/altboot/entry.S:1.3 src/sys/arch/sandpoint/stand/altboot/entry.S:1.4
--- src/sys/arch/sandpoint/stand/altboot/entry.S:1.3	Sun Mar 13 15:23:43 2011
+++ src/sys/arch/sandpoint/stand/altboot/entry.S	Sun Oct 30 20:42:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: entry.S,v 1.3 2011/03/13 15:23:43 phx Exp $ */
+/* $NetBSD: entry.S,v 1.4 2011/10/30 20:42:09 phx Exp $ */
 
 #include powerpc/psl.h
 #include powerpc/spr.h
@@ -20,13 +20,20 @@ _start:
 	mr	28,6
 	mr	29,7
 
+	/* Disable interrupts and everything except the MMU. */
+	mfmsr	3
+	andi.	3,3,PSL_DR|PSL_IR
+	mtmsr	3
+	isync
+
 	/*
 	 * U-Boot/PPCBoot forgets to flush the cache when using the bootm
 	 * command, so we have to do that now.
 	 */
 	lis	11,_start@ha
 	addi	11,11,_start@l
-	andi.	11,11,~31@l
+	li	10,-32
+	and	11,11,10
 	lis	12,(_edata+31)@ha
 	addi	12,12,(_edata+31)@l
 	bl	syncicache
@@ -41,8 +48,8 @@ _start:
 	mfmsr	0
 	andi.	0,0,PSL_DR
 	beq	2f
-	lis	5, 0xfec0@ha	/* CONFIG_ADDR of PCI */
-	lis	6, 0xfee0@ha	/* CONFIG_DATA of PCI */
+	lis	5,0xfec0@ha		/* CONFIG_ADDR of PCI */
+	lis	6,0xfee0@ha		/* CONFIG_DATA of PCI */
 	mfspr	3,SPR_DBAT0U
 	mfspr	4,SPR_DBAT0L
 	bl	dbat_sanity_check
@@ -104,13 +111,18 @@ _start:
 	b	5b
 
 6:
-	/* prepare stack at +1MB from _start. */
-	lis	1,_start@h
-	ori	1,1,_start@l
-	addis	1,1,0x10
-	addi	1,1,-4
+	/* prepare stack at +1MB from _start, 16-byte aligned */
+	lis	1,_start@ha
+	addi	1,1,_start@l
+	addis	1,1,0x10@ha
+	li	10,-16
+	and	1,1,10
+	stw	0,0(1)
 
 	bl	brdsetup
+#ifdef DEBUG
+	bl	init_vectors
+#endif
 	mr	3,30
 	mr	4,31
 	mr	5,28
@@ -152,7 +164,7 @@ dbat_sanity_check:
  */
 	.globl	run
 run:
-	mtctr	7 	/* hat trick jump to entry point */
+	mtctr	7			/* hat trick jump to entry point */
 	bctr
 
 /*
@@ -198,38 +210,115 @@ newaltboot_end:
 /*
  * reverse endian access to mimic outw/outl/inw/inl
  */
-	.globl out16rb
-	.globl iohtole16
+	.globl	out16rb
+	.globl	iohtole16
 out16rb:
 iohtole16:
 	sthbrx	4,0,3
 	eieio
 	blr 
 
-	.globl out32rb
-	.globl iohtole32
+	.globl	out32rb
+	.globl	iohtole32
 out32rb:
 iohtole32:
 	stwbrx	4,0,3
 	eieio
 	blr
 
-	.global in16rb
-	.global iole16toh
+	.globl	in16rb
+	.globl	iole16toh
 in16rb:
 iole16toh:
 	lhbrx	3,0,3
 	eieio
 	blr
 
-	.global in32rb
-	.global iole32toh
+	.globl	in32rb
+	.globl	iole32toh
 in32rb:
 iole32toh:
 	lwbrx	3,0,3
 	eieio
 	blr
 
+#ifdef DEBUG
+	/*
+	 * Call an exception handler, which prints out all information
+	 * about the type of exception, cpu registers, stack frame
+	 * backtrace, etc.
+	 * Use a new stack at 0x2000 and make room for 32 GPRs, and 15
+	 * special registers. The layout will be:
+	 * 0x00: link area
+	 * 0x10: R0
+	 * ...
+	 * 0x8c: R31
+	 * 0x90: CR, XER, LR, CTR
+	 * 0xa0: SRR0, SRR1, DAR, DSISR
+	 * 0xb0: DMISS, DCMP, HASH1, HASH2
+	 * 0xc0: IMISS, ICMP, RPA
+	 *
+	 */
+	.globl	trap
+trap:
+	mtsprg1	1
+	mfmsr	1
+	andis.	1,1,PSL_TGPR@h
+	beq	1f
+	andi.	1,1,0x		/* make sure TGPR is disabled */
+	mtmsr	1
+	isync
+	mtsprg1	1			/* and save the real r1 again */
+1:	li	1,0x2000-16-(32*4+15*4)
+	stmw	2,24(1)			/* save 

CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-10-30 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Oct 30 21:08:33 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c dsk.c entry.S fxp.c
globals.h nvt.c rge.c skg.c stg.c vge.c

Log Message:
Added in8() and out8() to access a byte with reorder-protection.
Use it in all drivers instead of (volatile uint8_t *).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/altboot/dsk.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/altboot/entry.S
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sandpoint/stand/altboot/fxp.c \
src/sys/arch/sandpoint/stand/altboot/nvt.c \
src/sys/arch/sandpoint/stand/altboot/vge.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sandpoint/stand/altboot/globals.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/rge.c \
src/sys/arch/sandpoint/stand/altboot/stg.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sandpoint/stand/altboot/skg.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.18 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.19
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.18	Sun May 29 18:06:45 2011
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sun Oct 30 21:08:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.18 2011/05/29 18:06:45 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.19 2011/10/30 21:08:33 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -172,8 +172,8 @@ unsigned uart2base;	/* optional satellit
 #define  LSR_THRE	0x20
 #define  LSR_DRDY	0x01
 #define DCR		0x11
-#define UART_READ(base, r)	*(volatile char *)(base + (r))
-#define UART_WRITE(base, r, v)	*(volatile char *)(base + (r)) = (v)
+#define UART_READ(base, r)	in8(base + (r))
+#define UART_WRITE(base, r, v)	out8(base + (r), (v))
 
 void brdsetup(void);	/* called by entry.S */
 

Index: src/sys/arch/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.8 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.9
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.8	Sun Jul 17 20:54:46 2011
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Sun Oct 30 21:08:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.8 2011/07/17 20:54:46 joerg Exp $ */
+/* $NetBSD: dsk.c,v 1.9 2011/10/30 21:08:33 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,8 +56,8 @@
  */
 #define CSR_READ_4(r)		in32rb(r)
 #define CSR_WRITE_4(r,v)	out32rb(r,v)
-#define CSR_READ_1(r)		*(volatile uint8_t *)(r)
-#define CSR_WRITE_1(r,v)	*(volatile uint8_t *)(r)=(v)
+#define CSR_READ_1(r)		in8(r)
+#define CSR_WRITE_1(r,v)	out8(r,v)
 
 struct dskdv {
 	char *name;

Index: src/sys/arch/sandpoint/stand/altboot/entry.S
diff -u src/sys/arch/sandpoint/stand/altboot/entry.S:1.4 src/sys/arch/sandpoint/stand/altboot/entry.S:1.5
--- src/sys/arch/sandpoint/stand/altboot/entry.S:1.4	Sun Oct 30 20:42:09 2011
+++ src/sys/arch/sandpoint/stand/altboot/entry.S	Sun Oct 30 21:08:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: entry.S,v 1.4 2011/10/30 20:42:09 phx Exp $ */
+/* $NetBSD: entry.S,v 1.5 2011/10/30 21:08:33 phx Exp $ */
 
 #include powerpc/psl.h
 #include powerpc/spr.h
@@ -207,6 +207,20 @@ syncicache:
 	.globl	newaltboot_end
 newaltboot_end:
 
+
+/* 8-bit i/o access */
+	.globl	out8
+out8:
+	stb	4,0(3)
+	eieio
+	blr
+
+	.globl	in8
+in8:
+	lbz	3,0(3)
+	eieio
+	blr
+
 /*
  * reverse endian access to mimic outw/outl/inw/inl
  */

Index: src/sys/arch/sandpoint/stand/altboot/fxp.c
diff -u src/sys/arch/sandpoint/stand/altboot/fxp.c:1.2 src/sys/arch/sandpoint/stand/altboot/fxp.c:1.3
--- src/sys/arch/sandpoint/stand/altboot/fxp.c:1.2	Thu Jan 27 17:38:04 2011
+++ src/sys/arch/sandpoint/stand/altboot/fxp.c	Sun Oct 30 21:08:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: fxp.c,v 1.2 2011/01/27 17:38:04 phx Exp $ */
+/* $NetBSD: fxp.c,v 1.3 2011/10/30 21:08:33 phx Exp $ */
 
 /*
  * most of the following code was imported from dev/ic/i82557.c; the
@@ -86,8 +86,8 @@
  * - no vtophys() translation, vaddr_t == paddr_t. 
  * - PIPT writeback cache aware.
  */
-#define CSR_WRITE_1(l, r, v)	*(volatile uint8_t *)((l)-iobase+(r)) = (v)
-#define CSR_READ_1(l, r)	*(volatile uint8_t *)((l)-iobase+(r))
+#define CSR_WRITE_1(l, r, v)	out8((l)-iobase+(r), (v))
+#define CSR_READ_1(l, r)	in8((l)-iobase+(r))
 #define CSR_WRITE_2(l, r, v)	out16rb((l)-iobase+(r), (v))
 #define CSR_READ_2(l, r)	in16rb((l)-iobase+(r))
 #define CSR_WRITE_4(l, r, v) 	out32rb((l)-iobase+(r), (v))
Index: src/sys/arch/sandpoint/stand/altboot/nvt.c
diff -u src/sys/arch/sandpoint/stand/altboot/nvt.c:1.2 src/sys/arch/sandpoint/stand/altboot/nvt.c:1.3
--- src/sys/arch/sandpoint/stand/altboot/nvt.c:1.2	Thu Jan 27 17:38:04 2011
+++ src/sys/arch/sandpoint/stand/altboot/nvt.c	Sun Oct 30 21:08:33 2011
@@ -1,4 +1,4 @@

  1   2   >