2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * Determine whether this machine is capable of suspending. 2N/A * This is done for the i386 architecture by determining if the machine has 2N/A * S3 capability, then ensuring it is on the whitelist. 2N/A/* This is defined in sys/epm.h, but is not visible in user space */ 2N/A * Determine if this machine supports suspend by identifying 2N/A * if the hardware supports a usable "S" state. For now, we only 2N/A * care about S3, but this function should change when more are 2N/A * All we care about currently on x86 platforms, is if the 2N/A * kstats indicate suspend is valid. It would probably be 2N/A * better if there were some API that returned the platform 2N/A * capabilities, but for now the only thing that isn't 2N/A * dependent on actual enablement, are the kstats. 2N/A * Determine if the hardware supports suspend by probing the acpi kstat module. 2N/A * For now, we are only interested in "S3" support on x86, but when there 2N/A * are API's that allow for more specific suspend state selection, this 2N/A * function will be able to handle checking those states as well. 2N/A /* Assume capability not valid until proven otherwise */ 2N/A "%s kstat_lookup \"%s\" failed errno %d (%s)\n",
2N/A "%s kstat_read \"%s\" failed errno %d (%s)\n",
2N/A * Construct a name to pass for the interested state 2N/A "%s kstat_data_lookup machine does not support \"%s\"\n",
2N/A * Not having this state is not an error, but we done 2N/A "%s kstat_data_lookup machine supports \"%s\" %ld\n",
2N/A * The kstat indicates this machine has this "S" state