From 3783113b459c03bfe027fef9705ba98848f2ccc6 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Thu, 24 Dec 2015 05:14:19 +0000 Subject: Argh. The other part the wrong diff was missing. Use the size info in struct sr_boot_volume, and not the uninitialized info in the disklabel, when checking the GPT protective MBR. Now both GPT and MBR formatted softraid volumes actually boot. As a bonus add prototype for gpt_chk_mbr(). --- sys/arch/amd64/stand/libsa/softraid.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/stand/libsa/softraid.c b/sys/arch/amd64/stand/libsa/softraid.c index 580daa05060..738bb36a5ec 100644 --- a/sys/arch/amd64/stand/libsa/softraid.c +++ b/sys/arch/amd64/stand/libsa/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.17 2015/12/23 15:22:48 krw Exp $ */ +/* $OpenBSD: softraid.c,v 1.18 2015/12/24 05:14:18 krw Exp $ */ /* * Copyright (c) 2012 Joel Sing @@ -46,6 +46,8 @@ struct sr_boot_keydisk { SLIST_HEAD(sr_boot_keydisk_head, sr_boot_keydisk); struct sr_boot_keydisk_head sr_keydisks; +static int gpt_chk_mbr(struct dos_partition *dp, struct sr_boot_volume *bv); + void srprobe_meta_opt_load(struct sr_metadata *sm, struct sr_meta_opt_head *som) { @@ -406,7 +408,7 @@ sr_strategy(struct sr_boot_volume *bv, int rw, daddr32_t blk, size_t size, * NOTE: MS always uses a size of UINT32_MAX for the EFI partition!** */ int -gpt_chk_mbr(struct dos_partition *dp, struct disklabel *dl) +gpt_chk_mbr(struct dos_partition *dp, struct sr_boot_volume *bv) { struct dos_partition *dp2; int efi, found, i; @@ -420,7 +422,7 @@ gpt_chk_mbr(struct dos_partition *dp, struct disklabel *dl) found++; if (dp2->dp_typ != DOSPTYP_EFI) continue; - dsize = DL_GETDSIZE(dl); + dsize = bv->sbv_size; psize = letoh32(dp2->dp_size); if (psize == (dsize - 1) || psize == UINT32_MAX) { @@ -522,7 +524,7 @@ sr_getdisklabel(struct sr_boot_volume *bv, struct disklabel *label) /* Check for MBR to determine partition offset. */ bzero(&mbr, sizeof(mbr)); sr_strategy(bv, F_READ, DOSBBSECTOR, sizeof(mbr), &mbr, NULL); - if (gpt_chk_mbr(mbr.dmbr_parts, label) == 0) { + if (gpt_chk_mbr(mbr.dmbr_parts, bv) == 0) { start = findopenbsd_gpt(bv); } else if (mbr.dmbr_sign == DOSMBR_SIGNATURE) { -- cgit v1.2.3