Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jul 2012 05:02:39 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238189 - in head/sys: arm/at91 arm/conf arm/include conf
Message-ID:  <201207070502.q6752d6X014688@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sat Jul  7 05:02:39 2012
New Revision: 238189
URL: http://svn.freebsd.org/changeset/base/238189

Log:
  Create a generic way to support multiple boards within an
  arm platform.  Add all the atmel boards to the ATMEL kernel for
  testing purposes.  Until boot loader arg parsing of baord type
  is done, this won't actually be able to do the runtime selection.

Added:
  head/sys/arm/include/board.h   (contents, props changed)
Modified:
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/at91/at91board.h
  head/sys/arm/at91/board_bwct.c
  head/sys/arm/at91/board_ethernut5.c
  head/sys/arm/at91/board_hl200.c
  head/sys/arm/at91/board_hl201.c
  head/sys/arm/at91/board_kb920x.c
  head/sys/arm/at91/board_qila9g20.c
  head/sys/arm/at91/board_sam9g20ek.c
  head/sys/arm/at91/board_sam9x25ek.c
  head/sys/arm/at91/board_tsc4370.c
  head/sys/arm/conf/ATMEL
  head/sys/conf/options.arm

Modified: head/sys/arm/at91/at91_machdep.c
==============================================================================
--- head/sys/arm/at91/at91_machdep.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/at91_machdep.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/msgbuf.h>
 #include <machine/reg.h>
 #include <machine/cpu.h>
+#include <machine/board.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -402,6 +403,18 @@ at91_soc_id(void)
 		at91_try_id(AT91_DBGU1);
 }
 
+#ifdef ARM_MANY_BOARD
+/* likely belongs in arm/arm/machdep.c, but since board_init is still at91 only... */
+SET_DECLARE(arm_board_set, const struct arm_board);
+
+/* Not yet fully functional, but enough to build ATMEL config */
+static long
+board_init(void)
+{
+	return -1;
+}
+#endif
+
 void *
 initarm(struct arm_boot_params *abp)
 {

Modified: head/sys/arm/at91/at91board.h
==============================================================================
--- head/sys/arm/at91/at91board.h	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/at91board.h	Sat Jul  7 05:02:39 2012	(r238189)
@@ -33,9 +33,4 @@
  */
 long at91_ramsize(void);
 
-/*
- * These routines are expected to be provided by the board files.
- */
-long board_init(void);
-
 #endif /* _ARM_AT91_AT91BOARD_H_ */

Modified: head/sys/arm/at91/board_bwct.c
==============================================================================
--- head/sys/arm/at91/board_bwct.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_bwct.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -29,12 +29,13 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <machine/board.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91rm92reg.h>
 #include <arm/at91/at91_piovar.h>
 #include <arm/at91/at91_pio_rm9200.h>
 
-long
+BOARD_INIT long
 board_init(void)
 {
 	/*
@@ -64,3 +65,5 @@ board_init(void)
 
 	return (at91_ramsize());
 }
+
+ARM_BOARD(NONE, "BWCT special");

Modified: head/sys/arm/at91/board_ethernut5.c
==============================================================================
--- head/sys/arm/at91/board_ethernut5.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_ethernut5.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -33,12 +33,13 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <machine/board.h>
 #include <arm/at91/at91_pioreg.h>
 #include <arm/at91/at91_piovar.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91sam9260reg.h>
 
-long
+BOARD_INIT long
 board_init(void)
 {
 
@@ -144,3 +145,5 @@ board_init(void)
 
 	return (at91_ramsize());
 }
+
+ARM_BOARD(NONE, "Ethernut 5")

Modified: head/sys/arm/at91/board_hl200.c
==============================================================================
--- head/sys/arm/at91/board_hl200.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_hl200.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -29,12 +29,13 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <machine/board.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91rm92reg.h>
 #include <arm/at91/at91_piovar.h>
 #include <arm/at91/at91_pio_rm9200.h>
 
-long
+BOARD_INIT long
 board_init(void)
 {
 	/*
@@ -61,3 +62,5 @@ board_init(void)
 
 	return (at91_ramsize());
 }
+
+ARM_BOARD(NONE, "HOTe 200");

Modified: head/sys/arm/at91/board_hl201.c
==============================================================================
--- head/sys/arm/at91/board_hl201.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_hl201.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -29,12 +29,13 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <machine/board.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91sam9g20reg.h>
 #include <arm/at91/at91_piovar.h>
 #include <arm/at91/at91_pio_sam9g20.h>
 
-long
+BOARD_INIT long
 board_init(void)
 {
 	/* Setup Ethernet Pins */
@@ -65,3 +66,5 @@ board_init(void)
 
 	return (at91_ramsize());
 }
+
+ARM_BOARD(NONE, "HOTe 201");

Modified: head/sys/arm/at91/board_kb920x.c
==============================================================================
--- head/sys/arm/at91/board_kb920x.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_kb920x.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -29,13 +29,14 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <machine/board.h>
 #include <arm/at91/at91var.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91rm92reg.h>
 #include <arm/at91/at91_piovar.h>
 #include <arm/at91/at91_pio_rm9200.h>
 
-long
+BOARD_INIT long
 board_init(void)
 {
 	/*
@@ -70,3 +71,5 @@ board_init(void)
 
 	return (at91_ramsize());
 }
+
+ARM_BOARD(KB9200, "Kwikbyte KB920x")

Modified: head/sys/arm/at91/board_qila9g20.c
==============================================================================
--- head/sys/arm/at91/board_qila9g20.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_qila9g20.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <machine/board.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91reg.h>
 #include <arm/at91/at91var.h>
@@ -44,7 +45,7 @@ __FBSDID("$FreeBSD$");
 #define AT91SAM9G20_LED_SIZE AT91SAM9G20_PIO_SIZE
 #define AT91SAM9G20_IRQ_LED AT91SAM9G20_IRQ_PIOA
 
-long
+BOARD_INIT long
 board_init(void)
 {
 
@@ -103,3 +104,5 @@ board_init(void)
 
 	return (at91_ramsize());
 }
+
+ARM_BOARD(QIL_A9G20, "Calico System QIL-9G20-Cxx");

Modified: head/sys/arm/at91/board_sam9g20ek.c
==============================================================================
--- head/sys/arm/at91/board_sam9g20ek.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_sam9g20ek.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <machine/board.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91reg.h>
 #include <arm/at91/at91var.h>
@@ -41,7 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <arm/at91/at91_pio_sam9g20.h>
 //#include <arm/at91/at91_led.h>
 
-long
+BOARD_INIT long
 board_init(void)
 {
 	/* PIOB's A periph: Turn USART 0's TX/RX pins */
@@ -122,3 +123,5 @@ board_init(void)
 
 	return (at91_ramsize());
 }
+
+ARM_BOARD(AT91SAM9G20, "Atmel SAM9G20-EK Development Card");

Modified: head/sys/arm/at91/board_sam9x25ek.c
==============================================================================
--- head/sys/arm/at91/board_sam9x25ek.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_sam9x25ek.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <machine/board.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91reg.h>
 #include <arm/at91/at91var.h>
@@ -41,7 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <arm/at91/at91_pio_sam9g20.h>
 //#include <arm/at91/at91_led.h>
 
-long
+BOARD_INIT long
 board_init(void)
 {
 #if 0
@@ -123,3 +124,5 @@ board_init(void)
 #endif
 	return (at91_ramsize());
 }
+
+ARM_BOARD(AT91SAM9X5EK, "Atmel AT91SAM9x-EK Evaluation Board");

Modified: head/sys/arm/at91/board_tsc4370.c
==============================================================================
--- head/sys/arm/at91/board_tsc4370.c	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/at91/board_tsc4370.c	Sat Jul  7 05:02:39 2012	(r238189)
@@ -29,12 +29,13 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <machine/board.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91rm92reg.h>
 #include <arm/at91/at91_piovar.h>
 #include <arm/at91/at91_pio_rm9200.h>
 
-long
+BOARD_INIT long
 board_init(void)
 {
 	/*
@@ -73,3 +74,5 @@ board_init(void)
 
 	return (at91_ramsize());
 }
+
+ARM_BOARD(NONE, "TSC4370 Controller Board");

Modified: head/sys/arm/conf/ATMEL
==============================================================================
--- head/sys/arm/conf/ATMEL	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/arm/conf/ATMEL	Sat Jul  7 05:02:39 2012	(r238189)
@@ -18,15 +18,16 @@ options 	KERNVIRTADDR=0xc0000000
 makeoptions	MODULES_OVERRIDE=""
 
 # list all boards here, but not just yet (no multiboard in mainline).
-#device		at91_board_bwct
-#device		at91_board_ethernut5
-#device		at91_board_hl200
-#device		at91_board_hl201
-#device		at91_board_kb920x
-#device		at91_board_qila9g20
+options 	ARM_MANY_BOARD
+device		at91_board_bwct
+device		at91_board_ethernut5
+device		at91_board_hl200
+device		at91_board_hl201
+device		at91_board_kb920x
+device		at91_board_qila9g20
 device		at91_board_sam9g20ek
-#device		at91_board_sam9x25ek
-#device		at91_board_tsc4370
+device		at91_board_sam9x25ek
+device		at91_board_tsc4370
 
 #makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols
 

Added: head/sys/arm/include/board.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/arm/include/board.h	Sat Jul  7 05:02:39 2012	(r238189)
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 2012 Warner Losh.  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 AUTHOR 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 AUTHOR 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.
+ */
+
+/* $FreeBSD$ */
+
+#ifndef _ARM_INCLUDE_BOARD_H_
+#define _ARM_INCLUDE_BOARD_H_
+
+#include <sys/linker_set.h>
+
+typedef long (arm_board_init_fn)(void);
+
+struct arm_board {
+	int		board_id;	/* Board ID from the boot loader */
+	const char	*board_name;	/* Human readable name */
+	arm_board_init_fn *board_init;	/* Board initialize code */
+};
+ 
+#if defined(ARM_MANY_BOARD)
+
+#include "board_id.h"
+
+#define ARM_BOARD(id, name)     \
+	static struct arm_board this_board = { \
+		.board_id = ARM_BOARD_ID_ ## id, \
+		.board_name = name, \
+		.board_init = board_init, \
+	}; \
+	DATA_SET(arm_boards, this_board);
+#define BOARD_INIT static
+
+#else /* !ARM_MANY_BOARD */
+
+#define ARM_BOARD(id, name)
+extern arm_board_init_fn board_init;
+#define BOARD_INIT
+
+#endif /* ARM_MANY_BOARD */
+
+#endif /* _ARM_INCLUDE_BOARD_H_ */

Modified: head/sys/conf/options.arm
==============================================================================
--- head/sys/conf/options.arm	Sat Jul  7 04:55:42 2012	(r238188)
+++ head/sys/conf/options.arm	Sat Jul  7 05:02:39 2012	(r238189)
@@ -3,6 +3,7 @@ ARM9_CACHE_WRITE_THROUGH	opt_global.h
 ARM_CACHE_LOCK_ENABLE	opt_global.h
 ARMFPE			opt_global.h
 ARM_KERN_DIRECTMAP	opt_vm.h
+ARM_MANY_BOARD		opt_global.h
 ARM_USE_SMALL_ALLOC	opt_global.h
 COUNTS_PER_SEC		opt_timer.h
 CPU_SA1100		opt_global.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207070502.q6752d6X014688>