diff --git a/sys/boot/arm/at91/boot2/Makefile b/sys/boot/arm/at91/boot2/Makefile index 94a9af5964a6..f7c08737ebfb 100644 --- a/sys/boot/arm/at91/boot2/Makefile +++ b/sys/boot/arm/at91/boot2/Makefile @@ -1,16 +1,22 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../bootspi +.PATH: ${.CURDIR}/../libat91 P=boot2 FILES=${P} -SRCS=arm_init.S boot2.c kb920x_board.c ee.c +SRCS=arm_init.S boot2.c ${BOOT_FLAVOR}_board.c NO_MAN= LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .include +.if ${BOOT_FLAVOR} == "tsc" +SRCS+=ee.c +.endif +.if ${BOOT_FLAVOR} == "kb920x" +CFLAGS+=-DBOOT_IIC +.endif CFLAGS+= \ -I${.CURDIR}/../bootspi \ -I${.CURDIR}/../../../common \ diff --git a/sys/boot/arm/at91/boot2/board.h b/sys/boot/arm/at91/boot2/board.h new file mode 100644 index 000000000000..16cb8d9c18dd --- /dev/null +++ b/sys/boot/arm/at91/boot2/board.h @@ -0,0 +1,28 @@ +/*- + * Copyright (c) 2006 M. 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 THE AUTHOR ``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 AUTHOR 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$ + */ + +void Update(void); +void board_init(void); diff --git a/sys/boot/arm/at91/boot2/boot2.c b/sys/boot/arm/at91/boot2/boot2.c index 0882ca5be5ba..92503898ea72 100644 --- a/sys/boot/arm/at91/boot2/boot2.c +++ b/sys/boot/arm/at91/boot2/boot2.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "lib.h" #include "sd-card.h" #include "ee.h" +#include "board.h" #define RBX_ASKNAME 0x0 /* -a */ #define RBX_SINGLE 0x1 /* -s */ @@ -66,7 +67,7 @@ __FBSDID("$FreeBSD$"); #define PATH_CONFIG "/boot.config" //#define PATH_KERNEL "/boot/kernel/kernel" -#define PATH_KERNEL "/kernel.gz.tramp" +#define PATH_KERNEL "/boot/kernel/kernel.gz.tramp" #define NOPT 5 @@ -141,9 +142,6 @@ getstr(int c) } } -// Each board has to provide one of these. -void board_init(void); - int main(void) { diff --git a/sys/boot/arm/at91/boot2/kb920x_board.c b/sys/boot/arm/at91/boot2/kb920x_board.c index d171231ad92a..8aad07849bde 100644 --- a/sys/boot/arm/at91/boot2/kb920x_board.c +++ b/sys/boot/arm/at91/boot2/kb920x_board.c @@ -1,3 +1,28 @@ +/*- + * Copyright (c) 2006 M. 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 THE AUTHOR ``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 AUTHOR 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. + * + */ + #include __FBSDID("$FreeBSD$"); @@ -5,7 +30,7 @@ __FBSDID("$FreeBSD$"); #include "emac.h" #include "lib.h" -#include "ee.h" +#include "board.h.h" extern unsigned char mac[]; @@ -14,10 +39,10 @@ MacFromEE() { uint32_t sig; sig = 0; - EERead(12 * 1024, (uint8_t *)&sig, sizeof(sig)); + ReadEEPROM(12 * 1024, (uint8_t *)&sig, sizeof(sig)); if (sig != 0xaa55aa55) return; - EERead(12 * 1024 + 4, mac, 6); + ReadEEPROM(12 * 1024 + 4, mac, 6); printf("MAC %x:%x:%x:%x:%x:%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } @@ -30,6 +55,6 @@ Update(void) void board_init(void) { - EEInit(); + InitEEPROM(); MacFromEE(); }