PERFORCE change 105855 for review
Warner Losh
imp at FreeBSD.org
Fri Sep 8 20:35:05 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105855
Change 105855 by imp at imp_lighthouse on 2006/09/08 20:34:43
Read MAC address from eeprom.
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/boot2/Makefile#4 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#12 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/boot2/Makefile#4 (text+ko) ====
@@ -6,7 +6,7 @@
P=boot2
FILES=${P}
-SRCS=arm_init.S boot2.c ashldi3.c divsi3.S
+SRCS=arm_init.S boot2.c ee.c ashldi3.c divsi3.S
NO_MAN=
LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
@@ -14,6 +14,7 @@
.include <bsd.prog.mk>
CFLAGS+= \
+ -I${.CURDIR}/../bootspi \
-I${.CURDIR}/../../../common \
-I${.CURDIR}/../../../.. \
-D_KERNEL \
==== //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#12 (text+ko) ====
@@ -29,6 +29,7 @@
#include "emac.h"
#include "lib.h"
#include "sd-card.h"
+#include "ee.h"
#define SECOND 18 /* Circa that many ticks in a second. */
@@ -227,6 +228,26 @@
}
#endif
+static void
+MacFromEE()
+{
+ uint32_t sig;
+ uint8_t euid64[8];
+
+ EERead(0, (uint8_t *)&sig, sizeof(sig));
+ if (sig != 0xaa55aa55) {
+ printf("Bad signature %x\r\n", sig);
+ return;
+ }
+ EERead(48, euid64, 8);
+ mac[0] = euid64[0];
+ mac[1] = euid64[1];
+ mac[2] = euid64[4];
+ mac[3] = euid64[5];
+ mac[4] = euid64[6];
+ mac[6] = euid64[7];
+}
+
int
main(void)
{
@@ -242,11 +263,13 @@
fpga_load();
printf("done\r\n");
#endif
+ EEInit();
+ MacFromEE();
EMAC_Init();
sdcard_init();
EMAC_SetMACAddress(mac);
- dmadat = (void *)(0x20000000 + (1 << 20));
+ dmadat = (void *)(0x20000000 + (16 << 20));
/* Process configuration file */
autoboot = 1;
@@ -345,7 +368,6 @@
}
#endif
addr = eh.e_entry;
- printf("In 5, 4, 3, 2, 1\n");
((void(*)(int))addr)(RB_BOOTINFO | (opts & RBX_MASK));
}
More information about the p4-projects
mailing list