diff options
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/conf/ld.script | 7 | ||||
-rw-r--r-- | sys/arch/sparc64/include/boot_flag.h | 18 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/autoconf.c | 27 |
3 files changed, 49 insertions, 3 deletions
diff --git a/sys/arch/sparc64/conf/ld.script b/sys/arch/sparc64/conf/ld.script index 5def4c42b2d..ffab0e81650 100644 --- a/sys/arch/sparc64/conf/ld.script +++ b/sys/arch/sparc64/conf/ld.script @@ -1,4 +1,4 @@ -/* $OpenBSD: ld.script,v 1.6 2014/01/06 21:16:31 tobiasu Exp $ */ +/* $OpenBSD: ld.script,v 1.7 2014/11/26 20:06:53 stsp Exp $ */ /* * Copyright (c) 2013 Mark Kettenis <kettenis@openbsd.org> @@ -25,6 +25,7 @@ PHDRS text PT_LOAD; data PT_LOAD; openbsd_randomize 0x65a3dbe6; /* PT_OPENBSD_RANDOMIZE */ + openbsd_bootdata 0x65a41be6; /* PT_OPENBSD_BOOTDATA */ } SECTIONS @@ -48,6 +49,10 @@ SECTIONS { *(.openbsd.randomdata) } :data :openbsd_randomize + .openbsd.bootdata : + { + *(.openbsd.bootdata) + } :data :openbsd_bootdata .bss : { *(.bss) diff --git a/sys/arch/sparc64/include/boot_flag.h b/sys/arch/sparc64/include/boot_flag.h index 77518f1861d..67ddbbbe064 100644 --- a/sys/arch/sparc64/include/boot_flag.h +++ b/sys/arch/sparc64/include/boot_flag.h @@ -1,4 +1,4 @@ -/* $OpenBSD: boot_flag.h,v 1.4 2014/07/20 18:24:34 deraadt Exp $ */ +/* $OpenBSD: boot_flag.h,v 1.5 2014/11/26 20:06:53 stsp Exp $ */ /* $NetBSD: boot_flag.h,v 1.3 2001/07/01 02:56:21 gmcgarry Exp $ */ /*- @@ -62,4 +62,20 @@ \ } while (/* CONSTCOND */ 0) + +/* softraid boot information */ +#define BOOTSR_UUID_MAX 16 +#define BOOTSR_CRYPTO_MAXKEYBYTES 32 + +/* MD boot data in .openbsd.bootdata ELF segment */ +struct openbsd_bootdata { + u_int64_t version; + u_int64_t len; /* of structure */ + + u_int8_t sr_uuid[BOOTSR_UUID_MAX]; + u_int8_t sr_maskkey[BOOTSR_CRYPTO_MAXKEYBYTES]; +} __packed; + +#define BOOTDATA_VERSION 1 + #endif /* _MACHINE_BOOT_FLAG_H_ */ diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index ff9b77271f5..956262d6389 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.121 2014/09/26 09:45:59 stsp Exp $ */ +/* $OpenBSD: autoconf.c,v 1.122 2014/11/26 20:06:53 stsp Exp $ */ /* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */ /* @@ -67,6 +67,7 @@ #include <uvm/uvm_extern.h> #include <machine/bus.h> +#include <machine/boot_flag.h> #include <machine/autoconf.h> #include <machine/hypervisor.h> #include <machine/mdesc.h> @@ -80,6 +81,8 @@ #include <sparc64/dev/vbusvar.h> #include <sparc64/dev/cbusvar.h> +#include <stand/boot/bootarg.h> + #include <dev/ata/atavar.h> #include <dev/pci/pcivar.h> #include <dev/sbus/sbusvar.h> @@ -96,6 +99,16 @@ #include <ddb/db_extern.h> #endif +#include "softraid.h" +#if NSOFTRAID > 0 +#include <sys/sensors.h> +#include <dev/softraidvar.h> + +/* XXX */ +#undef DPRINTF +#undef DNPRINTF +#endif + int printspl = 0; /* @@ -127,6 +140,8 @@ static void bootpath_build(void); static void bootpath_print(struct bootpath *); void bootpath_nodes(struct bootpath *, int); +struct openbsd_bootdata obd __attribute__((section(".openbsd.bootdata"))); + int bus_class(struct device *); int instance_match(struct device *, void *, struct bootpath *bp); void nail_bootdev(struct device *, struct bootpath *); @@ -637,6 +652,16 @@ cpu_configure() mdesc_init(); #endif + if (obd.version == BOOTDATA_VERSION && + obd.len == sizeof(struct openbsd_bootdata)) { +#if NSOFTRAID > 0 + memcpy(sr_bootuuid.sui_id, obd.sr_uuid, + sizeof(sr_bootuuid.sui_id)); + memcpy(sr_bootkey, obd.sr_maskkey, sizeof(sr_bootkey)); +#endif + explicit_bzero(obd.sr_maskkey, sizeof(obd.sr_maskkey)); + } + /* build the bootpath */ bootpath_build(); |