summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-12-24 05:14:19 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-12-24 05:14:19 +0000
commit3783113b459c03bfe027fef9705ba98848f2ccc6 (patch)
treec35f74ae746268bc398a621bd5db07af96361620 /sys/arch/amd64
parentc1e07816ecb4d80f9bd31cf0aaf3509efde6c3cf (diff)
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().
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/stand/libsa/softraid.c10
1 files changed, 6 insertions, 4 deletions
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 <jsing@openbsd.org>
@@ -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) {