139 lines · c
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */2/*3 * Include file for the interface to an APM BIOS4 * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)5 *6 * This program is free software; you can redistribute it and/or modify it7 * under the terms of the GNU General Public License as published by the8 * Free Software Foundation; either version 2, or (at your option) any9 * later version.10 *11 * This program is distributed in the hope that it will be useful, but12 * WITHOUT ANY WARRANTY; without even the implied warranty of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU14 * General Public License for more details.15 */16#ifndef _UAPI_LINUX_APM_H17#define _UAPI_LINUX_APM_H18 19 20#include <linux/types.h>21 22typedef unsigned short apm_event_t;23typedef unsigned short apm_eventinfo_t;24 25struct apm_bios_info {26 __u16 version;27 __u16 cseg;28 __u32 offset;29 __u16 cseg_16;30 __u16 dseg;31 __u16 flags;32 __u16 cseg_len;33 __u16 cseg_16_len;34 __u16 dseg_len;35};36 37 38/*39 * Power states40 */41#define APM_STATE_READY 0x000042#define APM_STATE_STANDBY 0x000143#define APM_STATE_SUSPEND 0x000244#define APM_STATE_OFF 0x000345#define APM_STATE_BUSY 0x000446#define APM_STATE_REJECT 0x000547#define APM_STATE_OEM_SYS 0x002048#define APM_STATE_OEM_DEV 0x004049 50#define APM_STATE_DISABLE 0x000051#define APM_STATE_ENABLE 0x000152 53#define APM_STATE_DISENGAGE 0x000054#define APM_STATE_ENGAGE 0x000155 56/*57 * Events (results of Get PM Event)58 */59#define APM_SYS_STANDBY 0x000160#define APM_SYS_SUSPEND 0x000261#define APM_NORMAL_RESUME 0x000362#define APM_CRITICAL_RESUME 0x000463#define APM_LOW_BATTERY 0x000564#define APM_POWER_STATUS_CHANGE 0x000665#define APM_UPDATE_TIME 0x000766#define APM_CRITICAL_SUSPEND 0x000867#define APM_USER_STANDBY 0x000968#define APM_USER_SUSPEND 0x000a69#define APM_STANDBY_RESUME 0x000b70#define APM_CAPABILITY_CHANGE 0x000c71#define APM_USER_HIBERNATION 0x000d72#define APM_HIBERNATION_RESUME 0x000e73 74/*75 * Error codes76 */77#define APM_SUCCESS 0x0078#define APM_DISABLED 0x0179#define APM_CONNECTED 0x0280#define APM_NOT_CONNECTED 0x0381#define APM_16_CONNECTED 0x0582#define APM_16_UNSUPPORTED 0x0683#define APM_32_CONNECTED 0x0784#define APM_32_UNSUPPORTED 0x0885#define APM_BAD_DEVICE 0x0986#define APM_BAD_PARAM 0x0a87#define APM_NOT_ENGAGED 0x0b88#define APM_BAD_FUNCTION 0x0c89#define APM_RESUME_DISABLED 0x0d90#define APM_NO_ERROR 0x5391#define APM_BAD_STATE 0x6092#define APM_NO_EVENTS 0x8093#define APM_NOT_PRESENT 0x8694 95/*96 * APM Device IDs97 */98#define APM_DEVICE_BIOS 0x000099#define APM_DEVICE_ALL 0x0001100#define APM_DEVICE_DISPLAY 0x0100101#define APM_DEVICE_STORAGE 0x0200102#define APM_DEVICE_PARALLEL 0x0300103#define APM_DEVICE_SERIAL 0x0400104#define APM_DEVICE_NETWORK 0x0500105#define APM_DEVICE_PCMCIA 0x0600106#define APM_DEVICE_BATTERY 0x8000107#define APM_DEVICE_OEM 0xe000108#define APM_DEVICE_OLD_ALL 0xffff109#define APM_DEVICE_CLASS 0x00ff110#define APM_DEVICE_MASK 0xff00111 112 113/*114 * Battery status115 */116#define APM_MAX_BATTERIES 2117 118/*119 * APM defined capability bit flags120 */121#define APM_CAP_GLOBAL_STANDBY 0x0001122#define APM_CAP_GLOBAL_SUSPEND 0x0002123#define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */124#define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */125#define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */126#define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */127#define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */128#define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */129 130/*131 * ioctl operations132 */133#include <linux/ioctl.h>134 135#define APM_IOC_STANDBY _IO('A', 1)136#define APM_IOC_SUSPEND _IO('A', 2)137 138#endif /* _UAPI_LINUX_APM_H */139