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