From 08fede8d77b9df5b4028cf4018eba2373c694bd4 Mon Sep 17 00:00:00 2001 From: kn Date: Mon, 15 Aug 2022 13:13:41 +0000 Subject: [PATCH] Add softraid(4) RAID 1C boot support This is the arm64 adaptation of stsp's (commitid: p55cmsVoEH0fRg77) "add support for booting from RAID 1C softraid(4) volumes on amd64". Tell the boot loader to decrypt 1C like C volumes and check the number of disks in 1C like in 1C volumes -- no new code rquired. Tested on SolidRun CEX7 OK stsp NB: While kernel and boot loader support root on softraid on arm64, installboot(8) does not, i.e. default installations still require manual disk preparation for now. --- sys/arch/arm64/stand/efiboot/conf.c | 4 ++-- sys/arch/arm64/stand/efiboot/softraid_arm64.c | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/arch/arm64/stand/efiboot/conf.c b/sys/arch/arm64/stand/efiboot/conf.c index 7497d21e0ba..1e031a377be 100644 --- a/sys/arch/arm64/stand/efiboot/conf.c +++ b/sys/arch/arm64/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.39 2022/07/30 21:06:54 patrick Exp $ */ +/* $OpenBSD: conf.c,v 1.40 2022/08/15 13:13:41 kn Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -46,7 +46,7 @@ #include "efipxe.h" #include "softraid_arm64.h" -const char version[] = "1.11"; +const char version[] = "1.12"; int debug = 0; struct fs_ops file_system[] = { diff --git a/sys/arch/arm64/stand/efiboot/softraid_arm64.c b/sys/arch/arm64/stand/efiboot/softraid_arm64.c index 37177303337..80a83157ac3 100644 --- a/sys/arch/arm64/stand/efiboot/softraid_arm64.c +++ b/sys/arch/arm64/stand/efiboot/softraid_arm64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_arm64.c,v 1.3 2021/06/02 22:44:27 krw Exp $ */ +/* $OpenBSD: softraid_arm64.c,v 1.4 2022/08/15 13:13:41 kn Exp $ */ /* * Copyright (c) 2012 Joel Sing @@ -285,6 +285,7 @@ srprobe(void) break; case 1: + case 0x1C: if (bv->sbv_chunk_no == bv->sbv_chunks_found) bv->sbv_state = BIOC_SVONLINE; else if (bv->sbv_chunks_found > 0) @@ -341,7 +342,7 @@ sr_strategy(struct sr_boot_volume *bv, int rw, daddr_t blk, size_t size, /* XXX - If I/O failed we should try another chunk... */ return dip->strategy(dip, rw, blk, size, buf, rsize); - } else if (bv->sbv_level == 'C') { + } else if (bv->sbv_level == 'C' || bv->sbv_level == 0x1C) { /* Select first online chunk. */ SLIST_FOREACH(bc, &bv->sbv_chunks, sbc_link) @@ -604,7 +605,8 @@ sropen(struct open_file *f, ...) return EADAPT; } - if (bv->sbv_level == 'C' && bv->sbv_keys == NULL) + if ((bv->sbv_level == 'C' || bv->sbv_level == 0x1C) + && bv->sbv_keys == NULL) if (sr_crypto_unlock_volume(bv) != 0) return EPERM; -- 2.20.1