Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sgimips Import irisboot, yet another bootloader for...



details:   https://anonhg.NetBSD.org/src/rev/71abf8bc3c88
branches:  trunk
changeset: 447467:71abf8bc3c88
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jan 12 16:44:47 2019 +0000

description:
Import irisboot, yet another bootloader for pre-ARC sgimips machines.

This bootloader adds support for Personal IRIS 4D/25 (IP6),
Personal IRIS 4D/35 (IP12), and Indigo R3000 (IP12) etc. and
optionally supports R4000 Indy and Indigo R4000 (ARCS machine)
using standalone WD33C93 SCSI driver.

Submitted by Naruaki Etomi via PR port-sgimips/53539,
and reviewed by tsutsui@.  See also port-sgimips@ ML thread:
 https://mail-index.netbsd.org/port-sgimips/2018/09/16/msg000778.html

diffstat:

 sys/arch/sgimips/README.IPn                   |    3 +-
 sys/arch/sgimips/TODO                         |    1 -
 sys/arch/sgimips/stand/Makefile               |    4 +-
 sys/arch/sgimips/stand/Makefile.booters       |    7 +-
 sys/arch/sgimips/stand/bootiris/Makefile      |   58 +
 sys/arch/sgimips/stand/bootiris/version       |    5 +
 sys/arch/sgimips/stand/common/iris_autoconf.c |   42 +
 sys/arch/sgimips/stand/common/iris_boot.c     |  157 ++++
 sys/arch/sgimips/stand/common/iris_conf.c     |   55 +
 sys/arch/sgimips/stand/common/iris_cons.c     |  141 ++++
 sys/arch/sgimips/stand/common/iris_cons.h     |   54 +
 sys/arch/sgimips/stand/common/iris_devopen.c  |   59 +
 sys/arch/sgimips/stand/common/iris_disk.c     |  234 +++++++
 sys/arch/sgimips/stand/common/iris_machdep.h  |  100 +++
 sys/arch/sgimips/stand/common/iris_parse.c    |   82 ++
 sys/arch/sgimips/stand/common/iris_prf.c      |   47 +
 sys/arch/sgimips/stand/common/iris_scsi.c     |  838 ++++++++++++++++++++++++++
 sys/arch/sgimips/stand/common/iris_scsicmd.h  |  100 +++
 sys/arch/sgimips/stand/common/iris_scsictl.c  |  109 +++
 sys/arch/sgimips/stand/common/iris_scsireg.h  |  505 +++++++++++++++
 sys/arch/sgimips/stand/common/iris_scsivar.h  |  123 +++
 sys/arch/sgimips/stand/common/iris_start.S    |   67 ++
 sys/arch/sgimips/stand/common/iris_zs.c       |  261 ++++++++
 sys/arch/sgimips/stand/common/iris_zs.h       |   48 +
 24 files changed, 3095 insertions(+), 5 deletions(-)

diffs (truncated from 3240 to 300 lines):

diff -r f01d724d7fb4 -r 71abf8bc3c88 sys/arch/sgimips/README.IPn
--- a/sys/arch/sgimips/README.IPn       Sat Jan 12 15:44:08 2019 +0000
+++ b/sys/arch/sgimips/README.IPn       Sat Jan 12 16:44:47 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: README.IPn,v 1.10 2009/02/10 06:12:27 rumble Exp $
+$NetBSD: README.IPn,v 1.11 2019/01/12 16:44:47 tsutsui Exp $
 
 Arch (kernel)  Models                          Codename
 -------------  ------                          --------
@@ -30,6 +30,7 @@
 
 Architecture   ABI     Bootstrap Load Address  Kernel Load Address
 ------------   ---     ----------------------  -------------------
+IP12           32      0x80368000              0x80002000
 IP19 IP21 IP25 32      0x80004000              0x80100000
 IP19 IP21 IP25 64      0xa800000000004000      0xa800000000180000
 IP20 IP22 IP24 32      0x88002000              0x88069000
diff -r f01d724d7fb4 -r 71abf8bc3c88 sys/arch/sgimips/TODO
--- a/sys/arch/sgimips/TODO     Sat Jan 12 15:44:08 2019 +0000
+++ b/sys/arch/sgimips/TODO     Sat Jan 12 16:44:47 2019 +0000
@@ -6,7 +6,6 @@
 
 (sekiya)
 * grtwo needs cursor and hardware color fill support
-* ip12 needs ROM-based bootloader
 * hpc devices need real probe routines
 * port newport driver to x.org
 
diff -r f01d724d7fb4 -r 71abf8bc3c88 sys/arch/sgimips/stand/Makefile
--- a/sys/arch/sgimips/stand/Makefile   Sat Jan 12 15:44:08 2019 +0000
+++ b/sys/arch/sgimips/stand/Makefile   Sat Jan 12 16:44:47 2019 +0000
@@ -1,5 +1,5 @@
-#      $NetBSD: Makefile,v 1.5 2005/12/11 12:18:58 christos Exp $
+#      $NetBSD: Makefile,v 1.6 2019/01/12 16:44:47 tsutsui Exp $
 
-SUBDIR=        boot boot64 sgivol
+SUBDIR=        boot boot64 bootiris sgivol
 
 .include <bsd.subdir.mk>
diff -r f01d724d7fb4 -r 71abf8bc3c88 sys/arch/sgimips/stand/Makefile.booters
--- a/sys/arch/sgimips/stand/Makefile.booters   Sat Jan 12 15:44:08 2019 +0000
+++ b/sys/arch/sgimips/stand/Makefile.booters   Sat Jan 12 16:44:47 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.booters,v 1.24 2017/04/08 19:53:22 christos Exp $
+# $NetBSD: Makefile.booters,v 1.25 2019/01/12 16:44:47 tsutsui Exp $
 
 # PROG set by parent.
 NOMAN=         # defined
@@ -22,7 +22,9 @@
 realall: ${PROG}
 
 .PATH:         ${.CURDIR}/../common
+.if !defined(PRE_ARCS)
 .PATH.S:       ${S}/dev/arcbios
+.endif
 AFLAGS+=       -D_LOCORE -D_KERNEL -mno-abicalls
 CPPFLAGS+=     -nostdinc -D_STANDALONE -DNO_ABICALLS -I${.OBJDIR} -I${S}
 # compiler flags for smallest code size
@@ -40,13 +42,16 @@
 
 CPPFLAGS+=     -Dsgimips
 
+.if !defined(PRE_ARCS)
 .include "${S}/dev/arcbios/Makefile.inc"
+.endif
 
 # We load the kernel at 420K in from the start of RAM to give the boot
 # loader plenty of breathing room.  Load the boot loader starting at
 # the second page of RAM.
 # A warm thank-you to SGI for making load addresses different :)
 LOAD_ADDRESS?=         0x88002000
+LOAD_ADDRESS_IP12?=    0x80368000
 LOAD_ADDRESS_IP32?=    0x80002000
 
 .include "${S}/conf/newvers_stand.mk"
diff -r f01d724d7fb4 -r 71abf8bc3c88 sys/arch/sgimips/stand/bootiris/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sgimips/stand/bootiris/Makefile  Sat Jan 12 16:44:47 2019 +0000
@@ -0,0 +1,58 @@
+#      $NetBSD: Makefile,v 1.1 2019/01/12 16:44:47 tsutsui Exp $
+
+# Silicon Graphics "IRIS" series MIPS processors machine.
+STRIPFLAG=
+# If you try to use ARCBIOS(Indy or Indigo R4000) machine, Please comment it out!
+# Be sure to edit /sgimips/stand/common/iris_machdep.h!
+PRE_ARCS= yes
+
+.if defined(PRE_ARCS)
+SRCS=   iris_start.S 
+.else
+SRCS=   start.S arcbios_calls.S
+.endif
+
+SRCS+=  iris_boot.c
+SRCS+=  bootinfo.c
+SRCS+=  iris_prf.c iris_cons.c iris_zs.c
+SRCS+=  iris_parse.c
+SRCS+=  iris_autoconf.c iris_scsi.c
+SRCS+=  iris_disk.c
+SRCS+=  iris_scsictl.c
+SRCS+=  iris_conf.c
+SRCS+=  iris_devopen.c
+
+PROG=  irisboot
+${PROG}: ip12boot
+.if ${MACHINE_ARCH} == "mipseb"
+       cp ip12boot ip12boot.tmp
+       ${MIPS_ELF2ECOFF} ip12boot.tmp ${.TARGET}
+.else
+       touch ${.TARGET}
+.endif
+
+# XXX Temporary hack to install the ELF version, too.
+FILES+=                ip12boot
+CLEANFILES+=   ip12boot ip12boot.elf
+
+CLEANFILES+=   ip12boot.map
+
+CLEANFILES+=   ip12boot.tmp
+
+.include "../Makefile.booters"
+
+ip12boot: ${OBJS} ${LIBS}
+       ${_MKTARGET_LINK}
+.if defined(PRE_ARCS)
+       ${LD} -Map ${.TARGET}.map -N -x -Ttext ${LOAD_ADDRESS_IP12} ${LDBUG} \
+           -m elf32btsmip -e start -o ${.TARGET}.elf ${OBJS} ${LIBS}
+.else
+       ${LD} -Map ${.TARGET}.map -N -x -Ttext ${LOAD_ADDRESS} ${LDBUG} \
+           -m elf32btsmip -e start -o ${.TARGET}.elf ${OBJS} ${LIBS}
+.endif
+       @${STRIP} -s ${.TARGET}.elf -o ${.TARGET}
+       @${SIZE} ${.TARGET}
+
+cleandir distclean: .WAIT cleanlibdir
+cleanlibdir:
+       -rm -rf lib
diff -r f01d724d7fb4 -r 71abf8bc3c88 sys/arch/sgimips/stand/bootiris/version
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sgimips/stand/bootiris/version   Sat Jan 12 16:44:47 2019 +0000
@@ -0,0 +1,5 @@
+NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
+file is important - make sure the entries are appended on end, last item
+is taken as the current.
+
+1.0:   Initial sgimips "IRIS" series MIPS processors machine booter
diff -r f01d724d7fb4 -r 71abf8bc3c88 sys/arch/sgimips/stand/common/iris_autoconf.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sgimips/stand/common/iris_autoconf.c     Sat Jan 12 16:44:47 2019 +0000
@@ -0,0 +1,42 @@
+/*     $NetBSD: iris_autoconf.c,v 1.1 2019/01/12 16:44:47 tsutsui Exp $        */
+
+/*
+ * Copyright (c) 2018 Naruaki Etomi
+ * 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.
+ */
+
+/*
+ * Silicon Graphics "IRIS" series MIPS processors machine bootloader.
+ * Find and init devices.
+ */
+
+#include <mips/cpuregs.h>
+#include "iris_machdep.h"
+
+void
+find_devs(void)
+{
+
+       wd33c93_init((void *)MIPS_PHYS_TO_KSEG1(SCSIA_ADDR),
+           (void *)MIPS_PHYS_TO_KSEG1(SCSID_ADDR));
+}
diff -r f01d724d7fb4 -r 71abf8bc3c88 sys/arch/sgimips/stand/common/iris_boot.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sgimips/stand/common/iris_boot.c Sat Jan 12 16:44:47 2019 +0000
@@ -0,0 +1,157 @@
+/*     $NetBSD: iris_boot.c,v 1.1 2019/01/12 16:44:47 tsutsui Exp $    */
+
+/*
+ * Copyright (c) 2018 Naruaki Etomi
+ * 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.
+ */
+
+/*
+ * Silicon Graphics "IRIS" series MIPS processors machine bootloader.
+ *
+ * Notes:
+ *   The amount of physical memory space available to
+ *   the system is 3661820 (0x80002000 - 0x8037fffc) bytes.
+ *   This space is too tight for kernel and bootloader.
+ *   So we keep it simple.
+ */
+
+#include <lib/libsa/stand.h>
+#include <lib/libsa/loadfile.h>
+#include <lib/libkern/libkern.h>
+
+#include <sys/param.h>
+#include <sys/exec.h>
+#include <sys/exec_elf.h>
+#include <sys/boot_flag.h>
+
+#ifndef        INDIGO_R3K_MODE
+#include <dev/arcbios/arcbios.h>
+#endif
+
+#include "iris_machdep.h"
+
+#include "common.h"
+#include "bootinfo.h"
+
+int main(int, char **);
+
+/* Storage must be static. */
+struct btinfo_symtab bi_syms;
+struct btinfo_bootpath bi_bpath;
+
+static uint8_t bootinfo[BOOTINFO_SIZE];
+
+/*
+ * This gets arguments from the PROM monitor.
+ * argv[0] will be path to the bootloader (i.e., "dksc(X,Y,8)/bootiris").
+ *
+ * argv[1] through argv[n] will contain arguments passed from the PROM, if any.
+ */
+
+int
+main(int argc, char **argv)
+{
+       char kernelname[1 + 32];
+       void (*entry) (int, char *[], int, void *);
+       u_long marks[MARK_MAX];
+       int win = 0;
+       int zs_addr, speed;
+
+       cninit(&zs_addr, &speed);
+
+       /* print a banner */
+       printf("\n");
+       printf("%s " NETBSD_VERS " Yet another Bootstrap, Revision %s\n",
+           bootprog_name, bootprog_rev);
+       printf("\n");
+
+       memset(marks, 0, sizeof marks);
+
+       /* initialise bootinfo structure early */
+       bi_init(bootinfo);
+
+       switch (argc) {
+#ifdef INDIGO_R3K_MODE
+       case 1:
+               again();
+               break;
+#endif
+       case 2:
+               /* To specify HDD on Indigo R3K */ 
+               if (strstr(argv[1], "dksc(")) {
+                       parse(argv, kernelname);
+               } else {
+                       again();



Home | Main Index | Thread Index | Old Index