From owner-svn-src-all@FreeBSD.ORG Sat Jul 7 05:02:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E4D3106564A; Sat, 7 Jul 2012 05:02:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17EFA8FC12; Sat, 7 Jul 2012 05:02:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6752dq8014704; Sat, 7 Jul 2012 05:02:39 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6752d6X014688; Sat, 7 Jul 2012 05:02:39 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207070502.q6752d6X014688@svn.freebsd.org> From: Warner Losh Date: Sat, 7 Jul 2012 05:02:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238189 - in head/sys: arm/at91 arm/conf arm/include conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 05:02:40 -0000 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 #include #include +#include #include #include @@ -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 #include +#include #include #include #include #include -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 #include +#include #include #include #include #include -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 #include +#include #include #include #include #include -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 #include +#include #include #include #include #include -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 #include +#include #include #include #include #include #include -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 #include +#include #include #include #include @@ -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 #include +#include #include #include #include @@ -41,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include //#include -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 #include +#include #include #include #include @@ -41,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include //#include -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 #include +#include #include #include #include #include -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 + +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