diff options
author | 2011-11-14 00:26:03 +0000 | |
---|---|---|
committer | 2011-11-14 00:26:03 +0000 | |
commit | baf9965f60cd0544c016797c005c0451f1d6d4c2 (patch) | |
tree | 31d1cf7dc5a0e6b6ec19811e2a02004be2cf3308 /sys | |
parent | Use a fixed io_page for all hibernate I/O, which is needed for (diff) | |
download | wireguard-openbsd-baf9965f60cd0544c016797c005c0451f1d6d4c2.tar.xz wireguard-openbsd-baf9965f60cd0544c016797c005c0451f1d6d4c2.zip |
ahci hibernate device selection code; not yet tested
This code is from deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/i386/hibernate_machdep.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/arch/i386/i386/hibernate_machdep.c b/sys/arch/i386/i386/hibernate_machdep.c index 33b7acbf6e8..cd06f8a9bb1 100644 --- a/sys/arch/i386/i386/hibernate_machdep.c +++ b/sys/arch/i386/i386/hibernate_machdep.c @@ -40,6 +40,8 @@ #include "acpi.h" #include "wd.h" +#include "ahci.h" +#include "sd.h" #if NWD > 0 #include <dev/ata/atavar.h> @@ -74,6 +76,20 @@ get_hibernate_io_function(void) if (strcmp(findblkname(major(swdevt[0].sw_dev)), "wd") == 0) return wd_hibernate_io; #endif +#if NAHCI > 0 && NSD > 0 + if (strcmp(findblkname(major(swdevt[0].sw_dev)), "sd") == 0) { + extern struct cfdriver sd_cd; + extern int ahci_hibernate_io(dev_t dev, daddr_t blkno, + vaddr_t addr, size_t size, int wr, void *page); + struct device *dv; + + dv = disk_lookup(&sd_cd, DISKUNIT(swdevt[0].sw_dev)); + if (dv && dv->dv_parent && dv->dv_parent->dv_parent && + strcmp(dv->dv_parent->dv_parent->dv_cfdata->cf_driver->cd_name, + "ahci") == 0) + return ahci_hibernate_io; + } +#endif return NULL; } |