apm_bios.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Include file for the interface to an APM BIOS
  4. * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2, or (at your option) any
  9. * later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. */
  16. #ifndef _UAPI_LINUX_APM_H
  17. #define _UAPI_LINUX_APM_H
  18. #include <linux/types.h>
  19. typedef unsigned short apm_event_t;
  20. typedef unsigned short apm_eventinfo_t;
  21. struct apm_bios_info {
  22. __u16 version;
  23. __u16 cseg;
  24. __u32 offset;
  25. __u16 cseg_16;
  26. __u16 dseg;
  27. __u16 flags;
  28. __u16 cseg_len;
  29. __u16 cseg_16_len;
  30. __u16 dseg_len;
  31. };
  32. /*
  33. * Power states
  34. */
  35. #define APM_STATE_READY 0x0000
  36. #define APM_STATE_STANDBY 0x0001
  37. #define APM_STATE_SUSPEND 0x0002
  38. #define APM_STATE_OFF 0x0003
  39. #define APM_STATE_BUSY 0x0004
  40. #define APM_STATE_REJECT 0x0005
  41. #define APM_STATE_OEM_SYS 0x0020
  42. #define APM_STATE_OEM_DEV 0x0040
  43. #define APM_STATE_DISABLE 0x0000
  44. #define APM_STATE_ENABLE 0x0001
  45. #define APM_STATE_DISENGAGE 0x0000
  46. #define APM_STATE_ENGAGE 0x0001
  47. /*
  48. * Events (results of Get PM Event)
  49. */
  50. #define APM_SYS_STANDBY 0x0001
  51. #define APM_SYS_SUSPEND 0x0002
  52. #define APM_NORMAL_RESUME 0x0003
  53. #define APM_CRITICAL_RESUME 0x0004
  54. #define APM_LOW_BATTERY 0x0005
  55. #define APM_POWER_STATUS_CHANGE 0x0006
  56. #define APM_UPDATE_TIME 0x0007
  57. #define APM_CRITICAL_SUSPEND 0x0008
  58. #define APM_USER_STANDBY 0x0009
  59. #define APM_USER_SUSPEND 0x000a
  60. #define APM_STANDBY_RESUME 0x000b
  61. #define APM_CAPABILITY_CHANGE 0x000c
  62. #define APM_USER_HIBERNATION 0x000d
  63. #define APM_HIBERNATION_RESUME 0x000e
  64. /*
  65. * Error codes
  66. */
  67. #define APM_SUCCESS 0x00
  68. #define APM_DISABLED 0x01
  69. #define APM_CONNECTED 0x02
  70. #define APM_NOT_CONNECTED 0x03
  71. #define APM_16_CONNECTED 0x05
  72. #define APM_16_UNSUPPORTED 0x06
  73. #define APM_32_CONNECTED 0x07
  74. #define APM_32_UNSUPPORTED 0x08
  75. #define APM_BAD_DEVICE 0x09
  76. #define APM_BAD_PARAM 0x0a
  77. #define APM_NOT_ENGAGED 0x0b
  78. #define APM_BAD_FUNCTION 0x0c
  79. #define APM_RESUME_DISABLED 0x0d
  80. #define APM_NO_ERROR 0x53
  81. #define APM_BAD_STATE 0x60
  82. #define APM_NO_EVENTS 0x80
  83. #define APM_NOT_PRESENT 0x86
  84. /*
  85. * APM Device IDs
  86. */
  87. #define APM_DEVICE_BIOS 0x0000
  88. #define APM_DEVICE_ALL 0x0001
  89. #define APM_DEVICE_DISPLAY 0x0100
  90. #define APM_DEVICE_STORAGE 0x0200
  91. #define APM_DEVICE_PARALLEL 0x0300
  92. #define APM_DEVICE_SERIAL 0x0400
  93. #define APM_DEVICE_NETWORK 0x0500
  94. #define APM_DEVICE_PCMCIA 0x0600
  95. #define APM_DEVICE_BATTERY 0x8000
  96. #define APM_DEVICE_OEM 0xe000
  97. #define APM_DEVICE_OLD_ALL 0xffff
  98. #define APM_DEVICE_CLASS 0x00ff
  99. #define APM_DEVICE_MASK 0xff00
  100. /*
  101. * Battery status
  102. */
  103. #define APM_MAX_BATTERIES 2
  104. /*
  105. * APM defined capability bit flags
  106. */
  107. #define APM_CAP_GLOBAL_STANDBY 0x0001
  108. #define APM_CAP_GLOBAL_SUSPEND 0x0002
  109. #define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */
  110. #define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */
  111. #define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */
  112. #define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */
  113. #define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */
  114. #define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */
  115. /*
  116. * ioctl operations
  117. */
  118. #include <linux/ioctl.h>
  119. #define APM_IOC_STANDBY _IO('A', 1)
  120. #define APM_IOC_SUSPEND _IO('A', 2)
  121. #endif /* _UAPI_LINUX_APM_H */