summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-11-09 20:07:26 +0000
committerimp <imp@FreeBSD.org>2006-11-09 20:07:26 +0000
commit237cf39d9dc048849e74fe1fe522e67cc4324d03 (patch)
tree4b6a9b14f4a55f577320fd2605d720e62bdc531d /sys/boot
parent5719b01094950c32c2027158b0c688356b166424 (diff)
downloadFreeBSD-src-237cf39d9dc048849e74fe1fe522e67cc4324d03.zip
FreeBSD-src-237cf39d9dc048849e74fe1fe522e67cc4324d03.tar.gz
MFp4: Make boot2 work on Kwikbyte KB9202 boards.
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/arm/at91/boot2/Makefile10
-rw-r--r--sys/boot/arm/at91/boot2/board.h28
-rw-r--r--sys/boot/arm/at91/boot2/boot2.c6
-rw-r--r--sys/boot/arm/at91/boot2/kb920x_board.c33
4 files changed, 67 insertions, 10 deletions
diff --git a/sys/boot/arm/at91/boot2/Makefile b/sys/boot/arm/at91/boot2/Makefile
index 94a9af5..f7c0873 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 <bsd.prog.mk>
+.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 0000000..16cb8d9
--- /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 0882ca5..9250389 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 d171231..8aad078 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 <sys/cdefs.h>
__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();
}
OpenPOWER on IntegriCloud