CVS commit: src/sys/arch/evbarm/evbarm

2020-12-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Dec 19 21:54:00 UTC 2020

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
implement boot -d for arm64.

could be done at the end of initarm() except it hangs currently.
this gets you a db> prompt before devices are configured.

ok @skrll.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/evbarm/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.22 src/sys/arch/evbarm/evbarm/autoconf.c:1.23
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.22	Mon Aug 27 09:52:16 2018
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Sat Dec 19 21:54:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.22 2018/08/27 09:52:16 jmcneill Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.23 2020/12/19 21:54:00 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.22 2018/08/27 09:52:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2020/12/19 21:54:00 mrg Exp $");
 
 #include "opt_md.h"
+#include "opt_ddb.h"
 
 #include 
 #include 
@@ -171,6 +172,13 @@ cpu_configure(void)
 	struct mainbus_attach_args maa;
 	struct cfdata *cf;
 
+#ifdef DDB
+	if (boothowto & RB_KDB) {
+		printf("Entering DDB...\n");
+		cpu_Debugger();
+	}
+#endif
+
 	(void) splhigh();
 
 	for (cf = [0]; cf->cf_name; cf++) {



CVS commit: src/sys/arch/evbarm/evbarm

2017-10-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct 23 07:05:23 UTC 2017

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
splserial is an alias for splhigh now. No need to splhigh twice.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/evbarm/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.20 src/sys/arch/evbarm/evbarm/autoconf.c:1.21
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.20	Sun May 28 00:30:49 2017
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Mon Oct 23 07:05:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.20 2017/05/28 00:30:49 jmcneill Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.21 2017/10/23 07:05:23 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.20 2017/05/28 00:30:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.21 2017/10/23 07:05:23 skrll Exp $");
 
 #include "opt_md.h"
 
@@ -169,7 +169,6 @@ cpu_configure(void)
 	struct cfdata *cf;
 
 	(void) splhigh();
-	(void) splserial();	/* XXX need an splextreme() */
 
 	for (cf = [0]; cf->cf_name; cf++) {
 		if (cf->cf_pspec == NULL) {



CVS commit: src/sys/arch/evbarm/evbarm

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 00:30:49 UTC 2017

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
Don't assume that the root autoconfiguration device is named "mainbus".


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/evbarm/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.19 src/sys/arch/evbarm/evbarm/autoconf.c:1.20
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.19	Sat Mar  5 07:33:58 2016
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Sun May 28 00:30:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.19 2016/03/05 07:33:58 mlelstv Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.20 2017/05/28 00:30:49 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.19 2016/03/05 07:33:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.20 2017/05/28 00:30:49 jmcneill Exp $");
 
 #include "opt_md.h"
 
@@ -50,6 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 void	(*evbarm_device_register)(device_t, void *);
 void	(*evbarm_device_register_post_config)(device_t, void *);
 
+extern struct cfdata cfdata[];
+
 #ifndef MEMORY_DISK_IS_ROOT
 static int get_device(char *name, device_t *, int *);
 static void set_root_device(void);
@@ -164,13 +166,18 @@ void
 cpu_configure(void)
 {
 	struct mainbus_attach_args maa;
+	struct cfdata *cf;
 
 	(void) splhigh();
 	(void) splserial();	/* XXX need an splextreme() */
 
-	maa.ma_name = "mainbus";
-
-	config_rootfound("mainbus", );
+	for (cf = [0]; cf->cf_name; cf++) {
+		if (cf->cf_pspec == NULL) {
+			maa.ma_name = cf->cf_name;
+			if (config_rootfound(cf->cf_name, ) != NULL)
+break;
+		}
+	}
 
 	/* Time to start taking interrupts so lets open the flood gates  */
 	spl0();



CVS commit: src/sys/arch/evbarm/evbarm

2016-03-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  5 07:33:59 UTC 2016

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
Don't modify command line buffer but create a copy of the root argument.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/evbarm/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.18 src/sys/arch/evbarm/evbarm/autoconf.c:1.19
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.18	Sat Nov 22 11:10:22 2014
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Sat Mar  5 07:33:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.18 2014/11/22 11:10:22 mlelstv Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.19 2016/03/05 07:33:58 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.18 2014/11/22 11:10:22 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.19 2016/03/05 07:33:58 mlelstv Exp $");
 
 #include "opt_md.h"
 
@@ -41,7 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -95,10 +95,14 @@ get_device(char *name, device_t *dvp, in
 
 /* Set the rootdev variable from the root specifier in the boot args */
 
+static char *bootspec_buf = NULL;
+static size_t bootspec_buflen = 0;
+
 static void
 set_root_device(void)
 {
-	char *ptr, *end;
+	char *ptr, *end, *buf;
+	size_t len;
 
 	if (boot_args == NULL)
 		return;
@@ -112,12 +116,26 @@ set_root_device(void)
 	/* NUL-terminate string, get_bootconf_option doesn't */
 	for (end=ptr; *end != '\0'; ++end) {
 		if (*end == ' ' || *end == '\t') {
-			*end = '\0';
 			break;
 		}
 	}
 
-	bootspec = ptr;
+	if (end == ptr)
+		return;
+
+	len = end - ptr;
+
+	buf = kmem_alloc(len + 1, KM_SLEEP);
+	memcpy(buf, ptr, len);
+	buf[len] = '\0';
+
+	if (bootspec_buf != NULL)
+		kmem_free(bootspec_buf, bootspec_buflen + 1);
+
+	bootspec_buf = buf;
+	bootspec_buflen = len;
+
+	bootspec = bootspec_buf;
 }
 #endif
 



CVS commit: src/sys/arch/evbarm/evbarm

2014-11-22 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 22 11:10:22 UTC 2014

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
If the boot argument root cannot be parsed as a device name, pass the
string untranslated to MI code. Due to limits in the boot argument parser
the string is terminated by whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/evbarm/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.17 src/sys/arch/evbarm/evbarm/autoconf.c:1.18
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.17	Sat May 10 20:12:16 2014
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Sat Nov 22 11:10:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.17 2014/05/10 20:12:16 reinoud Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.18 2014/11/22 11:10:22 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.17 2014/05/10 20:12:16 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.18 2014/11/22 11:10:22 mlelstv Exp $);
 
 #include opt_md.h
 
@@ -51,15 +51,15 @@ void	(*evbarm_device_register)(device_t,
 void	(*evbarm_device_register_post_config)(device_t, void *);
 
 #ifndef MEMORY_DISK_IS_ROOT
-static void get_device(char *name);
+static int get_device(char *name, device_t *, int *);
 static void set_root_device(void);
 #endif
 
 #ifndef MEMORY_DISK_IS_ROOT
 /* Decode a device name to a major and minor number */
 
-static void
-get_device(char *name)
+static int
+get_device(char *name, device_t *dvp, int *partp)
 {
 	int unit, part;
 	char devname[16], *cp;
@@ -69,7 +69,7 @@ get_device(char *name)
 		name += 5;
 
 	if (devsw_name2blk(name, devname, sizeof(devname)) == -1)
-		return;
+		return 0;
 
 	name += strlen(devname);
 	unit = part = 0;
@@ -78,16 +78,19 @@ get_device(char *name)
 	while (*cp = '0'  *cp = '9')
 		unit = (unit * 10) + (*cp++ - '0');
 	if (cp == name)
-		return;
+		return 0;
 
 	if (*cp = 'a'  *cp  ('a' + MAXPARTITIONS))
 		part = *cp - 'a';
 	else if (*cp != '\0'  *cp != ' ')
-		return;
+		return 0;
 	if ((dv = device_find_by_driver_unit(devname, unit)) != NULL) {
-		booted_device = dv;
-		booted_partition = part;
+		*dvp = dv;
+		*partp = part;
+		return 1;
 	}
+
+	return 0;
 }
 
 /* Set the rootdev variable from the root specifier in the boot args */
@@ -95,10 +98,26 @@ get_device(char *name)
 static void
 set_root_device(void)
 {
-	char *ptr;
-	if (boot_args 
-	get_bootconf_option(boot_args, root, BOOTOPT_TYPE_STRING, ptr))
-		get_device(ptr);
+	char *ptr, *end;
+
+	if (boot_args == NULL)
+		return;
+
+	if (!get_bootconf_option(boot_args, root, BOOTOPT_TYPE_STRING, ptr))
+		return;
+
+	if (get_device(ptr, booted_device, booted_partition))
+		return;
+
+	/* NUL-terminate string, get_bootconf_option doesn't */
+	for (end=ptr; *end != '\0'; ++end) {
+		if (*end == ' ' || *end == '\t') {
+			*end = '\0';
+			break;
+		}
+	}
+
+	bootspec = ptr;
 }
 #endif
 



CVS commit: src/sys/arch/evbarm/evbarm

2013-01-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Jan 21 20:20:32 UTC 2013

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
Correct off-by-one in validation of booted partition number.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/evbarm/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.15 src/sys/arch/evbarm/evbarm/autoconf.c:1.16
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.15	Sun Dec  2 18:22:45 2012
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Mon Jan 21 20:20:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.15 2012/12/02 18:22:45 msaitoh Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.16 2013/01/21 20:20:32 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.15 2012/12/02 18:22:45 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.16 2013/01/21 20:20:32 jakllsch Exp $);
 
 #include opt_md.h
 
@@ -79,7 +79,7 @@ get_device(char *name)
 	if (cp == name)
 		return;
 
-	if (*cp = 'a'  *cp = ('a' + MAXPARTITIONS))
+	if (*cp = 'a'  *cp  ('a' + MAXPARTITIONS))
 		part = *cp - 'a';
 	else if (*cp != '\0'  *cp != ' ')
 		return;



CVS commit: src/sys/arch/evbarm/evbarm

2012-12-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  2 18:22:45 UTC 2012

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
Add get_device(), set_root_device() to get root device via bootargs.
This is same as some other archs. PR#47250.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/evbarm/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.14 src/sys/arch/evbarm/evbarm/autoconf.c:1.15
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.14	Sat Oct 27 17:17:46 2012
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Sun Dec  2 18:22:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.14 2012/10/27 17:17:46 chs Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.15 2012/12/02 18:22:45 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.14 2012/10/27 17:17:46 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.15 2012/12/02 18:22:45 msaitoh Exp $);
 
 #include opt_md.h
 
@@ -45,15 +45,71 @@ __KERNEL_RCSID(0, $NetBSD: autoconf.c,v
 
 #include machine/autoconf.h
 #include machine/intr.h
+#include machine/bootconfig.h
 
 void	(*evbarm_device_register)(device_t, void *);
 
+#ifndef MEMORY_DISK_IS_ROOT
+static void get_device(char *name);
+static void set_root_device(void);
+#endif
+
+#ifndef MEMORY_DISK_IS_ROOT
+/* Decode a device name to a major and minor number */
+
+static void
+get_device(char *name)
+{
+	int unit, part;
+	char devname[16], *cp;
+	device_t dv;
+
+	if (strncmp(name, /dev/, 5) == 0)
+		name += 5;
+
+	if (devsw_name2blk(name, devname, sizeof(devname)) == -1)
+		return;
+
+	name += strlen(devname);
+	unit = part = 0;
+
+	cp = name;
+	while (*cp = '0'  *cp = '9')
+		unit = (unit * 10) + (*cp++ - '0');
+	if (cp == name)
+		return;
+
+	if (*cp = 'a'  *cp = ('a' + MAXPARTITIONS))
+		part = *cp - 'a';
+	else if (*cp != '\0'  *cp != ' ')
+		return;
+	if ((dv = device_find_by_driver_unit(devname, unit)) != NULL) {
+		booted_device = dv;
+		booted_partition = part;
+	}
+}
+
+/* Set the rootdev variable from the root specifier in the boot args */
+
+static void
+set_root_device(void)
+{
+	char *ptr;
+	if (boot_args 
+	get_bootconf_option(boot_args, root, BOOTOPT_TYPE_STRING, ptr))
+		get_device(ptr);
+}
+#endif
+
 /*
  * Set up the root device from the boot args
  */
 void
 cpu_rootconf(void)
 {
+#ifndef MEMORY_DISK_IS_ROOT
+	set_root_device();
+#endif
 	aprint_normal(boot device: %s\n,
 	booted_device != NULL ? device_xname(booted_device) : unknown);
 	rootconf();