diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2012-10-09 12:58:08 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2012-10-09 12:58:08 +0000 |
commit | c0a2bd79b51ad862778e94ac08e51d2b86a0352b (patch) | |
tree | 4e7556e20239e437ea446f0c21a116104a7eb89f /sys/arch | |
parent | 9dd2347c33110f38758fee95a09b63b85c8251ec (diff) |
Allow boot(8) to pass information to the kernel, regarding the softraid
volume that it booted off.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 19 | ||||
-rw-r--r-- | sys/arch/amd64/include/biosvar.h | 10 | ||||
-rw-r--r-- | sys/arch/i386/i386/bios.c | 19 | ||||
-rw-r--r-- | sys/arch/i386/include/biosvar.h | 10 |
4 files changed, 54 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index a6c09fcd299..61bd68d98a1 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.156 2012/10/08 21:47:47 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.157 2012/10/09 12:58:07 jsing Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -140,6 +140,11 @@ extern int db_console; #include <dev/ic/comreg.h> #endif +#include "softraid.h" +#if NSOFTRAID > 0 +#include <dev/softraidvar.h> +#endif + /* the following is used externally (sysctl_hw) */ char machine[] = MACHINE; @@ -1747,6 +1752,7 @@ getbootinfo(char *bootinfo, int bootinfo_size) bootarg32_t *q; bios_ddb_t *bios_ddb; bios_bootduid_t *bios_bootduid; + bios_bootsr_t *bios_bootsr; #undef BOOTINFO_DEBUG #ifdef BOOTINFO_DEBUG @@ -1846,6 +1852,17 @@ getbootinfo(char *bootinfo, int bootinfo_size) bcopy(bios_bootduid, bootduid, sizeof(bootduid)); break; + case BOOTARG_BOOTSR: + bios_bootsr = (bios_bootsr_t *)q->ba_arg; +#if NSOFTRAID > 0 + bcopy(&bios_bootsr->uuid, &sr_bootuuid, + sizeof(sr_bootuuid)); + bcopy(&bios_bootsr->maskkey, &sr_bootkey, + sizeof(sr_bootkey)); +#endif + explicit_bzero(bios_bootsr, sizeof(bios_bootsr_t)); + break; + default: #ifdef BOOTINFO_DEBUG printf(" unsupported arg (%d) %p", q->ba_type, diff --git a/sys/arch/amd64/include/biosvar.h b/sys/arch/amd64/include/biosvar.h index 7c993d09439..364458bfc95 100644 --- a/sys/arch/amd64/include/biosvar.h +++ b/sys/arch/amd64/include/biosvar.h @@ -1,5 +1,5 @@ /* XXX - DSR */ -/* $OpenBSD: biosvar.h,v 1.16 2012/06/03 13:18:33 kettenis Exp $ */ +/* $OpenBSD: biosvar.h,v 1.17 2012/10/09 12:58:07 jsing Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -221,6 +221,14 @@ typedef struct _bios_bootduid { u_char duid[8]; } __packed bios_bootduid_t; +#define BOOTARG_BOOTSR 10 +#define BOOTSR_UUID_MAX 16 +#define BOOTSR_CRYPTO_MAXKEYBYTES 32 +typedef struct _bios_bootsr { + u_int8_t uuid[BOOTSR_UUID_MAX]; + u_int8_t maskkey[BOOTSR_CRYPTO_MAXKEYBYTES]; +} __packed bios_bootsr_t; + #if defined(_KERNEL) || defined (_STANDALONE) #ifdef _LOCORE diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c index d3fd9ce4f5d..4fea285a9e9 100644 --- a/sys/arch/i386/i386/bios.c +++ b/sys/arch/i386/i386/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.96 2012/08/10 18:50:04 krw Exp $ */ +/* $OpenBSD: bios.c,v 1.97 2012/10/09 12:58:07 jsing Exp $ */ /* * Copyright (c) 1997-2001 Michael Shalayeff @@ -76,6 +76,11 @@ #include <dev/ic/comreg.h> #endif +#include "softraid.h" +#if NSOFTRAID > 0 +#include <dev/softraidvar.h> +#endif + struct bios_softc { struct device sc_dev; }; @@ -456,6 +461,7 @@ bios_getopt() bootarg_t *q; bios_ddb_t *bios_ddb; bios_bootduid_t *bios_bootduid; + bios_bootsr_t *bios_bootsr; #ifdef BIOS_DEBUG printf("bootargv:"); @@ -554,6 +560,17 @@ bios_getopt() bcopy(bios_bootduid, bootduid, sizeof(bootduid)); break; + case BOOTARG_BOOTSR: + bios_bootsr = (bios_bootsr_t *)q->ba_arg; +#if NSOFTRAID > 0 + bcopy(&bios_bootsr->uuid, &sr_bootuuid, + sizeof(sr_bootuuid)); + bcopy(&bios_bootsr->maskkey, &sr_bootkey, + sizeof(sr_bootkey)); +#endif + explicit_bzero(bios_bootsr, sizeof(bios_bootsr_t)); + break; + default: #ifdef BIOS_DEBUG printf(" unsupported arg (%d) %p", q->ba_type, diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h index 54e64129af9..40f640b67d4 100644 --- a/sys/arch/i386/include/biosvar.h +++ b/sys/arch/i386/include/biosvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biosvar.h,v 1.58 2012/06/03 13:17:47 kettenis Exp $ */ +/* $OpenBSD: biosvar.h,v 1.59 2012/10/09 12:58:07 jsing Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -223,6 +223,14 @@ typedef struct _bios_bootduid { u_char duid[8]; } __packed bios_bootduid_t; +#define BOOTARG_BOOTSR 10 +#define BOOTSR_UUID_MAX 16 +#define BOOTSR_CRYPTO_MAXKEYBYTES 32 +typedef struct _bios_bootsr { + u_int8_t uuid[BOOTSR_UUID_MAX]; + u_int8_t maskkey[BOOTSR_CRYPTO_MAXKEYBYTES]; +} __packed bios_bootsr_t; + #if defined(_KERNEL) || defined (_STANDALONE) #ifdef _LOCORE |