Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/luna68k/stand/boot Add netboot support.
details: https://anonhg.NetBSD.org/src/rev/bc87af16ee07
branches: trunk
changeset: 783950:bc87af16ee07
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jan 13 14:10:55 2013 +0000
description:
Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.
Tested on LUNA-I.
XXX: We really need proper documents about libsa APIs.
diffstat:
sys/arch/luna68k/stand/boot/Makefile | 13 +-
sys/arch/luna68k/stand/boot/conf.c | 10 +-
sys/arch/luna68k/stand/boot/devopen.c | 9 +-
sys/arch/luna68k/stand/boot/getsecs.c | 65 +++++
sys/arch/luna68k/stand/boot/if_le.c | 290 ++++++++++++++++++++++++
sys/arch/luna68k/stand/boot/init_main.c | 9 +-
sys/arch/luna68k/stand/boot/ioconf.c | 4 +-
sys/arch/luna68k/stand/boot/lance.c | 375 ++++++++++++++++++++++++++++++++
sys/arch/luna68k/stand/boot/lance.h | 105 ++++++++
sys/arch/luna68k/stand/boot/locore.S | 1 +
sys/arch/luna68k/stand/boot/samachdep.h | 15 +-
sys/arch/luna68k/stand/boot/version | 3 +-
12 files changed, 889 insertions(+), 10 deletions(-)
diffs (truncated from 1070 to 300 lines):
diff -r f9d5b80254a1 -r bc87af16ee07 sys/arch/luna68k/stand/boot/Makefile
--- a/sys/arch/luna68k/stand/boot/Makefile Sun Jan 13 08:38:04 2013 +0000
+++ b/sys/arch/luna68k/stand/boot/Makefile Sun Jan 13 14:10:55 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2013/01/10 15:51:32 tsutsui Exp $
+# $NetBSD: Makefile,v 1.5 2013/01/13 14:10:55 tsutsui Exp $
# @(#)Makefile 8.2 (Berkeley) 8/15/93
NOMAN= # defined
@@ -7,16 +7,18 @@
.include <bsd.sys.mk>
S= ${.CURDIR}/../../../..
+LIBSADIR= ${S}/lib/libsa
CPPFLAGS+= -nostdinc -D_STANDALONE
CPPFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch
CPPFLAGS+= -DSUPPORT_DISK
#CPPFLAGS+= -DSUPPORT_TAPE
-#CPPFLAGS+= -DSUPPORT_ETHERNET
-#CPPFLAGS+= -DSUPPORT_DHCP -DSUPPORT_BOOTP
+CPPFLAGS+= -DSUPPORT_ETHERNET
+CPPFLAGS+= -DSUPPORT_DHCP -DSUPPORT_BOOTP
#CPPFLAGS+= -DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG
#CPPFLAGS+= -DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID
+CPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT
CFLAGS= -Os -msoft-float
CFLAGS+= -ffreestanding
@@ -45,6 +47,11 @@
#SRCS+= fsdump.c
SRCS+= ufs_disksubr.c
+# netboot support
+SRCS+= if_le.c lance.c getsecs.c
+.PATH: ${LIBSADIR}
+SRCS+= dev_net.c
+
PROG= boot
NEWVERSWHAT= "${PROG}"
diff -r f9d5b80254a1 -r bc87af16ee07 sys/arch/luna68k/stand/boot/conf.c
--- a/sys/arch/luna68k/stand/boot/conf.c Sun Jan 13 08:38:04 2013 +0000
+++ b/sys/arch/luna68k/stand/boot/conf.c Sun Jan 13 14:10:55 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */
+/* $NetBSD: conf.c,v 1.2 2013/01/13 14:10:55 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -39,6 +39,7 @@
#include <netinet/in_systm.h>
#include <lib/libsa/stand.h>
+#include <lib/libsa/dev_net.h>
#include <lib/libsa/nfs.h>
#include <lib/libsa/ufs.h>
@@ -56,6 +57,10 @@
#define netstrategy xxstrategy
#define netopen xxopen
#define netclose xxclose
+#else
+#define netstrategy net_strategy
+#define netopen net_open
+#define netclose net_close
#endif
#define netioctl noioctl
@@ -76,8 +81,9 @@
int ndevs = __arraycount(devsw);
#ifdef SUPPORT_ETHERNET
+extern struct netif_driver le_netif_driver;
struct netif_driver *netif_drivers[] = {
- &le_driver,
+ &le_netif_driver,
};
int n_netif_drivers = __arraycount(netif_drivers);
#endif
diff -r f9d5b80254a1 -r bc87af16ee07 sys/arch/luna68k/stand/boot/devopen.c
--- a/sys/arch/luna68k/stand/boot/devopen.c Sun Jan 13 08:38:04 2013 +0000
+++ b/sys/arch/luna68k/stand/boot/devopen.c Sun Jan 13 14:10:55 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */
+/* $NetBSD: devopen.c,v 1.2 2013/01/13 14:10:55 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -101,6 +101,13 @@
}
file_system[0] = file_system_ufs[0];
+#ifdef SUPPORT_ETHERNET
+ if (strcmp(dp->dv_name, "le") == 0) {
+ /* XXX mixing local fs_ops on netboot could be troublesome */
+ file_system[0] = file_system_nfs[0];
+ }
+#endif
+
f->f_dev = dp;
return 0;
diff -r f9d5b80254a1 -r bc87af16ee07 sys/arch/luna68k/stand/boot/getsecs.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/luna68k/stand/boot/getsecs.c Sun Jan 13 14:10:55 2013 +0000
@@ -0,0 +1,65 @@
+/* $NetBSD: getsecs.c,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */
+
+/*-
+ * Copyright (c) 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by UCHIYAMA Yasushi.
+ *
+ * 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 <machine/cpu.h>
+
+#include <lib/libkern/libkern.h>
+#include <lib/libsa/stand.h>
+#include <lib/libsa/net.h>
+
+#include <luna68k/dev/timekeeper.h>
+#include <luna68k/stand/boot/samachdep.h>
+
+satime_t
+getsecs(void)
+{
+ volatile uint8_t *mclock;
+ u_int t;
+
+ mclock = (volatile uint8_t *)0x45000000;
+
+ if (machtype == LUNA_I) {
+ mclock += 2040;
+ mclock[MK_CSR] |= MK_CSR_READ;
+ t = bcdtobin(mclock[MK_SEC]);
+ t += bcdtobin(mclock[MK_MIN]) * 60;
+ t += bcdtobin(mclock[MK_HOUR]) * 60 * 60;
+ mclock[MK_CSR] &= ~MK_CSR_READ;
+ } else {
+ while (mclock[MC_REGA] & MC_REGA_UIP)
+ continue;
+ t = mclock[MC_SEC];
+ t += mclock[MC_MIN] * 60;
+ t += mclock[MC_HOUR] * 60 * 60;
+ }
+
+ return (satime_t)t;
+}
diff -r f9d5b80254a1 -r bc87af16ee07 sys/arch/luna68k/stand/boot/if_le.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/luna68k/stand/boot/if_le.c Sun Jan 13 14:10:55 2013 +0000
@@ -0,0 +1,290 @@
+/* $NetBSD: if_le.c,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */
+
+/*
+ * Copyright (c) 2013 Izumi Tsutsui. All rights reserved.
+ * Copyright (c) 2003 Tetsuya Isaki. All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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.
+ */
+/*
+ * Copyright (c) 1982, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * from: hp300/dev/if_le.c 7.16 (Berkeley) 3/11/93
+ *
+ * @(#)if_le.c 8.1 (Berkeley) 6/10/93
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <machine/cpu.h>
+
+#include <net/if.h>
+#include <net/if_ether.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+
+#include <lib/libsa/stand.h>
+#include <lib/libsa/net.h>
+#include <lib/libsa/netif.h>
+
+#include <luna68k/stand/boot/samachdep.h>
+#include <luna68k/stand/boot/device.h>
+
+/* libsa netif_driver glue functions */
+static int le_match(struct netif *, void *);
+static int le_probe(struct netif *, void *);
+static void le_init(struct iodesc *, void *);
+static int le_get(struct iodesc *, void *, size_t, saseconds_t);
+static int le_put(struct iodesc *, void *, size_t);
+static void le_end(struct netif *);
+
+static void myetheraddr(uint8_t *);
+
+/* luna68k driver glue stuff */
+struct driver ledriver = {
+ leinit,
+ "le",
+ NULL
+};
+
+/* libsa netif glue stuff */
+struct netif_stats le_stats;
+struct netif_dif le_ifs[] = {
+ { 0, 1, &le_stats, 0, 0, },
+};
+
+struct netif_driver le_netif_driver = {
+ "le",
+ le_match,
+ le_probe,
+ le_init,
+ le_get,
+ le_put,
+ le_end,
+ le_ifs,
+ __arraycount(le_ifs),
+};
+
+#ifdef DEBUG
+int debug;
+#endif
+
+int
+leinit(void *arg)
+{
+ struct hp_device *hd = arg;
+ void *cookie;
+ void *reg, *mem;
+ uint8_t eaddr[6];
Home |
Main Index |
Thread Index |
Old Index