Source-Changes-HG archive

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

[src/trunk]: src Add evbmips support for u-boot handling.



details:   https://anonhg.NetBSD.org/src/rev/9d329c0fcd94
branches:  trunk
changeset: 1011168:9d329c0fcd94
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 21 17:17:01 2020 +0000

description:
Add evbmips support for u-boot handling.

diffstat:

 tools/installboot/Makefile          |    4 +-
 usr.sbin/installboot/Makefile       |   10 +-
 usr.sbin/installboot/arch/evbmips.c |  119 ++++++++++++++++++++++++++++++++++++
 usr.sbin/installboot/installboot.h  |    3 +-
 usr.sbin/installboot/machines.c     |    5 +-
 5 files changed, 131 insertions(+), 10 deletions(-)

diffs (225 lines):

diff -r ded5f910edf5 -r 9d329c0fcd94 tools/installboot/Makefile
--- a/tools/installboot/Makefile        Sun Jun 21 17:15:51 2020 +0000
+++ b/tools/installboot/Makefile        Sun Jun 21 17:17:01 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.12 2019/05/07 05:02:42 thorpej Exp $
+#      $NetBSD: Makefile,v 1.13 2020/06/21 17:17:01 thorpej Exp $
 
 .include <bsd.hostinit.mk>
 
@@ -22,7 +22,7 @@
 BOARDDB_SRCDIR=        ${SHARE_SRCDIR}/installboot
 BOARDDB_DSTDIR=        ${HOST_SHAREDIR}/installboot
 
-BOARDDBS=      evbarm
+BOARDDBS=      evbarm evbmips
 
 .for _d in ${BOARDDBS}
 install: .PHONY install.${_d}.boards.plist
diff -r ded5f910edf5 -r 9d329c0fcd94 usr.sbin/installboot/Makefile
--- a/usr.sbin/installboot/Makefile     Sun Jun 21 17:15:51 2020 +0000
+++ b/usr.sbin/installboot/Makefile     Sun Jun 21 17:17:01 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.54 2019/08/15 19:53:01 martin Exp $
+#      $NetBSD: Makefile,v 1.55 2020/06/21 17:17:02 thorpej Exp $
 #
 
 .include <bsd.own.mk>
@@ -12,7 +12,7 @@
 
 .if !defined(SMALLPROG) && !defined(ARCH_FILES)
 ARCH_FILES=  alpha.c amiga.c
-ARCH_FILES+= emips.c evbarm.c ews4800mips.c
+ARCH_FILES+= emips.c evbarm.c evbmips.c ews4800mips.c
 ARCH_FILES+= hp300.c hppa.c
 ARCH_FILES+= i386.c
 ARCH_FILES+= landisk.c
@@ -32,11 +32,11 @@
 
 SRCS+=${ARCH_FILES}
 
-.if !empty(ARCH_FILES:C/(evbarm)/evboard/:Mevboard.c)
+.if !empty(ARCH_FILES:C/(evbarm|evbmips)/evboard/:Mevboard.c)
 SRCS+=evboards.c
 .endif
 
-.if !empty(ARCH_FILES:C/(evbarm)/fdt/:Mfdt.c)
+.if !empty(ARCH_FILES:C/(evbarm|evbmips)/fdt/:Mfdt.c)
 FDTDIR=                ${.CURDIR}/../../sys/external/bsd/libfdt/dist
 .PATH:         ${FDTDIR}
 CPPFLAGS+=     -DSUPPORT_FDT -I${FDTDIR}
@@ -49,7 +49,7 @@
 
 
 .if !defined(HOSTPROGNAME)
-.if !empty(ARCH_FILES:C/(evbarm)/ofw/:Mofw.c)
+.if !empty(ARCH_FILES:C/(evbarm|evbmips)/ofw/:Mofw.c)
 CPPFLAGS+=     -DSUPPORT_OPENFIRMWARE
 .endif
 .endif
diff -r ded5f910edf5 -r 9d329c0fcd94 usr.sbin/installboot/arch/evbmips.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/installboot/arch/evbmips.c       Sun Jun 21 17:17:01 2020 +0000
@@ -0,0 +1,119 @@
+/*     $NetBSD: evbmips.c,v 1.1 2020/06/21 17:17:02 thorpej Exp $      */
+
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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.
+ */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+#if !defined(__lint)
+__RCSID("$NetBSD: evbmips.c,v 1.1 2020/06/21 17:17:02 thorpej Exp $");
+#endif  /* !__lint */
+
+#include <err.h>
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+
+#include "installboot.h"
+#include "evboards.h"
+
+static int     evbmips_setboot(ib_params *);
+static int     evbmips_clearboot(ib_params *);
+static int     evbmips_editboot(ib_params *);
+static void    evbmips_usage(ib_params *);
+
+struct ib_mach ib_mach_evbmips = {
+       .name           =       "evbmips",
+       .setboot        =       evbmips_setboot,
+       .clearboot      =       evbmips_clearboot,
+       .editboot       =       evbmips_editboot,
+       .usage          =       evbmips_usage,
+       .valid_flags    =       IB_BOARD | IB_DTB | IB_MEDIA,
+       .mach_flags     =       MF_UBOOT,
+};
+
+static int
+evbmips_setboot(ib_params *params)
+{
+       evb_board board;
+       int rv = 0;
+
+       if (!evb_db_load(params)) {
+               warnx("Unable to load board db.");
+               return 0;
+       }
+
+       board = evb_db_get_board(params);
+       if (board == NULL)
+               goto out;
+
+       rv = evb_uboot_setboot(params, board);
+
+ out:
+       if (params->mach_data) {
+               prop_object_release(params->mach_data);
+               params->mach_data = NULL;
+       }
+       return rv;
+}
+
+static int
+evbmips_clearboot(ib_params *params)
+{
+
+       return no_clearboot(params);
+}
+
+static int
+evbmips_editboot(ib_params *params)
+{
+
+       return no_editboot(params);
+}
+
+static void
+evbmips_usage(ib_params *params)
+{
+
+       if (!evb_db_load(params)) {
+               warnx("Unable to load board db.");
+               return;
+       }
+
+       fprintf(stderr, "Known boards (for -o board=...) are:\n");
+       evb_db_list_boards(params, stderr);
+
+       if (params->mach_data) {
+               prop_object_release(params->mach_data);
+               params->mach_data = NULL;
+       }
+}
diff -r ded5f910edf5 -r 9d329c0fcd94 usr.sbin/installboot/installboot.h
--- a/usr.sbin/installboot/installboot.h        Sun Jun 21 17:15:51 2020 +0000
+++ b/usr.sbin/installboot/installboot.h        Sun Jun 21 17:17:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: installboot.h,v 1.41 2019/08/15 08:36:09 kamil Exp $   */
+/*     $NetBSD: installboot.h,v 1.42 2020/06/21 17:17:02 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -186,6 +186,7 @@
 extern struct ib_mach ib_mach_amiga;
 extern struct ib_mach ib_mach_emips;
 extern struct ib_mach ib_mach_evbarm;
+extern struct ib_mach ib_mach_evbmips;
 extern struct ib_mach ib_mach_ews4800mips;
 extern struct ib_mach ib_mach_hp300;
 extern struct ib_mach ib_mach_hppa;
diff -r ded5f910edf5 -r 9d329c0fcd94 usr.sbin/installboot/machines.c
--- a/usr.sbin/installboot/machines.c   Sun Jun 21 17:15:51 2020 +0000
+++ b/usr.sbin/installboot/machines.c   Sun Jun 21 17:17:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machines.c,v 1.42 2019/08/15 19:53:01 martin Exp $     */
+/*     $NetBSD: machines.c,v 1.43 2020/06/21 17:17:02 thorpej Exp $    */
 
 /*-
  * Copyright (c) 2002-2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(__lint)
-__RCSID("$NetBSD: machines.c,v 1.42 2019/08/15 19:53:01 martin Exp $");
+__RCSID("$NetBSD: machines.c,v 1.43 2020/06/21 17:17:02 thorpej Exp $");
 #endif /* !__lint */
 
 #include <sys/types.h>
@@ -50,6 +50,7 @@
     &ib_mach_amiga,
     &ib_mach_emips,
     &ib_mach_evbarm,
+    &ib_mach_evbmips,
     &ib_mach_ews4800mips,
     &ib_mach_hp300,
     &ib_mach_hppa,



Home | Main Index | Thread Index | Old Index