diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2024-06-04 20:31:36 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2024-06-04 20:31:36 +0000 |
commit | 7bce35db7419e9fac4915da8ac5e800285bd14f5 (patch) | |
tree | adc1b6e45b5ebda0977b1cafe37fc4456f26a5d7 /sys/arch/i386 | |
parent | 74fc88872daaebb38a316c8af48c64792f7881e1 (diff) |
Enable hibernate/resume to nvme(4) disks with 4096 byte sectors.
testing by florian@ mglocker@ mlarkin@
ok deraadt@ mglocker@ mlarkin@
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/stand/libsa/diskprobe.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/arch/i386/stand/libsa/diskprobe.c b/sys/arch/i386/stand/libsa/diskprobe.c index d2876cb8d9a..b309a5c0ab4 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.48 2022/09/01 13:45:26 krw Exp $ */ +/* $OpenBSD: diskprobe.c,v 1.49 2024/06/04 20:31:35 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -467,9 +467,10 @@ bootdev_has_hibernate(void) void check_hibernate(struct diskinfo *dip) { + uint8_t buf[DEV_BSIZE]; daddr_t sec; int error; - union hibernate_info hib; + union hibernate_info *hib = (union hibernate_info *)&buf; /* read hibernate */ if (dip->disklabel.d_partitions[1].p_fstype != FS_SWAP || @@ -477,10 +478,10 @@ check_hibernate(struct diskinfo *dip) return; sec = DL_GETPOFFSET(&dip->disklabel.d_partitions[1]) + - DL_GETPSIZE(&dip->disklabel.d_partitions[1]) - - (sizeof(union hibernate_info) / DEV_BSIZE); + DL_GETPSIZE(&dip->disklabel.d_partitions[1]) - 1; - error = dip->strategy(dip, F_READ, sec, sizeof hib, &hib, NULL); - if (error == 0 && hib.magic == HIBERNATE_MAGIC) + error = dip->strategy(dip, F_READ, DL_SECTOBLK(&dip->disklabel, sec), + sizeof buf, &buf, NULL); + if (error == 0 && hib->magic == HIBERNATE_MAGIC) dip->bios_info.flags |= BDI_HIBVALID; /* Hibernate present */ } |