diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2011-11-14 00:26:04 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2011-11-14 00:26:04 +0000 |
commit | 9951ea4c6f95c1afba57717b578ccc3d12e52bb0 (patch) | |
tree | fe401b0532763a0ec4aaeb5b9e6180251c8358aa /sys/arch | |
parent | 91d2dce85a2672c3e6ba92441ac59d13ed59dd8a (diff) |
ahci hibernate device selection code; not yet tested
This code is from deraadt@
Diffstat (limited to 'sys/arch')
-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; } |