CVS commit: src/sys/arch/evbarm/stand/boot2440

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

Modified Files:
src/sys/arch/evbarm/stand/boot2440: s3csdi.c

Log Message:
PR/50526: David Binderman: Fix incorrect test


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/stand/boot2440/s3csdi.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/evbarm/stand/boot2440/s3csdi.c
diff -u src/sys/arch/evbarm/stand/boot2440/s3csdi.c:1.3 src/sys/arch/evbarm/stand/boot2440/s3csdi.c:1.4
--- src/sys/arch/evbarm/stand/boot2440/s3csdi.c:1.3	Sat Oct 27 13:17:49 2012
+++ src/sys/arch/evbarm/stand/boot2440/s3csdi.c	Sun Dec 13 14:18:32 2015
@@ -90,7 +90,7 @@ s3csd_init(unsigned int tag, uint32_t *c
 
 	/* Check if a card is present */
 	data = *(volatile uint32_t*)(S3C2440_GPIO_BASE+GPIO_PGDAT);
-	if ( (data & (1<<8)) == 1) {
+	if ( (data & (1<<8)) == (1<<8)) {
 		printf("No card detected\n");
 		/* Pin 8 is low when no card is inserted */
 		return 0;



CVS commit: src/sys/arch/evbarm/stand/boot2440

2014-11-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 29 08:15:07 UTC 2014

Modified Files:
src/sys/arch/evbarm/stand/boot2440: main.c

Log Message:
Make this work with earm kernels. Not sure the test is realy worth it.

Partially from Greg Willatt


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/main.c
diff -u src/sys/arch/evbarm/stand/boot2440/main.c:1.4 src/sys/arch/evbarm/stand/boot2440/main.c:1.5
--- src/sys/arch/evbarm/stand/boot2440/main.c:1.4	Sun Dec  1 02:52:53 2013
+++ src/sys/arch/evbarm/stand/boot2440/main.c	Sat Nov 29 08:15:07 2014
@@ -112,7 +112,7 @@ main(int argc, char *argv[])
 	int fclk, hclk;
 	int fd;
 	unsigned long marks[MARK_MAX];
-	unsigned char hdr[0x26];
+	unsigned char hdr[0x28];
 	void (*entry)(void*);
 	unsigned elfpriv;
 	char *bootfile;
@@ -236,16 +236,17 @@ main(int argc, char *argv[])
 #endif
 	/*
 	 * ARM ELF header has a distinctive value in "private flags"
-	 * field of offset [0x24:25];
-	 * - NetBSD 02 06
+	 * field of offset [0x24-x027];
+	 * - NetBSD 02 06 (oarm)
 	 * - Linux  02 00 (2.4) or 02 02 (2.6)
+	 * - NetBSD 02 00 00 05 (earm)
 	 */
 	lseek(fd, (off_t)0, SEEK_SET);
 	read(fd, &hdr, sizeof(hdr));
 	memcpy(&elfpriv, &hdr[0x24], sizeof(elfpriv));
 
 	entry = (void *)marks[MARK_ENTRY];
-	if (elfpriv == 0x0602) {
+	if (elfpriv == 0x0602 || elfpriv == 0x502) {
 		struct btinfo_symtab bi_syms;
 
 		bi_syms.nsym = marks[MARK_NSYM];



CVS commit: src/sys/arch/evbarm/stand/boot2440

2013-11-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Dec  1 02:52:53 UTC 2013

Modified Files:
src/sys/arch/evbarm/stand/boot2440: main.c

Log Message:
Inform compiler that the volatile assignment will terminate the function.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/main.c
diff -u src/sys/arch/evbarm/stand/boot2440/main.c:1.3 src/sys/arch/evbarm/stand/boot2440/main.c:1.4
--- src/sys/arch/evbarm/stand/boot2440/main.c:1.3	Mon Nov  4 21:54:59 2013
+++ src/sys/arch/evbarm/stand/boot2440/main.c	Sun Dec  1 02:52:53 2013
@@ -498,6 +498,7 @@ _rtt()
 	*(volatile uint32_t *)(S3C2440_WDT_BASE + WDT_WTCON) =
 		(0 << WTCON_PRESCALE_SHIFT) | WTCON_ENABLE |
 		WTCON_CLKSEL_16 | WTCON_ENRST;
+	__builtin_unreachable();
 }
 
 void



CVS commit: src/sys/arch/evbarm/stand/boot2440

2013-11-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Dec  1 02:53:07 UTC 2013

Modified Files:
src/sys/arch/evbarm/stand/boot2440: netif.c

Log Message:
Use format strings.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/stand/boot2440/netif.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/evbarm/stand/boot2440/netif.c
diff -u src/sys/arch/evbarm/stand/boot2440/netif.c:1.1 src/sys/arch/evbarm/stand/boot2440/netif.c:1.2
--- src/sys/arch/evbarm/stand/boot2440/netif.c:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/netif.c	Sun Dec  1 02:53:07 2013
@@ -79,10 +79,10 @@ netif_match(unsigned int tag, uint8_t *m
 		dv = &vnifdv[n];
 		if ((*dv->match)(tag, macaddr) > 0) {
 			nifmatch[n] = 1;
-			snprintf(bi_rdev.devname, sizeof(bi_rdev.devname), dv->name);
+			snprintf(bi_rdev.devname, sizeof(bi_rdev.devname), "%s", dv->name);
 			bi_rdev.cookie = tag;
 
-			snprintf(bi_net.devname, sizeof(bi_net.devname), dv->name);
+			snprintf(bi_net.devname, sizeof(bi_net.devname), "%s", dv->name);
 			bi_net.cookie = tag;
 			memcpy(bi_net.mac_address, macaddr, sizeof(bi_net.mac_address));
 			break;
@@ -113,10 +113,10 @@ netif_init(unsigned int tag, uint8_t *ma
 	s->io_netif = dv;
 	memcpy(s->myea, enaddr, sizeof(s->myea));
 
-	snprintf(bi_rdev.devname, sizeof(bi_rdev.devname), dv->name);
+	snprintf(bi_rdev.devname, sizeof(bi_rdev.devname), "%s", dv->name);
 	bi_rdev.cookie = tag;
 
-	snprintf(bi_net.devname, sizeof(bi_net.devname), dv->name);
+	snprintf(bi_net.devname, sizeof(bi_net.devname), "%s", dv->name);
 	bi_net.cookie = tag;
 	memcpy(bi_net.mac_address, enaddr, sizeof(bi_net.mac_address));
 	return 1;



CVS commit: src/sys/arch/evbarm/stand/boot2440

2013-11-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov  4 21:54:59 UTC 2013

Modified Files:
src/sys/arch/evbarm/stand/boot2440: dev_sdmmc.c main.c

Log Message:
make unused.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/stand/boot2440/dev_sdmmc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/dev_sdmmc.c
diff -u src/sys/arch/evbarm/stand/boot2440/dev_sdmmc.c:1.1 src/sys/arch/evbarm/stand/boot2440/dev_sdmmc.c:1.2
--- src/sys/arch/evbarm/stand/boot2440/dev_sdmmc.c:1.1	Sun Jan 29 22:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/dev_sdmmc.c	Mon Nov  4 16:54:59 2013
@@ -195,7 +195,7 @@ int
 sdmmc_open(struct open_file *of, ...)
 {
 	va_list ap;
-	int unit, part;
+	int unit __unused, part;
 
 	va_start(ap, of);
 	unit = va_arg(ap, u_int); /* Not used for now */

Index: src/sys/arch/evbarm/stand/boot2440/main.c
diff -u src/sys/arch/evbarm/stand/boot2440/main.c:1.2 src/sys/arch/evbarm/stand/boot2440/main.c:1.3
--- src/sys/arch/evbarm/stand/boot2440/main.c:1.2	Wed Feb 22 07:21:23 2012
+++ src/sys/arch/evbarm/stand/boot2440/main.c	Mon Nov  4 16:54:59 2013
@@ -242,7 +242,7 @@ main(int argc, char *argv[])
 	 */
 	lseek(fd, (off_t)0, SEEK_SET);
 	read(fd, &hdr, sizeof(hdr));
-	elfpriv = *(unsigned short *)&hdr[0x24];
+	memcpy(&elfpriv, &hdr[0x24], sizeof(elfpriv));
 
 	entry = (void *)marks[MARK_ENTRY];
 	if (elfpriv == 0x0602) {
@@ -399,6 +399,7 @@ mini2440_panic()
 		for(l=0; l<0xff; l++) {
 			v = *((int*)(S3C2440_TIMER_BASE+TIMER_TCNTO(0)));
 		}
+		__USE(v);
 	}
 }
 



CVS commit: src/sys/arch/evbarm/stand/boot2440

2013-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 21 05:59:14 UTC 2013

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile

Log Message:
Use 
DBG=-Os (instead of blank)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.10 src/sys/arch/evbarm/stand/boot2440/Makefile:1.11
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.10	Thu Aug 15 21:41:08 2013
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Wed Aug 21 05:59:14 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2013/08/15 21:41:08 matt Exp $
+#	$NetBSD: Makefile,v 1.11 2013/08/21 05:59:14 matt Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -7,6 +7,7 @@ SRCS=		entry.S main.c devopen.c netif.c 
 SRCS+=		s3csdi.c vers.c
 
 .include 
+.include 
 
 CLEANFILES+=	vers.c ${PROG}.elf
 CFLAGS+=	-Wall -Wno-main -ffreestanding -fno-unwind-tables
@@ -17,7 +18,7 @@ CPPFLAGS+=	-nostdinc -I. -I${.OBJDIR} -I
 CPPFLAGS+=	-march=armv4 -mabi=apcs-gnu -mfloat-abi=soft
 CPPFLAGS+=	-mno-thumb -mno-thumb-interwork
 CPUFLAGS=
-DBG=		
+DBG=		-Os
 
 LIBCRT0=	# nothing
 LIBCRTBEGIN=	# nothing
@@ -32,14 +33,6 @@ BINMODE=	444
 RELOC=		0x30A0
 ENTRY=		_start
 
-.if !make(obj) && !make(clean) && !make(cleandir)
-.BEGIN:
-	@[ -h machine ] || ln -s ${S}/arch/evbarm/include machine
-	@[ -h arm ] || ln -s ${S}/arch/arm/include arm
-.NOPATH: machine arm
-.endif
-CLEANFILES+= machine arm
-
 ### find out what to use for libkern
 KERN_AS=	library
 .include "${S}/lib/libkern/Makefile.inc"



CVS commit: src/sys/arch/evbarm/stand/boot2440

2013-06-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jun 23 13:56:40 UTC 2013

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile

Log Message:
Add -fno-unwind-tables


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.8 src/sys/arch/evbarm/stand/boot2440/Makefile:1.9
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.8	Fri Mar 29 17:01:00 2013
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Sun Jun 23 13:56:40 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2013/03/29 17:01:00 matt Exp $
+#	$NetBSD: Makefile,v 1.9 2013/06/23 13:56:40 matt Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -9,7 +9,7 @@ SRCS+=		s3csdi.c vers.c
 .include 
 
 CLEANFILES+=	vers.c ${PROG}.elf
-CFLAGS+=	-Wall -Wno-main -ffreestanding
+CFLAGS+=	-Wall -Wno-main -ffreestanding -fno-unwind-tables
 CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP -DLIBSA_PRINTF_WIDTH_SUPPORT
 CPPFLAGS+=	-DDM9000MAC="0x08,0x08,0x11,0x18,0x12,0x27" 
 CPPFLAGS+=	-DDEFAULT_BOOTFILE="ld0a:netbsd;net:"



CVS commit: src/sys/arch/evbarm/stand/boot2440

2013-03-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 29 17:01:00 UTC 2013

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile

Log Message:
Make sure CPUFLAGS remains empty.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.7 src/sys/arch/evbarm/stand/boot2440/Makefile:1.8
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.7	Wed Feb  6 07:19:19 2013
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Fri Mar 29 17:01:00 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2013/02/06 07:19:19 matt Exp $
+#	$NetBSD: Makefile,v 1.8 2013/03/29 17:01:00 matt Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -15,6 +15,7 @@ CPPFLAGS+=	-DDM9000MAC="0x08,0x08,0x11,0
 CPPFLAGS+=	-DDEFAULT_BOOTFILE="ld0a:netbsd;net:"
 CPPFLAGS+=	-nostdinc -I. -I${.OBJDIR} -I${S} -I${S}/arch
 CPPFLAGS+=	-march=armv4 -mabi=apcs-gnu -mfloat-abi=soft
+CPUFLAGS=
 DBG=		
 
 LIBCRT0=	# nothing



CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 12 15:00:06 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile

Log Message:
Don't allow CPUFLAGS to be overridden.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.4 src/sys/arch/evbarm/stand/boot2440/Makefile:1.5
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.4	Fri Jul 20 14:53:27 2012
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Wed Dec 12 15:00:06 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2012/07/20 14:53:27 matt Exp $
+#	$NetBSD: Makefile,v 1.5 2012/12/12 15:00:06 matt Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -9,11 +9,12 @@ SRCS+=		s3csdi.c vers.c
 .include 
 
 CLEANFILES+=	vers.c ${PROG}.elf
-CFLAGS+=	-Wall -Wno-main -ffreestanding -march=armv4
+CFLAGS+=	-Wall -Wno-main -ffreestanding
 CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP -DLIBSA_PRINTF_WIDTH_SUPPORT
 CPPFLAGS+=	-DDM9000MAC="0x08,0x08,0x11,0x18,0x12,0x27" 
 CPPFLAGS+=	-DDEFAULT_BOOTFILE="ld0a:netbsd;net:"
 CPPFLAGS+=	-nostdinc -I. -I${.OBJDIR} -I${S} -I${S}/arch
+CPUFLAGS=	-march=armv4
 DBG=		
 
 LIBCRT0=	# nothing



CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-07-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jul 20 14:53:52 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: s3csdi.c

Log Message:
Add  include for intmax_t


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/stand/boot2440/s3csdi.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/evbarm/stand/boot2440/s3csdi.c
diff -u src/sys/arch/evbarm/stand/boot2440/s3csdi.c:1.1 src/sys/arch/evbarm/stand/boot2440/s3csdi.c:1.2
--- src/sys/arch/evbarm/stand/boot2440/s3csdi.c:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/s3csdi.c	Fri Jul 20 14:53:52 2012
@@ -32,6 +32,7 @@
 
 #include 
 
+#include 
 #include 
 
 #include 



CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-07-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jul 20 14:53:27 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile

Log Message:
Add ${_MKTARGET_LINK}


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.3 src/sys/arch/evbarm/stand/boot2440/Makefile:1.4
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.3	Wed Feb 22 12:12:21 2012
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Fri Jul 20 14:53:27 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2012/02/22 12:12:21 nisimura Exp $
+#	$NetBSD: Makefile,v 1.4 2012/07/20 14:53:27 matt Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -59,6 +59,7 @@ vers.c: version
 	${${MKREPRO} == "yes" :?:-D} ${.CURDIR}/version "evbarm"
 
 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
+	${_MKTARGET_LINK}
 	${LD} -N -Ttext ${RELOC} -Bstatic -e ${ENTRY} -o ${.TARGET}.elf \
 	${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${OBJCOPY} -S -O binary ${.TARGET}.elf ${.TARGET}



CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-02-23 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Thu Feb 23 22:20:51 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: dm9000.c

Log Message:
- add short comments at the most troublesome part of this device.
- remove a stale debug line.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/stand/boot2440/dm9000.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/evbarm/stand/boot2440/dm9000.c
diff -u src/sys/arch/evbarm/stand/boot2440/dm9000.c:1.1 src/sys/arch/evbarm/stand/boot2440/dm9000.c:1.2
--- src/sys/arch/evbarm/stand/boot2440/dm9000.c:1.1	Wed Feb 22 12:08:41 2012
+++ src/sys/arch/evbarm/stand/boot2440/dm9000.c	Thu Feb 23 22:20:51 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: dm9000.c,v 1.1 2012/02/22 12:08:41 nisimura Exp $ */
+/* $NetBSD: dm9000.c,v 1.2 2012/02/23 22:20:51 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -324,8 +324,6 @@ dm9k_send(void *dev, char *buf, unsigned
 	return len;
 }
 
-void hexdump16(char *p);
-
 int
 dm9k_recv(void *dev, char *buf, unsigned int maxlen, unsigned int timo)
 {
@@ -348,7 +346,7 @@ dm9k_recv(void *dev, char *buf, unsigned
   gotone:
 	CSR_WRITE_1(l, ISR, ISR_PRS); /* clear ISR Rx complete bit */
 	(void) CSR_READ_2(l, MRCMDX); /* dummy read */
-	mark = CSR_READ_2(l, MRCMDX);
+	mark = CSR_READ_2(l, MRCMDX); /* mark in [7:0] */
 	if ((mark & 03) != 01) {
 		stat = CSR_READ_1(l, RSR);
 		printf("dm9k_recv: mark %x, RSR %x\n", mark, stat);
@@ -356,7 +354,7 @@ dm9k_recv(void *dev, char *buf, unsigned
 		goto again;
 	}
 
-	stat = CSR_READ_2(l, MRCMD);
+	stat = CSR_READ_2(l, MRCMD); /* stat in [15:8] */
 	len  = CSR_READ_2(l, MRCMD);
 
 	/* should not happen, make sure to discard bcast/mcast frames */



CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-02-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Feb 22 12:21:24 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: entry.S main.c

Log Message:
- detect SoC chipid value found at 0x5600'00b0.
- have brdsetup() to define SoC IOMUX in early startup. Device drivers
  are still responsible to arrange relevent registers which they use.
- some cleanup and clarification.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/stand/boot2440/entry.S \
src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/entry.S
diff -u src/sys/arch/evbarm/stand/boot2440/entry.S:1.1 src/sys/arch/evbarm/stand/boot2440/entry.S:1.2
--- src/sys/arch/evbarm/stand/boot2440/entry.S:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/entry.S	Wed Feb 22 12:21:23 2012
@@ -40,7 +40,8 @@
 #ifndef	SDRAM_START
 #define	SDRAM_START	S3C2440_SDRAM_START
 #endif
-	
+
+/* LED1/2/3/4 are manipulated by GPIO B5/6/7/8. */
 #define LED1 (1<<5)
 #define LED2 (1<<6)
 #define LED3 (1<<7)
@@ -50,7 +51,7 @@
 	.global _start
 _start:
 	/* Get arguments from boot-loader (stored in r0 and r1) */
-	adr	r2, bootloader_args
+	adr	r2, Largs
 	stmia	r2, {r0, r1}
 
 	/* Disable interrupt */
@@ -125,7 +126,7 @@ _start:
 bgt .L1
 
 	
-	adr	r2, bootloader_args
+	adr	r2, Largs
 	ldmia	r2, {r0, r1}
 
 	/* Jump to kernel code in TRUE VA */
@@ -134,11 +135,6 @@ _start:
 Lstart:
 	.word	main
 	
-	.macro clock_data  hdivn, pdivn, mdiv, pdiv, sdiv
-	.word	(\hdivn)<<1 | \pdivn
-	.word	(\mdiv)<>L1_S_SHIFT)			; \
@@ -161,6 +157,5 @@ Lcrtsetup:
 	.word	_end	/* End of BSS */
 	.word	0x30A0 /* Place stack-bottom at load-point of libsa bootloader */
 
-	.global _C_LABEL(bootloader_args)
-_C_LABEL(bootloader_args):
-	.space	8 /* Two registers */
+Largs:
+	.space	8 /* to save r0/r1 registers */
Index: src/sys/arch/evbarm/stand/boot2440/main.c
diff -u src/sys/arch/evbarm/stand/boot2440/main.c:1.1 src/sys/arch/evbarm/stand/boot2440/main.c:1.2
--- src/sys/arch/evbarm/stand/boot2440/main.c:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/main.c	Wed Feb 22 12:21:23 2012
@@ -84,6 +84,8 @@ static void time_init(uint32_t pclk);
 static void bi_init(void *addr);
 static void bi_add(void *new, int type, int size);
 static void parse_mac_address(const char *str, uint8_t *enaddr);
+static void brdsetup(void);
+static void iomux(int, const char *);
 
 extern void* dm9k_init(unsigned int tag, void *macaddr);
 
@@ -95,6 +97,7 @@ extern void netif_match(unsigned int tag
 /*  extern int sdif_init(unsigned int tag);*/
 
 /* Global variables */
+uint32_t socmodel;
 int pclk;
 struct btinfo_rootdevice	bi_rdev;
 
@@ -117,6 +120,10 @@ main(int argc, char *argv[])
 	bool kernel_loaded;
 	uint8_t enaddr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
+	socmodel = CSR_READ(S3C2440_GPIO_BASE + GPIO_GSTATUS1);
+
+	brdsetup();
+
 	/* Give some indication that main() has been reached */
 	CLEAR_LEDS();
 	LED_ON(4);
@@ -144,6 +151,14 @@ main(int argc, char *argv[])
 	/* Let the user know we are alive */
 	printf("\n");
 	printf(">> %s boot2440, revision %s\n", bootprog_name, bootprog_rev);
+	printf("SoC model:");
+	switch (socmodel) {
+	case 0x3244:
+		printf(" S3C2440"); break;
+	case 0x32440001:
+		printf(" S3C2440A"); break;
+	}
+	printf(" (chipid %08x)\n", socmodel);
 
 	bootinfo = (void*) BOOTINFO_ADDR;
 	bi_init(bootinfo);
@@ -156,8 +171,6 @@ main(int argc, char *argv[])
 		struct btinfo_bootstring ba;
 		int j, i;
 
-		printf("Argument count: %d\n", argc);
-
 		j = 0;
 		for (i = 0; i < argc; i++) {
 			if (j == MAX_BOOT_STRING-1) {
@@ -174,9 +187,6 @@ main(int argc, char *argv[])
 j += strlen(argv[i]);
 			}
 		}
-
-		printf("Boot string: %s\n", ba.bootstring);
-
 		bi_add(&ba, BTINFO_BOOTSTRING, sizeof(ba));
 	}
 
@@ -534,3 +544,93 @@ parse_mac_address(const char *str, uint8
 		}
 	}
 }
+
+static void
+brdsetup(void)
+{
+/*
+ * MINI2440 pin usage summary
+ *
+ *  B5	output	LED1 control
+ *  B6	output	LED2 control
+ *  B7	output	LED3 control
+ *  B8	output	LED4 control
+ *  G0	EINT8	K1 button
+ *  G3	EINT11	K2 button
+ *  G5	EINT13	K3 button
+ *  G6	EINT14	K4 button
+ *  G7	EINT15	K5 button
+ *  G11	EINT19	K6 button
+ *  F7	EINT7	DM9000 interrupt
+ *  G12	EINT20	camera interrupt
+ *  G8	input	SD card presense detect
+ *  H8	input	SD write protect sense
+ *  B0	TOUT0	buzzer PWM
+ *  B1	TOUT1	LCD backlight PWM
+ *  B2	output	UDA1341 audio L3MODE
+ *  B3	output	UDA1341 audio L3DATA
+ *  B4	output	UDA1341 audio L3LOCK
+ *
+ *  A21, A11, G15, G14, G13: not used.
+ *
+ *  i   input sense
+ *  o   output control
+ *  2   function 2
+ *  3   function 3
+ *  0   output control (A only)
+ *  1   function 1 (A only)
+ *  ./x no function, not connected or don't-care
+ *  
+ * A .

CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-02-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Feb 22 12:12:21 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile

Log Message:
- adapt DM9000 driver name change.
- move -DLIBSA_PRINTF_WIDTH_SUPPORT to CPPFLAGS variable as SACPPFLAGS
  does not work.
- add a logic to make/remove machine/ and arm/ symlinks.
- remove redundant directives in no use.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.2 src/sys/arch/evbarm/stand/boot2440/Makefile:1.3
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.2	Tue Jan 31 11:04:17 2012
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Wed Feb 22 12:12:21 2012
@@ -1,18 +1,19 @@
-#	$NetBSD: Makefile,v 1.2 2012/01/31 11:04:17 nisimura Exp $
+#	$NetBSD: Makefile,v 1.3 2012/02/22 12:12:21 nisimura Exp $
 
 S=		${.CURDIR}/../../../..
+
 PROG=		bootmini2440
-SRCS=		entry.S main.c devopen.c netif.c dev_net.c dm9k.c dev_sdmmc.c
+SRCS=		entry.S main.c devopen.c netif.c dev_net.c dm9000.c dev_sdmmc.c
 SRCS+=		s3csdi.c vers.c
 
 .include 
 
 CLEANFILES+=	vers.c ${PROG}.elf
 CFLAGS+=	-Wall -Wno-main -ffreestanding -march=armv4
-CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP 
+CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP -DLIBSA_PRINTF_WIDTH_SUPPORT
 CPPFLAGS+=	-DDM9000MAC="0x08,0x08,0x11,0x18,0x12,0x27" 
 CPPFLAGS+=	-DDEFAULT_BOOTFILE="ld0a:netbsd;net:"
-CPPFLAGS+=	-nostdinc -I. -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch
+CPPFLAGS+=	-nostdinc -I. -I${.OBJDIR} -I${S} -I${S}/arch
 DBG=		
 
 LIBCRT0=	# nothing
@@ -28,6 +29,14 @@ BINMODE=	444
 RELOC=		0x30A0
 ENTRY=		_start
 
+.if !make(obj) && !make(clean) && !make(cleandir)
+.BEGIN:
+	@[ -h machine ] || ln -s ${S}/arch/evbarm/include machine
+	@[ -h arm ] || ln -s ${S}/arch/arm/include arm
+.NOPATH: machine arm
+.endif
+CLEANFILES+= machine arm
+
 ### find out what to use for libkern
 KERN_AS=	library
 .include "${S}/lib/libkern/Makefile.inc"
@@ -41,7 +50,6 @@ LIBZ=		${ZLIB}
 ### find out what to use for libsa
 SA_AS=		library
 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
-SACPPFLAGS=	-DLIBSA_PRINTF_WIDTH_SUPPORT
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA=		${SALIB}
 
@@ -55,12 +63,4 @@ ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBK
 	${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${OBJCOPY} -S -O binary ${.TARGET}.elf ${.TARGET}
 
-
-.include 
 .include 
-
-cleandir distclean: .WAIT cleanlibdir
-
-cleanlibdir:
-	-rm -rf lib
-



CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-02-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Feb 22 12:08:41 UTC 2012

Added Files:
src/sys/arch/evbarm/stand/boot2440: dm9000.c
Removed Files:
src/sys/arch/evbarm/stand/boot2440: dm9k.c

Log Message:
Reimplement DM9000E driver.
- add a note about 16bit mode operation.
- make sure not to receive any mcast/bcast frames by clearing 64bit
  multicast filter hash value register.
- change the filename so as silimar to other implementations.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/stand/boot2440/dm9000.c
cvs rdiff -u -r1.1 -r0 src/sys/arch/evbarm/stand/boot2440/dm9k.c

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

Added files:

Index: src/sys/arch/evbarm/stand/boot2440/dm9000.c
diff -u /dev/null src/sys/arch/evbarm/stand/boot2440/dm9000.c:1.1
--- /dev/null	Wed Feb 22 12:08:41 2012
+++ src/sys/arch/evbarm/stand/boot2440/dm9000.c	Wed Feb 22 12:08:41 2012
@@ -0,0 +1,454 @@
+/* $NetBSD: dm9000.c,v 1.1 2012/02/22 12:08:41 nisimura Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tohru Nishimura.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/*
+ * This DM9000 is wired as a 16bit device and manages Tx/Rx SRAM buffer
+ * in 16bit quantity.  MRCMD/MWCMD access increments buffer pointer
+ * by two regardless of r/w size.  Mixing 16/8bit access is not possible.
+ * Byte read would end up with loosing every odd indexed datum.
+ *
+ * The DM9000 CMD pin is tied with SoC LADDR2 address line.  SA9-SA4
+ * pins are hardwired to fixed decoding 0x300.  Thus address [26:3] in
+ * CS4 range 0x2000' are don't-care bits to manipulate the chip.
+ * The DM9000 INDEX port is accessed at the address b'000 while the
+ * DATA port at the address b'100.
+ *
+ * This code assumes Little endian CPU.
+ */
+
+#define NCR	0x00		/* control */
+#define  NCR_FDX	(1<<3)	/* FDX link detection report */
+#define  NCR_RST	(1<<0)	/* instruct reset, goes 0 at done */
+#define NSR	0x01		/* status */
+#define  NSR_SPEED	(1<<7)	/* 1->100M, 0->10M, when link is up */
+#define  NSR_LINKST	(1<<6)	/* 1->linkup, 0->linkdown */
+#define  NSR_TX2END	(1<<3)	/* Tx frame #2 completed */
+#define  NSR_TX1END	(1<<2)	/* Tx frame #1 completed */
+#define  NSR_RXOV	(1<<1)	/* Rx FIFO overflow detected */
+#define TCR	0x02		/* Tx control */
+#define  TCR_TXREQ	0x01	/* request to start transmit, goes 0 at done */
+#define TCR2	0x2d		/* Tx control #2 */
+#define  TCR2_ONEPM	0x10	/* send single Tx frame at a time */
+#define RCR	0x05		/* Rx control */
+#define  RCR_WTDIS	0x40	/* disable frame receipt watchdog timer */
+#define  RCR_DIS_LONG	0x20	/* discard too-long Rx frame */
+#define  RCR_DIS_CRC	0x10	/* discard CRC error Rx frame */
+#define  RCR_ALL	0x08	/* accept MCAST frames */
+#define  RCR_RUNT	0x04	/* accept runt Rx frame */
+#define  RCR_PRMSC	0x02	/* promiscous */
+#define  RCR_RXEN	0x01	/* enable frame reception */
+#define RSR	0x06		/* RX status */
+#define  RSR_MF		(1<<6)	/* bcast/mcast frame found */
+#define FCR	0x0a		/* flow control */
+#define  FCR_FLCE	0x01	/* enable Tx/Rx flow control */
+#define EPCR	0x0b		/* EEPROM and PHY control */
+#define  EP_EPOS	(1<<3)	/* 1 for PHY op, 0 for EEPROM op */
+#define  EP_ERPRR	(1<<2)	/* instruct to start read op */
+#define  EP_ERPRW	(1<<1)	/* instruct to start write op */
+#define  EP_ERRE	(1<<0)	/* 1 while operation is in progress */
+#define EPAR	0x0c		/* [7:6] for PHY#, [5:0] for addr */
+#define EPDRL	0x0d		/* EEPROM/PH

CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-01-31 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Jan 31 11:04:17 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile dev_net.c devopen.c

Log Message:
- add TFTP loading facility.
- SD/MMC load default is now "ld0a:netbsd"


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/stand/boot2440/Makefile \
src/sys/arch/evbarm/stand/boot2440/dev_net.c \
src/sys/arch/evbarm/stand/boot2440/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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.1 src/sys/arch/evbarm/stand/boot2440/Makefile:1.2
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Tue Jan 31 11:04:17 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2012/01/30 03:28:34 nisimura Exp $
+#	$NetBSD: Makefile,v 1.2 2012/01/31 11:04:17 nisimura Exp $
 
 S=		${.CURDIR}/../../../..
 PROG=		bootmini2440
@@ -11,7 +11,7 @@ CLEANFILES+=	vers.c ${PROG}.elf
 CFLAGS+=	-Wall -Wno-main -ffreestanding -march=armv4
 CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP 
 CPPFLAGS+=	-DDM9000MAC="0x08,0x08,0x11,0x18,0x12,0x27" 
-CPPFLAGS+=	-DDEFAULT_BOOTFILE="ld0e:netbsd;net:"
+CPPFLAGS+=	-DDEFAULT_BOOTFILE="ld0a:netbsd;net:"
 CPPFLAGS+=	-nostdinc -I. -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch
 DBG=		
 
Index: src/sys/arch/evbarm/stand/boot2440/dev_net.c
diff -u src/sys/arch/evbarm/stand/boot2440/dev_net.c:1.1 src/sys/arch/evbarm/stand/boot2440/dev_net.c:1.2
--- src/sys/arch/evbarm/stand/boot2440/dev_net.c:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/dev_net.c	Tue Jan 31 11:04:17 2012
@@ -42,12 +42,16 @@
 extern int netif_open(void*);
 extern int netif_init(unsigned int tag);
 
+extern struct in_addr servip;
+
+static int netdev_sock = -1;
+
 int
 net_open(struct open_file *f, ...)
 {
 	va_list ap;
-	char *path;
-	int sock, error = 0;
+	char *path, *proto;
+	int error = 0;
 
 	if( netif_init(0) == 0 ) {
 		error = ENODEV;
@@ -55,15 +59,16 @@ net_open(struct open_file *f, ...)
 	}
 
 	va_start(ap, f);
-
 	path = va_arg(ap, char *);
-	if ((sock = netif_open(path)) < 0) {
+	proto = va_arg(ap, char *);
+	va_end(ap);
+	if ((netdev_sock = netif_open(path)) < 0) {
 		error = errno;
 		goto out;
 	}
 
 	/* send DHCP request */
-	bootp(sock);
+	bootp(netdev_sock);
 
 	/* IP address was not found */
 	if (myip.s_addr == 0) {
@@ -96,6 +101,9 @@ net_open(struct open_file *f, ...)
 			printf("Root path: %s\n", rootpath);
 			strcpy(bootfile, ++filename);
 			printf("Bootfile: %s\n", bootfile);
+		} else {
+			/* No ':' found, assume it's just a filename */
+			strcpy(bootfile, path);
 		}
 	}
 
@@ -103,12 +111,14 @@ net_open(struct open_file *f, ...)
 	if (bootfile[0] == '\0')
 		strcpy(bootfile, "netbsd");
 
-	if (nfs_mount(sock, rootip, rootpath) != 0) {
+	if (strcmp(proto, "nfs") == 0
+	&& (nfs_mount(netdev_sock, rootip, rootpath) != 0)) {
 		error = errno;
 		goto out;
 	}
+
+	f->f_devdata = &netdev_sock;
 out:
-	va_end(ap);
 	return (error);
 }
 
Index: src/sys/arch/evbarm/stand/boot2440/devopen.c
diff -u src/sys/arch/evbarm/stand/boot2440/devopen.c:1.1 src/sys/arch/evbarm/stand/boot2440/devopen.c:1.2
--- src/sys/arch/evbarm/stand/boot2440/devopen.c:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/devopen.c	Tue Jan 31 11:04:17 2012
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -58,6 +59,7 @@ struct devsw devsw[] = {
 };
 
 struct fs_ops ops_nfs = FS_OPS(nfs);
+struct fs_ops ops_tftp = FS_OPS(tftp);
 struct fs_ops ops_ext2fs = FS_OPS(ext2fs);
 struct fs_ops ops_dosfs = FS_OPS(dosfs);
 struct fs_ops ops_bsdfs = FS_OPS(ufs);
@@ -78,16 +80,29 @@ devopen(struct open_file *of, const char
 	if (strncmp("net:", name, 4) == 0 ||
 	strncmp("nfs:", name, 4) == 0 ) {
 		of->f_dev = &devsw[0];
-		if ((error = net_open(of, name+4)) != 0)
+		if ((error = net_open(of, name+4, "nfs")) != 0)
 			return error;
 		file_system[0] = ops_nfs;
 		*file = bootfile;
 		strncpy(bi_path.bootpath, bootfile, sizeof(bi_path.bootpath));
 
 		return 0;
+	} else if (strncmp("tftp:", name, 5) == 0) {
+		of->f_dev = &devsw[0];
+		if ((error = net_open(of, name+5, "tftp")) != 0) {
+			return error;
+		}
+		file_system[0] = ops_tftp;
+		*file = bootfile;
+		strncpy(bi_path.bootpath, bootfile, sizeof(bi_path.bootpath));
+
+		return 0;
 	} else if (name[0] == 'l' && name[1] == 'd') {
 		int unit, part;
 		parseunit(&name[2], &unit, &part, file);
+		if (*file == NULL || strlen(*file) == 0) {
+			strcpy(*file, "netbsd");
+		}
 		of->f_dev = &devsw[1];
 		if ((error = sdmmc_open(of, unit, part)) != 0)
 			return error;