Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/gumstix PR/51905: GXIO Expension boards arn'...
details: https://anonhg.NetBSD.org/src/rev/5763db5acd26
branches: trunk
changeset: 350801:5763db5acd26
user: christos <christos%NetBSD.org@localhost>
date: Sun Jan 22 17:19:32 2017 +0000
description:
PR/51905: GXIO Expension boards arn't configured if GXIO_DEFAULT_EXPANSION
isn't defined. Fix a bunch of issues with the original code.
diffstat:
sys/arch/evbarm/gumstix/gxio.c | 99 ++++++++++++++++++++++++++---------------
1 files changed, 62 insertions(+), 37 deletions(-)
diffs (146 lines):
diff -r cd9f50896b31 -r 5763db5acd26 sys/arch/evbarm/gumstix/gxio.c
--- a/sys/arch/evbarm/gumstix/gxio.c Sun Jan 22 14:41:19 2017 +0000
+++ b/sys/arch/evbarm/gumstix/gxio.c Sun Jan 22 17:19:32 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gxio.c,v 1.24 2016/10/28 19:00:48 christos Exp $ */
+/* $NetBSD: gxio.c,v 1.25 2017/01/22 17:19:32 christos Exp $ */
/*
* Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation.
* All rights reserved.
@@ -31,7 +31,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.24 2016/10/28 19:00:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.25 2017/01/22 17:19:32 christos Exp $");
#include "opt_cputypes.h"
#include "opt_gumstix.h"
@@ -88,7 +88,7 @@
#endif
void gxio_config(void);
-void gxio_config_expansion(char *);
+void gxio_config_expansion(const char *);
#if defined(GUMSTIX)
static void basix_config(void);
static void cfstix_config(void);
@@ -662,48 +662,54 @@
}
#endif
-void
-gxio_config_expansion(char *expansion)
+static int
+gxio_find_default_expansion(void)
{
- int i, d, s;
+#ifdef GXIO_DEFAULT_EXPANSION
+ int i;
+
+ /* Find out the default expansion */
+ for (i = 0; gxioconflist[i].name != NULL; i++)
+ if (strncasecmp(gxioconflist[i].name, GXIO_DEFAULT_EXPANSION,
+ strlen(gxioconflist[i].name) + 1) == 0)
+ break;
+ return gxioconflist[i].name == NULL ? -1 : i;
+#else
+ return -1;
+#endif
+}
+void
+gxio_config_expansion(const char *expansion)
+{
+ int i, d;
+
+ d = gxio_find_default_expansion();
+
+ /* Print information about expansions */
+ printf("supported expansions:\n");
+ for (i = 0; gxioconflist[i].name != NULL; i++)
+ printf(" %s%s\n", gxioconflist[i].name,
+ i == d ? " (DEFAULT)" : "");
+
+
if (expansion == NULL) {
printf("not specified 'expansion=' in the boot args.\n");
- s = -1;
+ i = -1;
} else {
for (i = 0; gxioconflist[i].name != NULL; i++)
if (strncasecmp(gxioconflist[i].name, expansion,
- strlen(gxioconflist[i].name) + 1) == 0)
+ strlen(gxioconflist[i].name) + 1) == 0)
break;
- if (gxioconflist[i].name == NULL)
+ if (gxioconflist[i].name == NULL) {
printf("unknown expansion specified: %s\n", expansion);
- s = i;
- }
-#ifdef GXIO_DEFAULT_EXPANSION
- for (i = 0; gxioconflist[i].name != NULL; i++)
- if (strncasecmp(gxioconflist[i].name, GXIO_DEFAULT_EXPANSION,
- strlen(gxioconflist[i].name) + 1) == 0)
- break;
- d = i;
-#else
- d = -1;
-#endif
- printf("supported expansions:\n");
- for (i = 0; gxioconflist[i].name != NULL; i++)
- printf(" %s%s\n",
- gxioconflist[i].name,
- i == d ? " (DEFAULT)" : "");
-
- if (s < 0 || gxioconflist[i].name == NULL) {
-#ifdef GXIO_DEFAULT_EXPANSION
- expansion = __UNCONST(GXIO_DEFAULT_EXPANSION);
-#else
- return;
-#endif
+ i = -1;
+ }
}
+ /* Do some magic stuff for PEPPER */
#if defined(PEPPER)
- if (s < 0) {
+ if (i < 0) {
struct pepper_board_id {
unsigned int device_vendor;
#define GUMSTIX_PEPPER 0x30000200 /* 1st gen */
@@ -730,10 +736,29 @@
}
#endif
- printf("configure %s expansion (%s)\n",
- (s < 0 || gxioconflist[i].name == NULL) ? "default" : "specified",
- expansion);
- gxioconflist[(s < 0 || gxioconflist[i].name == NULL) ? d : s].config();
+ /*
+ * Now proceed to configure the default expansion if one was
+ * specified (and found) or return.
+ */
+ const char *toconfigure;
+ if (i < 0) {
+#ifdef GXIO_DEFAULT_EXPANSION
+ if (d == -1) {
+ printf("default expansion (%s) not found\n",
+ GXIO_DEFAULT_EXPANSION);
+ return;
+ }
+ expansion = GXIO_DEFAULT_EXPANSION;
+ i = d;
+ toconfigure = "default";
+#else
+ return;
+#endif
+ } else
+ toconfigure = "specified";
+
+ printf("configure %s expansion (%s)\n", toconfigure, expansion);
+ gxioconflist[i].config();
}
Home |
Main Index |
Thread Index |
Old Index