diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-11-08 22:00:35 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-11-08 22:00:35 +0000 |
commit | 283358efb05640208d72b92dd9670ce2b366d715 (patch) | |
tree | 5f240469c19cce0f7bbde4ccb4ba478e3e00cfb4 /sys/arch | |
parent | 0dfe9b155ae3af80cc0cd39fb4c62e8dd6d2db28 (diff) |
Relocate FDT blob such that it doesn't clash with the kernel we're going to
load. This makes it possible to load bsd.rd on the RB600.
Bump version number.
ok dms@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/socppc/stand/boot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/socppc/stand/boot/machdep.c | 23 |
2 files changed, 22 insertions, 5 deletions
diff --git a/sys/arch/socppc/stand/boot/conf.c b/sys/arch/socppc/stand/boot/conf.c index 45a81aa1eb2..3a0f9f948d3 100644 --- a/sys/arch/socppc/stand/boot/conf.c +++ b/sys/arch/socppc/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.3 2009/09/11 18:06:43 dms Exp $ */ +/* $OpenBSD: conf.c,v 1.4 2009/11/08 22:00:34 kettenis Exp $ */ /* $NetBSD: conf.c,v 1.4 2005/12/11 12:17:06 christos Exp $ */ /* @@ -39,7 +39,7 @@ #include "libsa.h" #include <lib/libsa/ufs.h> -const char version[] = "0.3"; +const char version[] = "0.4"; int debug = 0; /* diff --git a/sys/arch/socppc/stand/boot/machdep.c b/sys/arch/socppc/stand/boot/machdep.c index 4fbe4a86789..08de498b8d1 100644 --- a/sys/arch/socppc/stand/boot/machdep.c +++ b/sys/arch/socppc/stand/boot/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.3 2009/10/05 22:05:28 dms Exp $ */ +/* $OpenBSD: machdep.c,v 1.4 2009/11/08 22:00:34 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -22,6 +22,14 @@ #include "wdvar.h" #include "fdt.h" +/* + * RouterBOOT firmware puts its FDT at an address that is low enough + * to conflict with bsd.rd. So we need to relocate the FDT. As long + * as we have at least 32MB of memory, the 16MB boundary should be + * fine, and leave us plenty of room for future kernel growth. + */ +#define FDTADDRSTART 0x01000000 + #define RPR 0xe0000918 #define RPR_RSTE 0x52535445 #define RCR 0xe000091c @@ -109,15 +117,24 @@ int main(void) { extern char __bss_start[], _end[]; - bzero(__bss_start, _end-__bss_start); + extern int fdtaddrsave; + + bzero(__bss_start, _end - __bss_start); /* initialize FDT if the blob is available */ - extern int fdtaddrsave; if (fdtaddrsave) { if (fdt_init((void *)fdtaddrsave) == 0) fdtaddrsave = 0; /* no usable blob there */ } + /* relocate FDT */ + if (fdtaddrsave && fdtaddrsave < FDTADDRSTART) { + struct fdt_head *fh = (void *)fdtaddrsave; + + bcopy((void *)fdtaddrsave, (void *)FDTADDRSTART, fh->fh_size); + fdtaddrsave = FDTADDRSTART; + } + boot(0); return 0; } |