Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sandpoint/stand change bootloader name to "altboot"...
details: https://anonhg.NetBSD.org/src/rev/fb1a476f0bd2
branches: trunk
changeset: 761291:fb1a476f0bd2
user: nisimura <nisimura%NetBSD.org@localhost>
date: Sun Jan 23 01:05:29 2011 +0000
description:
change bootloader name to "altboot". bump version and add README.
diffstat:
sys/arch/sandpoint/stand/Makefile | 4 +-
sys/arch/sandpoint/stand/altboot/Makefile | 67 +
sys/arch/sandpoint/stand/altboot/README.altboot | 48 +
sys/arch/sandpoint/stand/altboot/brdsetup.c | 1021 +++++++++++++++++++++++
sys/arch/sandpoint/stand/altboot/dev_net.c | 115 ++
sys/arch/sandpoint/stand/altboot/devopen.c | 121 ++
sys/arch/sandpoint/stand/altboot/dsk.c | 539 ++++++++++++
sys/arch/sandpoint/stand/altboot/entry.S | 182 ++++
sys/arch/sandpoint/stand/altboot/fxp.c | 525 +++++++++++
sys/arch/sandpoint/stand/altboot/globals.h | 194 ++++
sys/arch/sandpoint/stand/altboot/kse.c | 273 ++++++
sys/arch/sandpoint/stand/altboot/main.c | 480 ++++++++++
sys/arch/sandpoint/stand/altboot/nif.c | 142 +++
sys/arch/sandpoint/stand/altboot/nvt.c | 413 +++++++++
sys/arch/sandpoint/stand/altboot/pci.c | 374 ++++++++
sys/arch/sandpoint/stand/altboot/pciide.c | 143 +++
sys/arch/sandpoint/stand/altboot/pcn.c | 403 +++++++++
sys/arch/sandpoint/stand/altboot/printf.c | 260 +++++
sys/arch/sandpoint/stand/altboot/rge.c | 396 ++++++++
sys/arch/sandpoint/stand/altboot/siisata.c | 116 ++
sys/arch/sandpoint/stand/altboot/sip.c | 429 +++++++++
sys/arch/sandpoint/stand/altboot/skg.c | 501 +++++++++++
sys/arch/sandpoint/stand/altboot/sme.c | 324 +++++++
sys/arch/sandpoint/stand/altboot/tlp.c | 427 +++++++++
sys/arch/sandpoint/stand/altboot/vge.c | 505 +++++++++++
sys/arch/sandpoint/stand/altboot/wm.c | 461 ++++++++++
sys/arch/sandpoint/stand/netboot/Makefile | 67 -
sys/arch/sandpoint/stand/netboot/brdsetup.c | 1021 -----------------------
sys/arch/sandpoint/stand/netboot/dev_net.c | 115 --
sys/arch/sandpoint/stand/netboot/devopen.c | 121 --
sys/arch/sandpoint/stand/netboot/dsk.c | 539 ------------
sys/arch/sandpoint/stand/netboot/entry.S | 182 ----
sys/arch/sandpoint/stand/netboot/fxp.c | 525 -----------
sys/arch/sandpoint/stand/netboot/globals.h | 194 ----
sys/arch/sandpoint/stand/netboot/kse.c | 273 ------
sys/arch/sandpoint/stand/netboot/main.c | 479 ----------
sys/arch/sandpoint/stand/netboot/newvers.sh | 11 -
sys/arch/sandpoint/stand/netboot/nif.c | 142 ---
sys/arch/sandpoint/stand/netboot/nvt.c | 413 ---------
sys/arch/sandpoint/stand/netboot/pci.c | 374 --------
sys/arch/sandpoint/stand/netboot/pciide.c | 143 ---
sys/arch/sandpoint/stand/netboot/pcn.c | 403 ---------
sys/arch/sandpoint/stand/netboot/printf.c | 260 -----
sys/arch/sandpoint/stand/netboot/rge.c | 396 --------
sys/arch/sandpoint/stand/netboot/siisata.c | 116 --
sys/arch/sandpoint/stand/netboot/sip.c | 429 ---------
sys/arch/sandpoint/stand/netboot/skg.c | 501 -----------
sys/arch/sandpoint/stand/netboot/sme.c | 324 -------
sys/arch/sandpoint/stand/netboot/tlp.c | 427 ---------
sys/arch/sandpoint/stand/netboot/version | 6 -
sys/arch/sandpoint/stand/netboot/vge.c | 505 -----------
sys/arch/sandpoint/stand/netboot/wm.c | 461 ----------
52 files changed, 8461 insertions(+), 8429 deletions(-)
diffs (truncated from 17101 to 300 lines):
diff -r 0f95d51c3e86 -r fb1a476f0bd2 sys/arch/sandpoint/stand/Makefile
--- a/sys/arch/sandpoint/stand/Makefile Sat Jan 22 22:26:10 2011 +0000
+++ b/sys/arch/sandpoint/stand/Makefile Sun Jan 23 01:05:29 2011 +0000
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile,v 1.1 2009/07/20 11:43:08 nisimura Exp $
+# $NetBSD: Makefile,v 1.2 2011/01/23 01:05:29 nisimura Exp $
-SUBDIR= netboot
+SUBDIR= altboot
.include <bsd.subdir.mk>
diff -r 0f95d51c3e86 -r fb1a476f0bd2 sys/arch/sandpoint/stand/altboot/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sandpoint/stand/altboot/Makefile Sun Jan 23 01:05:29 2011 +0000
@@ -0,0 +1,67 @@
+# $NetBSD: Makefile,v 1.1 2011/01/23 01:05:30 nisimura Exp $
+
+S= ${.CURDIR}/../../../..
+
+PROG= altboot
+SRCS= entry.S main.c brdsetup.c pci.c devopen.c dev_net.c nif.c \
+ fxp.c tlp.c rge.c skg.c dsk.c pciide.c siisata.c printf.c
+CLEANFILES+= vers.c vers.o ${PROG} ${PROG}.bin
+CFLAGS+= -Wall -Wno-main -ffreestanding -msoft-float -mmultiple
+CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
+CPPFLAGS+= -D_STANDALONE -DSUPPORT_DHCP
+#CPPFLAGS+= -DCONSNAME=\"com\" -DCONSPORT=0x3f8 -DCONSSPEED=115200
+#CPPFLAGS+= -DCONSNAME=\"eumb\" -DCONSPORT=0x4600 -DCONSSPEED=57600
+CPPFLAGS+= -nostdinc -I. -I${.OBJDIR} -I${S}
+DBG= -Os
+
+# XXX SHOULD NOT NEED TO DEFINE THESE!
+LIBCRT0=
+LIBC=
+LIBCRTBEGIN=
+LIBCRTEND=
+
+NOMAN= # defined
+STRIPFLAG=
+BINMODE= 444
+
+RELOC= 1000000
+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"
+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}
+
+${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
+ ${HOST_SH} ${.CURDIR}/newvers.sh ${.CURDIR}/version
+ ${CC} -c vers.c
+ ${LD} -N -Ttext ${RELOC} -Bstatic -e ${ENTRY} -o ${PROG} \
+ ${OBJS} vers.o ${LIBSA} ${LIBZ} ${LIBKERN}
+ ${OBJCOPY} -S -O binary ${.TARGET} ${.TARGET}.bin
+
+.include <bsd.prog.mk>
+
+cleandir distclean: .WAIT cleanlibdir
+
+cleanlibdir:
+ -rm -rf lib
diff -r 0f95d51c3e86 -r fb1a476f0bd2 sys/arch/sandpoint/stand/altboot/README.altboot
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sandpoint/stand/altboot/README.altboot Sun Jan 23 01:05:29 2011 +0000
@@ -0,0 +1,48 @@
+/// notes about altboot ///
+
+$NetBSD: README.altboot,v 1.1 2011/01/23 01:05:30 nisimura Exp $
+
+Altboot is a functional bridge to fill the gap between a NAS product
+custom bootloader and the NetBSD kernel startup environment. Altboot
+irons out and rectifies erroneously configured HW by product
+bootloaders and prepares a sane runtime better suited for booting
+NetBSD kernels.
+
+- provides the foundation of a fast NetBSD porting cycle with functionalities
+ product bootloaders don't have.
+- facilitates a flexible and clean NetBSD implementation tailoured
+ to target HW in detail, minimizing bumpy adjustments and hacks in
+ locore asm and machdeps in very early kernel startup stage.
+- levels out differences among similar-but-not-the-same porting
+ targets to make it possible having common NetBSD kernels for them.
+- builds and hands a bootinfo list to the NetBSD kernel.
+
+Altboot is known working on two models.
+- KuroBox with a popular U-Boot as the replacement of vendor proprietary
+
+ U-Boot 1.1.4 LiSt 2.1.0 (Sep 21 2006 - 00:22:56) LinkStation / KuroBox
+
+- Synology 101g+ with vendor custom PPCboot
+
+ PPCBoot 2.0.0 (Mar 1 2005 - 15:31:41)
+
+The standard use of altboot is to invoke it with a short script from
+U-Boot/PPCboot, where the altboot image is stored in an unoccupied 128KB
+section of the target's HW NOR flash. Combined with standard
+U-Boot/PPCboot functions, it is possible to boot a NetBSD kernel off
+it right after power-on, without the help of manual intervention. Note
+that the original U-Boot/PPCboot still remains useful and altboot works
+as a functional extension for them.
+
+Altboot hands the following bootinfo records to the NetBSD/sandpoint
+kernel.
+- processor clock tick value driving MPC8241/8245.
+- serial console selection.
+- booted kernel filename and which device it was fetched from.
+- Ethernet MAC address, if target HW lacks SEEPROM to store a unit unique
+ value.
+- product family indication.
+- preloaded kernel module names (under development).
+
+ ### ### ###
+
diff -r 0f95d51c3e86 -r fb1a476f0bd2 sys/arch/sandpoint/stand/altboot/brdsetup.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sandpoint/stand/altboot/brdsetup.c Sun Jan 23 01:05:29 2011 +0000
@@ -0,0 +1,1021 @@
+/* $NetBSD: brdsetup.c,v 1.1 2011/01/23 01:05:30 nisimura Exp $ */
+
+/*-
+ * Copyright (c) 2008 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 <sys/param.h>
+
+#include <powerpc/oea/spr.h>
+
+#include <lib/libsa/stand.h>
+#include <lib/libsa/net.h>
+#include <lib/libkern/libkern.h>
+
+#include <machine/bootinfo.h>
+
+#include "globals.h"
+
+#define BRD_DECL(xxx) \
+ void xxx ## setup(struct brdprop *); \
+ void xxx ## brdfix(struct brdprop *); \
+ void xxx ## pcifix(struct brdprop *); \
+ void xxx ## reset(void)
+
+BRD_DECL(mot);
+BRD_DECL(enc);
+BRD_DECL(kuro);
+BRD_DECL(syno);
+BRD_DECL(qnap);
+
+static struct brdprop brdlist[] = {
+ {
+ "sandpoint",
+ "Sandpoint X3",
+ BRD_SANDPOINTX3,
+ 0,
+ "com", 0x3f8, 115200,
+ motsetup, motbrdfix, motpcifix },
+ {
+ "encpp1",
+ "EnCore PP1",
+ BRD_ENCOREPP1,
+ 0,
+ "com", 0x3f8, 115200,
+ encsetup, encbrdfix, encpcifix },
+ {
+ "kurobox",
+ "KuroBox",
+ BRD_KUROBOX,
+ 32768000,
+ "eumb", 0x4600, 57600,
+ kurosetup, kurobrdfix, kuropcifix },
+ {
+ "synology",
+ "Synology DS",
+ BRD_SYNOLOGY,
+ 33164691, /* from Synology/Linux source */
+ /* 33168000, XXX better precision? */
+ "eumb", 0x4500, 115200,
+ synosetup, synobrdfix, synopcifix, synoreset },
+ {
+ "qnap",
+ "QNAP TS-101",
+ BRD_QNAPTS101,
+ 0,
+ "eumb", 0x4500, 115200,
+ NULL, NULL, qnappcifix },
+ {
+ "iomega",
+ "IOMEGA Storcenter",
+ BRD_STORCENTER,
+ 0,
+ "eumb", 0x4500, 115200,
+ NULL, NULL, NULL },
+ {
+ "unknown",
+ "Unknown board",
+ BRD_UNKNOWN,
+ 0,
+ "eumb", 0x4500, 115200,
+ NULL, NULL, NULL }, /* must be the last */
+};
+
+static struct brdprop *brdprop;
+static uint32_t ticks_per_sec, ns_per_tick;
+
+static void brdfixup(void);
+static void setup(void);
+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 *);
+
+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 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 DCR 0x11
+#define UART_READ(base, r) *(volatile char *)(base + (r))
+#define UART_WRITE(base, r, v) *(volatile char *)(base + (r)) = (v)
+
+void brdsetup(void); /* called by entry.S */
+
+void
+brdsetup(void)
+{
+ static uint8_t pci_to_memclk[] = {
+ 30, 30, 10, 10, 20, 10, 10, 10,
+ 10, 20, 20, 15, 20, 15, 20, 30,
+ 30, 40, 15, 40, 20, 25, 20, 40,
+ 25, 20, 10, 20, 15, 15, 20, 00
+ };
+ static uint8_t mem_to_cpuclk[] = {
+ 25, 30, 45, 20, 20, 00, 10, 30,
+ 30, 20, 45, 30, 25, 35, 30, 35,
+ 20, 25, 20, 30, 35, 40, 40, 20,
+ 30, 25, 40, 30, 30, 25, 35, 00
+ };
+ char *consname;
+ int consport;
+ uint32_t extclk;
Home |
Main Index |
Thread Index |
Old Index