1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3607ca46eSDavid Howells * Include file for the interface to an APM BIOS 4607ca46eSDavid Howells * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) 5607ca46eSDavid Howells * 6607ca46eSDavid Howells * This program is free software; you can redistribute it and/or modify it 7607ca46eSDavid Howells * under the terms of the GNU General Public License as published by the 8607ca46eSDavid Howells * Free Software Foundation; either version 2, or (at your option) any 9607ca46eSDavid Howells * later version. 10607ca46eSDavid Howells * 11607ca46eSDavid Howells * This program is distributed in the hope that it will be useful, but 12607ca46eSDavid Howells * WITHOUT ANY WARRANTY; without even the implied warranty of 13607ca46eSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14607ca46eSDavid Howells * General Public License for more details. 15607ca46eSDavid Howells */ 16607ca46eSDavid Howells #ifndef _UAPI_LINUX_APM_H 17607ca46eSDavid Howells #define _UAPI_LINUX_APM_H 18607ca46eSDavid Howells 19607ca46eSDavid Howells 20607ca46eSDavid Howells #include <linux/types.h> 21607ca46eSDavid Howells 22607ca46eSDavid Howells typedef unsigned short apm_event_t; 23607ca46eSDavid Howells typedef unsigned short apm_eventinfo_t; 24607ca46eSDavid Howells 25607ca46eSDavid Howells struct apm_bios_info { 26607ca46eSDavid Howells __u16 version; 27607ca46eSDavid Howells __u16 cseg; 28607ca46eSDavid Howells __u32 offset; 29607ca46eSDavid Howells __u16 cseg_16; 30607ca46eSDavid Howells __u16 dseg; 31607ca46eSDavid Howells __u16 flags; 32607ca46eSDavid Howells __u16 cseg_len; 33607ca46eSDavid Howells __u16 cseg_16_len; 34607ca46eSDavid Howells __u16 dseg_len; 35607ca46eSDavid Howells }; 36607ca46eSDavid Howells 37607ca46eSDavid Howells 38607ca46eSDavid Howells /* 39607ca46eSDavid Howells * Power states 40607ca46eSDavid Howells */ 41607ca46eSDavid Howells #define APM_STATE_READY 0x0000 42607ca46eSDavid Howells #define APM_STATE_STANDBY 0x0001 43607ca46eSDavid Howells #define APM_STATE_SUSPEND 0x0002 44607ca46eSDavid Howells #define APM_STATE_OFF 0x0003 45607ca46eSDavid Howells #define APM_STATE_BUSY 0x0004 46607ca46eSDavid Howells #define APM_STATE_REJECT 0x0005 47607ca46eSDavid Howells #define APM_STATE_OEM_SYS 0x0020 48607ca46eSDavid Howells #define APM_STATE_OEM_DEV 0x0040 49607ca46eSDavid Howells 50607ca46eSDavid Howells #define APM_STATE_DISABLE 0x0000 51607ca46eSDavid Howells #define APM_STATE_ENABLE 0x0001 52607ca46eSDavid Howells 53607ca46eSDavid Howells #define APM_STATE_DISENGAGE 0x0000 54607ca46eSDavid Howells #define APM_STATE_ENGAGE 0x0001 55607ca46eSDavid Howells 56607ca46eSDavid Howells /* 57607ca46eSDavid Howells * Events (results of Get PM Event) 58607ca46eSDavid Howells */ 59607ca46eSDavid Howells #define APM_SYS_STANDBY 0x0001 60607ca46eSDavid Howells #define APM_SYS_SUSPEND 0x0002 61607ca46eSDavid Howells #define APM_NORMAL_RESUME 0x0003 62607ca46eSDavid Howells #define APM_CRITICAL_RESUME 0x0004 63607ca46eSDavid Howells #define APM_LOW_BATTERY 0x0005 64607ca46eSDavid Howells #define APM_POWER_STATUS_CHANGE 0x0006 65607ca46eSDavid Howells #define APM_UPDATE_TIME 0x0007 66607ca46eSDavid Howells #define APM_CRITICAL_SUSPEND 0x0008 67607ca46eSDavid Howells #define APM_USER_STANDBY 0x0009 68607ca46eSDavid Howells #define APM_USER_SUSPEND 0x000a 69607ca46eSDavid Howells #define APM_STANDBY_RESUME 0x000b 70607ca46eSDavid Howells #define APM_CAPABILITY_CHANGE 0x000c 7115820439SBin Shi #define APM_USER_HIBERNATION 0x000d 7215820439SBin Shi #define APM_HIBERNATION_RESUME 0x000e 73607ca46eSDavid Howells 74607ca46eSDavid Howells /* 75607ca46eSDavid Howells * Error codes 76607ca46eSDavid Howells */ 77607ca46eSDavid Howells #define APM_SUCCESS 0x00 78607ca46eSDavid Howells #define APM_DISABLED 0x01 79607ca46eSDavid Howells #define APM_CONNECTED 0x02 80607ca46eSDavid Howells #define APM_NOT_CONNECTED 0x03 81607ca46eSDavid Howells #define APM_16_CONNECTED 0x05 82607ca46eSDavid Howells #define APM_16_UNSUPPORTED 0x06 83607ca46eSDavid Howells #define APM_32_CONNECTED 0x07 84607ca46eSDavid Howells #define APM_32_UNSUPPORTED 0x08 85607ca46eSDavid Howells #define APM_BAD_DEVICE 0x09 86607ca46eSDavid Howells #define APM_BAD_PARAM 0x0a 87607ca46eSDavid Howells #define APM_NOT_ENGAGED 0x0b 88607ca46eSDavid Howells #define APM_BAD_FUNCTION 0x0c 89607ca46eSDavid Howells #define APM_RESUME_DISABLED 0x0d 90607ca46eSDavid Howells #define APM_NO_ERROR 0x53 91607ca46eSDavid Howells #define APM_BAD_STATE 0x60 92607ca46eSDavid Howells #define APM_NO_EVENTS 0x80 93607ca46eSDavid Howells #define APM_NOT_PRESENT 0x86 94607ca46eSDavid Howells 95607ca46eSDavid Howells /* 96607ca46eSDavid Howells * APM Device IDs 97607ca46eSDavid Howells */ 98607ca46eSDavid Howells #define APM_DEVICE_BIOS 0x0000 99607ca46eSDavid Howells #define APM_DEVICE_ALL 0x0001 100607ca46eSDavid Howells #define APM_DEVICE_DISPLAY 0x0100 101607ca46eSDavid Howells #define APM_DEVICE_STORAGE 0x0200 102607ca46eSDavid Howells #define APM_DEVICE_PARALLEL 0x0300 103607ca46eSDavid Howells #define APM_DEVICE_SERIAL 0x0400 104607ca46eSDavid Howells #define APM_DEVICE_NETWORK 0x0500 105607ca46eSDavid Howells #define APM_DEVICE_PCMCIA 0x0600 106607ca46eSDavid Howells #define APM_DEVICE_BATTERY 0x8000 107607ca46eSDavid Howells #define APM_DEVICE_OEM 0xe000 108607ca46eSDavid Howells #define APM_DEVICE_OLD_ALL 0xffff 109607ca46eSDavid Howells #define APM_DEVICE_CLASS 0x00ff 110607ca46eSDavid Howells #define APM_DEVICE_MASK 0xff00 111607ca46eSDavid Howells 112607ca46eSDavid Howells 113607ca46eSDavid Howells /* 114607ca46eSDavid Howells * Battery status 115607ca46eSDavid Howells */ 116607ca46eSDavid Howells #define APM_MAX_BATTERIES 2 117607ca46eSDavid Howells 118607ca46eSDavid Howells /* 119607ca46eSDavid Howells * APM defined capability bit flags 120607ca46eSDavid Howells */ 121607ca46eSDavid Howells #define APM_CAP_GLOBAL_STANDBY 0x0001 122607ca46eSDavid Howells #define APM_CAP_GLOBAL_SUSPEND 0x0002 123607ca46eSDavid Howells #define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */ 124607ca46eSDavid Howells #define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */ 125607ca46eSDavid Howells #define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */ 126607ca46eSDavid Howells #define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */ 127607ca46eSDavid Howells #define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */ 128607ca46eSDavid Howells #define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */ 129607ca46eSDavid Howells 130607ca46eSDavid Howells /* 131607ca46eSDavid Howells * ioctl operations 132607ca46eSDavid Howells */ 133607ca46eSDavid Howells #include <linux/ioctl.h> 134607ca46eSDavid Howells 135607ca46eSDavid Howells #define APM_IOC_STANDBY _IO('A', 1) 136607ca46eSDavid Howells #define APM_IOC_SUSPEND _IO('A', 2) 137607ca46eSDavid Howells 138607ca46eSDavid Howells #endif /* _UAPI_LINUX_APM_H */ 139