Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mmeye/stand Add support boot. only support SH4 mac...
details: https://anonhg.NetBSD.org/src/rev/b52fb81bfd37
branches: trunk
changeset: 762849:b52fb81bfd37
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Thu Mar 03 05:59:37 2011 +0000
description:
Add support boot. only support SH4 machine(mmEye-WLF and others) now.
diffstat:
sys/arch/mmeye/stand/Makefile | 4 +-
sys/arch/mmeye/stand/boot/Makefile | 95 ++++++++
sys/arch/mmeye/stand/boot/boot.c | 274 +++++++++++++++++++++++
sys/arch/mmeye/stand/boot/boot.h | 81 ++++++
sys/arch/mmeye/stand/boot/bootinfo.c | 84 +++++++
sys/arch/mmeye/stand/boot/bootinfo.h | 35 ++
sys/arch/mmeye/stand/boot/clock.c | 60 +++++
sys/arch/mmeye/stand/boot/com.c | 189 +++++++++++++++
sys/arch/mmeye/stand/boot/common.h | 38 +++
sys/arch/mmeye/stand/boot/conf.c | 58 ++++
sys/arch/mmeye/stand/boot/cons.c | 255 +++++++++++++++++++++
sys/arch/mmeye/stand/boot/cons.h | 101 ++++++++
sys/arch/mmeye/stand/boot/deflate.sh | 24 ++
sys/arch/mmeye/stand/boot/devopen.c | 141 +++++++++++
sys/arch/mmeye/stand/boot/entry.S | 93 +++++++
sys/arch/mmeye/stand/boot/ns16550.h | 34 ++
sys/arch/mmeye/stand/boot/prf.c | 47 +++
sys/arch/mmeye/stand/boot/scif.c | 164 +++++++++++++
sys/arch/mmeye/stand/boot/scif.h | 31 ++
sys/arch/mmeye/stand/boot/tgets.c | 94 +++++++
sys/arch/mmeye/stand/boot/version | 8 +
sys/arch/mmeye/stand/boot/wd.c | 280 +++++++++++++++++++++++
sys/arch/mmeye/stand/boot/wdc.c | 414 +++++++++++++++++++++++++++++++++++
sys/arch/mmeye/stand/boot/wdvar.h | 138 +++++++++++
24 files changed, 2740 insertions(+), 2 deletions(-)
diffs (truncated from 2841 to 300 lines):
diff -r 650aca35f2a9 -r b52fb81bfd37 sys/arch/mmeye/stand/Makefile
--- a/sys/arch/mmeye/stand/Makefile Thu Mar 03 03:39:08 2011 +0000
+++ b/sys/arch/mmeye/stand/Makefile Thu Mar 03 05:59:37 2011 +0000
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile,v 1.2 2000/03/20 21:24:54 msaitoh Exp $
+# $NetBSD: Makefile,v 1.3 2011/03/03 05:59:37 kiyohara Exp $
-SUBDIR= bootelf bootcoff
+SUBDIR= bootelf bootcoff boot
.include <bsd.subdir.mk>
diff -r 650aca35f2a9 -r b52fb81bfd37 sys/arch/mmeye/stand/boot/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/mmeye/stand/boot/Makefile Thu Mar 03 05:59:37 2011 +0000
@@ -0,0 +1,95 @@
+# $NetBSD: Makefile,v 1.1 2011/03/03 05:59:37 kiyohara Exp $
+
+NOMAN= # defined
+
+.include <bsd.own.mk>
+.include <bsd.sys.mk>
+
+S= ${.CURDIR}/../../../..
+
+BINMODE= 444
+
+PROG= boot
+SRCS= entry.S
+SRCS+= boot.c bootinfo.c clock.c conf.c cons.c devopen.c prf.c tgets.c
+SRCS+= com.c scif.c wd.c wdc.c
+SRCS+= vers.c
+
+CLEANFILES+= vers.c ${PROG}
+
+#MMEYE_CPU= SH3
+MMEYE_CPU= SH4
+
+.if ${MMEYE_CPU} == "SH3"
+AFLAGS+= -DSH3
+CPPFLAGS+= -DSH3
+CPPFLAGS+= -DCONS_COM
+RELOC= 8c800000
+.endif
+.if ${MMEYE_CPU} == "SH4"
+CLEANFILES+= ${PROG}.bin ${PROG}.bin.gz
+AFLAGS+= -DSH4
+CPPFLAGS+= -DSH4
+CPPFLAGS+= -DCONS_SCIF
+RELOC= 89000000
+.endif
+
+
+AFLAGS+= -D_LOCORE -D_KERNEL
+CFLAGS+= -ffreestanding
+CFLAGS+= -Wall -Werror -Wno-main
+CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
+CFLAGS+= -Wno-pointer-sign
+CPPFLAGS+= -nostdinc -D_STANDALONE -I. -I${.OBJDIR} -I${S}
+DBG= -Os
+
+NETBSD_VERS!= ${HOST_SH} ${S}/conf/osrelease.sh
+CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
+
+# XXX SHOULD NOT NEED TO DEFINE THESE!
+LIBCRT0=
+LIBC=
+LIBCRTBEGIN=
+LIBCRTEND=
+
+STRIPFLAG=
+
+ENTRY= start
+
+
+### find out what to use for libkern
+KERN_AS= library
+.include "${S}/lib/libkern/Makefile.inc"
+LIBKERN= ${KERNLIB}
+
+### find out what to use for libz
+Z_AS= library
+.include "${S}/lib/libz/Makefile.inc"
+LIBZ= ${ZLIB}
+
+### find out what to use for libsa
+SA_AS= library
+SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
+.include "${S}/lib/libsa/Makefile.inc"
+LIBSA= ${SALIB}
+
+.PHONY: vers.c
+vers.c: ${.CURDIR}/version
+ ${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "mmeye"
+
+${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
+ ${LD} -N -Ttext ${RELOC} -Bstatic -e ${ENTRY} -o ${PROG} \
+ ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
+.if ${MMEYE_CPU} == "SH4"
+ ${OBJCOPY} -S -O binary ${.TARGET} ${.TARGET}.bin
+ env TOOL_AWK=${TOOL_AWK} TOOL_HEXDUMP=${TOOL_HEXDUMP} \
+ ./deflate.sh ${.TARGET}.bin
+.endif
+
+cleandir distclean: .WAIT cleanlibdir
+
+cleanlibdir:
+ -rm -rf lib
+
+.include <bsd.prog.mk>
+.include <bsd.klinks.mk>
diff -r 650aca35f2a9 -r b52fb81bfd37 sys/arch/mmeye/stand/boot/boot.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/mmeye/stand/boot/boot.c Thu Mar 03 05:59:37 2011 +0000
@@ -0,0 +1,274 @@
+/* $NetBSD: boot.c,v 1.1 2011/03/03 05:59:37 kiyohara Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jonathan Stone, Michael Hitch, Simon Burge and Wayne Knowles.
+ *
+ * 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.
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell.
+ *
+ * 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.
+ *
+ * @(#)boot.c 8.1 (Berkeley) 6/10/93
+ */
+
+#include <lib/libsa/stand.h>
+#include <lib/libsa/loadfile.h>
+#include <lib/libkern/libkern.h>
+
+#include <sys/param.h>
+#include <sys/boot_flag.h>
+#include <sys/exec.h>
+#include <sys/exec_elf.h>
+
+#include <machine/cpu.h>
+
+#include "boot.h"
+#include "cons.h"
+#include "common.h"
+#include "bootinfo.h"
+
+char *kernelnames[] = {
+ "netbsd",
+ "netbsd.gz",
+ "onetbsd",
+ "onetbsd.gz",
+
+ NULL
+};
+
+extern u_long end; /* Boot loader code end address */
+void start(void);
+
+static int get_bsdbootname(char **, char **, int *);
+static int parse_bootname(char *, int, char **, char **);
+static void print_banner(void);
+
+int main(void);
+
+/*
+ * Extract NetBSD boot specification
+ */
+static int
+get_bsdbootname(char **dev, char **kern, int *howtop)
+{
+ int len;
+ char *ptr, *spec;
+ char c, namebuf[PATH_MAX];
+
+ spec = NULL;
+ len = 0;
+
+ memset(namebuf, 0, sizeof namebuf);
+ printf("Boot [" DEFBOOTDEV ":%s]: ", DEFKERNELNAME);
+
+ if (tgets(namebuf) == -1)
+ printf("\n");
+
+ ptr = namebuf;
+ while ((c = *ptr) != '\0') {
+ while (c == ' ')
+ c = *++ptr;
+ if (c == '\0')
+ break;
+ if (c == '-')
+ while ((c = *++ptr) && c != ' ')
+ BOOT_FLAG(c, *howtop);
+ else {
+ spec = ptr;
+ while ((c = *++ptr) && c != ' ')
+ ;
+ if (c)
+ *ptr++ = '\0';
+ len = strlen(spec);
+ }
+ }
+
+ if (len > 0)
+ if (parse_bootname(spec, len, dev, kern))
+ return 1;
+
+ DPRINTF(("dev = %s, kern = %s\n",
+ *dev ? *dev : "<NULL>",
+ *kern ? *kern : "<NULL>"));
+
+ return 0;
+}
+
+static int
+parse_bootname(char *spec, int len, char **dev, char **kern)
+{
+ char *bootname, *ptr;
+
+ bootname = alloc(len + 1);
+ if (bootname == NULL)
+ return 1;
+ memcpy(bootname, spec, len);
+ bootname[len] = '\0';
+
+ if ((ptr = memchr(bootname, ':', len)) != NULL) {
+ /* "wdXX:kernel" */
+ *ptr = '\0';
+ *dev = bootname;
+ if (*++ptr)
+ *kern = ptr;
+ } else
+ /* "kernel" */
+ *kern = bootname;
+ return 0;
+}
+
+/*
+ * Print boot message.
+ */
+static void
+print_banner(void)
+{
+
+ printf("\n");
+ printf(">> %s " NETBSD_VERS " Bootloader, Revision %s [@%p]\n",
+ bootprog_name, bootprog_rev, (void*)&start);
+}
+
+int
+main(void)
+{
Home |
Main Index |
Thread Index |
Old Index