162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Include file for the interface to an APM BIOS 462306a36Sopenharmony_ci * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 762306a36Sopenharmony_ci * under the terms of the GNU General Public License as published by the 862306a36Sopenharmony_ci * Free Software Foundation; either version 2, or (at your option) any 962306a36Sopenharmony_ci * later version. 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 1262306a36Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 1362306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1462306a36Sopenharmony_ci * General Public License for more details. 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci#ifndef _UAPI_LINUX_APM_H 1762306a36Sopenharmony_ci#define _UAPI_LINUX_APM_H 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#include <linux/types.h> 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_citypedef unsigned short apm_event_t; 2362306a36Sopenharmony_citypedef unsigned short apm_eventinfo_t; 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_cistruct apm_bios_info { 2662306a36Sopenharmony_ci __u16 version; 2762306a36Sopenharmony_ci __u16 cseg; 2862306a36Sopenharmony_ci __u32 offset; 2962306a36Sopenharmony_ci __u16 cseg_16; 3062306a36Sopenharmony_ci __u16 dseg; 3162306a36Sopenharmony_ci __u16 flags; 3262306a36Sopenharmony_ci __u16 cseg_len; 3362306a36Sopenharmony_ci __u16 cseg_16_len; 3462306a36Sopenharmony_ci __u16 dseg_len; 3562306a36Sopenharmony_ci}; 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci/* 3962306a36Sopenharmony_ci * Power states 4062306a36Sopenharmony_ci */ 4162306a36Sopenharmony_ci#define APM_STATE_READY 0x0000 4262306a36Sopenharmony_ci#define APM_STATE_STANDBY 0x0001 4362306a36Sopenharmony_ci#define APM_STATE_SUSPEND 0x0002 4462306a36Sopenharmony_ci#define APM_STATE_OFF 0x0003 4562306a36Sopenharmony_ci#define APM_STATE_BUSY 0x0004 4662306a36Sopenharmony_ci#define APM_STATE_REJECT 0x0005 4762306a36Sopenharmony_ci#define APM_STATE_OEM_SYS 0x0020 4862306a36Sopenharmony_ci#define APM_STATE_OEM_DEV 0x0040 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define APM_STATE_DISABLE 0x0000 5162306a36Sopenharmony_ci#define APM_STATE_ENABLE 0x0001 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#define APM_STATE_DISENGAGE 0x0000 5462306a36Sopenharmony_ci#define APM_STATE_ENGAGE 0x0001 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci/* 5762306a36Sopenharmony_ci * Events (results of Get PM Event) 5862306a36Sopenharmony_ci */ 5962306a36Sopenharmony_ci#define APM_SYS_STANDBY 0x0001 6062306a36Sopenharmony_ci#define APM_SYS_SUSPEND 0x0002 6162306a36Sopenharmony_ci#define APM_NORMAL_RESUME 0x0003 6262306a36Sopenharmony_ci#define APM_CRITICAL_RESUME 0x0004 6362306a36Sopenharmony_ci#define APM_LOW_BATTERY 0x0005 6462306a36Sopenharmony_ci#define APM_POWER_STATUS_CHANGE 0x0006 6562306a36Sopenharmony_ci#define APM_UPDATE_TIME 0x0007 6662306a36Sopenharmony_ci#define APM_CRITICAL_SUSPEND 0x0008 6762306a36Sopenharmony_ci#define APM_USER_STANDBY 0x0009 6862306a36Sopenharmony_ci#define APM_USER_SUSPEND 0x000a 6962306a36Sopenharmony_ci#define APM_STANDBY_RESUME 0x000b 7062306a36Sopenharmony_ci#define APM_CAPABILITY_CHANGE 0x000c 7162306a36Sopenharmony_ci#define APM_USER_HIBERNATION 0x000d 7262306a36Sopenharmony_ci#define APM_HIBERNATION_RESUME 0x000e 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/* 7562306a36Sopenharmony_ci * Error codes 7662306a36Sopenharmony_ci */ 7762306a36Sopenharmony_ci#define APM_SUCCESS 0x00 7862306a36Sopenharmony_ci#define APM_DISABLED 0x01 7962306a36Sopenharmony_ci#define APM_CONNECTED 0x02 8062306a36Sopenharmony_ci#define APM_NOT_CONNECTED 0x03 8162306a36Sopenharmony_ci#define APM_16_CONNECTED 0x05 8262306a36Sopenharmony_ci#define APM_16_UNSUPPORTED 0x06 8362306a36Sopenharmony_ci#define APM_32_CONNECTED 0x07 8462306a36Sopenharmony_ci#define APM_32_UNSUPPORTED 0x08 8562306a36Sopenharmony_ci#define APM_BAD_DEVICE 0x09 8662306a36Sopenharmony_ci#define APM_BAD_PARAM 0x0a 8762306a36Sopenharmony_ci#define APM_NOT_ENGAGED 0x0b 8862306a36Sopenharmony_ci#define APM_BAD_FUNCTION 0x0c 8962306a36Sopenharmony_ci#define APM_RESUME_DISABLED 0x0d 9062306a36Sopenharmony_ci#define APM_NO_ERROR 0x53 9162306a36Sopenharmony_ci#define APM_BAD_STATE 0x60 9262306a36Sopenharmony_ci#define APM_NO_EVENTS 0x80 9362306a36Sopenharmony_ci#define APM_NOT_PRESENT 0x86 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci/* 9662306a36Sopenharmony_ci * APM Device IDs 9762306a36Sopenharmony_ci */ 9862306a36Sopenharmony_ci#define APM_DEVICE_BIOS 0x0000 9962306a36Sopenharmony_ci#define APM_DEVICE_ALL 0x0001 10062306a36Sopenharmony_ci#define APM_DEVICE_DISPLAY 0x0100 10162306a36Sopenharmony_ci#define APM_DEVICE_STORAGE 0x0200 10262306a36Sopenharmony_ci#define APM_DEVICE_PARALLEL 0x0300 10362306a36Sopenharmony_ci#define APM_DEVICE_SERIAL 0x0400 10462306a36Sopenharmony_ci#define APM_DEVICE_NETWORK 0x0500 10562306a36Sopenharmony_ci#define APM_DEVICE_PCMCIA 0x0600 10662306a36Sopenharmony_ci#define APM_DEVICE_BATTERY 0x8000 10762306a36Sopenharmony_ci#define APM_DEVICE_OEM 0xe000 10862306a36Sopenharmony_ci#define APM_DEVICE_OLD_ALL 0xffff 10962306a36Sopenharmony_ci#define APM_DEVICE_CLASS 0x00ff 11062306a36Sopenharmony_ci#define APM_DEVICE_MASK 0xff00 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci/* 11462306a36Sopenharmony_ci * Battery status 11562306a36Sopenharmony_ci */ 11662306a36Sopenharmony_ci#define APM_MAX_BATTERIES 2 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci/* 11962306a36Sopenharmony_ci * APM defined capability bit flags 12062306a36Sopenharmony_ci */ 12162306a36Sopenharmony_ci#define APM_CAP_GLOBAL_STANDBY 0x0001 12262306a36Sopenharmony_ci#define APM_CAP_GLOBAL_SUSPEND 0x0002 12362306a36Sopenharmony_ci#define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */ 12462306a36Sopenharmony_ci#define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */ 12562306a36Sopenharmony_ci#define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */ 12662306a36Sopenharmony_ci#define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */ 12762306a36Sopenharmony_ci#define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */ 12862306a36Sopenharmony_ci#define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */ 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci/* 13162306a36Sopenharmony_ci * ioctl operations 13262306a36Sopenharmony_ci */ 13362306a36Sopenharmony_ci#include <linux/ioctl.h> 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci#define APM_IOC_STANDBY _IO('A', 1) 13662306a36Sopenharmony_ci#define APM_IOC_SUSPEND _IO('A', 2) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#endif /* _UAPI_LINUX_APM_H */ 139