summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2017-07-21 01:21:43 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2017-07-21 01:21:43 +0000
commit1831fdde88d9698666e8dd2690878810445e11ff (patch)
tree7592d1c56d6d44182ea7c71c324884c6210e9b46 /sys/arch/i386/stand
parent7c0da4f96e489e1be816f59e353cae08a73481a0 (diff)
Check the hibernation signature for softraid disks and select valid bsd
for unhibernation. reported by Natasha Kerensikova. tested by Theo Buehler. ok deraadt
Diffstat (limited to 'sys/arch/i386/stand')
-rw-r--r--sys/arch/i386/stand/libsa/biosdev.c4
-rw-r--r--sys/arch/i386/stand/libsa/disk.h4
-rw-r--r--sys/arch/i386/stand/libsa/diskprobe.c12
3 files changed, 10 insertions, 10 deletions
diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c
index 382b466e69a..4c06a87e9ff 100644
--- a/sys/arch/i386/stand/libsa/biosdev.c
+++ b/sys/arch/i386/stand/libsa/biosdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosdev.c,v 1.95 2016/09/18 15:13:10 jsing Exp $ */
+/* $OpenBSD: biosdev.c,v 1.96 2017/07/21 01:21:42 yasuoka Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -536,6 +536,7 @@ biosopen(struct open_file *f, ...)
if (bv->sbv_diskinfo == NULL) {
dip = alloc(sizeof(struct diskinfo));
bzero(dip, sizeof(*dip));
+ dip->strategy = biosstrategy;
bv->sbv_diskinfo = dip;
dip->sr_vol = bv;
dip->bios_info.flags |= BDI_BADLABEL;
@@ -549,6 +550,7 @@ biosopen(struct open_file *f, ...)
if (sr_getdisklabel(bv, &dip->disklabel))
return ERDLAB;
dip->bios_info.flags &= ~BDI_BADLABEL;
+ check_hibernate(dip);
}
bv->sbv_part = part + 'a';
diff --git a/sys/arch/i386/stand/libsa/disk.h b/sys/arch/i386/stand/libsa/disk.h
index 5ad8df3c64b..0480574b37d 100644
--- a/sys/arch/i386/stand/libsa/disk.h
+++ b/sys/arch/i386/stand/libsa/disk.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disk.h,v 1.6 2015/09/02 04:09:24 yasuoka Exp $ */
+/* $OpenBSD: disk.h,v 1.7 2017/07/21 01:21:42 yasuoka Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -59,4 +59,6 @@ extern struct disklist_lh disklist;
void dump_diskinfo(void);
+void check_hibernate(struct diskinfo *);
+
#endif /* _DISK_H */
diff --git a/sys/arch/i386/stand/libsa/diskprobe.c b/sys/arch/i386/stand/libsa/diskprobe.c
index 314b3f70aa5..46b4d0e56bb 100644
--- a/sys/arch/i386/stand/libsa/diskprobe.c
+++ b/sys/arch/i386/stand/libsa/diskprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diskprobe.c,v 1.43 2017/06/22 01:26:28 deraadt Exp $ */
+/* $OpenBSD: diskprobe.c,v 1.44 2017/07/21 01:21:42 yasuoka Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -55,7 +55,6 @@
/* Local Prototypes */
static int disksum(int);
-static void check_hibernate(struct diskinfo *);
int bootdev_has_hibernate(void); /* export for loadfile() */
@@ -472,7 +471,7 @@ bootdev_has_hibernate(void)
return ((bootdev_dip->bios_info.flags & BDI_HIBVALID)? 1 : 0);
}
-static void
+void
check_hibernate(struct diskinfo *dip)
{
daddr_t sec;
@@ -489,9 +488,6 @@ check_hibernate(struct diskinfo *dip)
(sizeof(union hibernate_info) / DEV_BSIZE);
error = dip->strategy(dip, F_READ, (daddr32_t)sec, sizeof hib, &hib, NULL);
- if (error == 0 && hib.magic == HIBERNATE_MAGIC) {
- /* Hibernate present */
- dip->bios_info.flags |= BDI_HIBVALID;
- printf("&");
- }
+ if (error == 0 && hib.magic == HIBERNATE_MAGIC)
+ dip->bios_info.flags |= BDI_HIBVALID; /* Hibernate present */
}