summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2009-11-08 22:00:34 +0000
committerkettenis <kettenis@openbsd.org>2009-11-08 22:00:34 +0000
commit6dec73a643a1a1abf65f69020e1a72994e3f2b8b (patch)
treec313e5d76785fbecdd82c07e7e79050289d93546
parent- make aliases expansion use a rb tree instead of a tail queue, the code (diff)
downloadwireguard-openbsd-6dec73a643a1a1abf65f69020e1a72994e3f2b8b.tar.xz
wireguard-openbsd-6dec73a643a1a1abf65f69020e1a72994e3f2b8b.zip
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@
-rw-r--r--sys/arch/socppc/stand/boot/conf.c4
-rw-r--r--sys/arch/socppc/stand/boot/machdep.c23
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;
}