apm_bios.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Include file for the interface to an APM BIOS
  4. * Copyright 1994-2001 Stephen Rothwell ([email protected])
  5. */
  6. #ifndef _LINUX_APM_H
  7. #define _LINUX_APM_H
  8. #include <uapi/linux/apm_bios.h>
  9. #define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8)
  10. #define APM_CS_16 (APM_CS + 8)
  11. #define APM_DS (APM_CS_16 + 8)
  12. /* Results of APM Installation Check */
  13. #define APM_16_BIT_SUPPORT 0x0001
  14. #define APM_32_BIT_SUPPORT 0x0002
  15. #define APM_IDLE_SLOWS_CLOCK 0x0004
  16. #define APM_BIOS_DISABLED 0x0008
  17. #define APM_BIOS_DISENGAGED 0x0010
  18. /*
  19. * Data for APM that is persistent across module unload/load
  20. */
  21. struct apm_info {
  22. struct apm_bios_info bios;
  23. unsigned short connection_version;
  24. int get_power_status_broken;
  25. int get_power_status_swabinminutes;
  26. int allow_ints;
  27. int forbid_idle;
  28. int realmode_power_off;
  29. int disabled;
  30. };
  31. /*
  32. * The APM function codes
  33. */
  34. #define APM_FUNC_INST_CHECK 0x5300
  35. #define APM_FUNC_REAL_CONN 0x5301
  36. #define APM_FUNC_16BIT_CONN 0x5302
  37. #define APM_FUNC_32BIT_CONN 0x5303
  38. #define APM_FUNC_DISCONN 0x5304
  39. #define APM_FUNC_IDLE 0x5305
  40. #define APM_FUNC_BUSY 0x5306
  41. #define APM_FUNC_SET_STATE 0x5307
  42. #define APM_FUNC_ENABLE_PM 0x5308
  43. #define APM_FUNC_RESTORE_BIOS 0x5309
  44. #define APM_FUNC_GET_STATUS 0x530a
  45. #define APM_FUNC_GET_EVENT 0x530b
  46. #define APM_FUNC_GET_STATE 0x530c
  47. #define APM_FUNC_ENABLE_DEV_PM 0x530d
  48. #define APM_FUNC_VERSION 0x530e
  49. #define APM_FUNC_ENGAGE_PM 0x530f
  50. #define APM_FUNC_GET_CAP 0x5310
  51. #define APM_FUNC_RESUME_TIMER 0x5311
  52. #define APM_FUNC_RESUME_ON_RING 0x5312
  53. #define APM_FUNC_TIMER 0x5313
  54. /*
  55. * Function code for APM_FUNC_RESUME_TIMER
  56. */
  57. #define APM_FUNC_DISABLE_TIMER 0
  58. #define APM_FUNC_GET_TIMER 1
  59. #define APM_FUNC_SET_TIMER 2
  60. /*
  61. * Function code for APM_FUNC_RESUME_ON_RING
  62. */
  63. #define APM_FUNC_DISABLE_RING 0
  64. #define APM_FUNC_ENABLE_RING 1
  65. #define APM_FUNC_GET_RING 2
  66. /*
  67. * Function code for APM_FUNC_TIMER_STATUS
  68. */
  69. #define APM_FUNC_TIMER_DISABLE 0
  70. #define APM_FUNC_TIMER_ENABLE 1
  71. #define APM_FUNC_TIMER_GET 2
  72. /*
  73. * in arch/i386/kernel/setup.c
  74. */
  75. extern struct apm_info apm_info;
  76. /*
  77. * This is the "All Devices" ID communicated to the BIOS
  78. */
  79. #define APM_DEVICE_BALL ((apm_info.connection_version > 0x0100) ? \
  80. APM_DEVICE_ALL : APM_DEVICE_OLD_ALL)
  81. #endif /* LINUX_APM_H */