apm_bios.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Include file for the interface to an APM BIOS
  3. * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2, or (at your option) any
  8. * later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. */
  15. #ifndef _LINUX_APM_H
  16. #define _LINUX_APM_H
  17. #include <uapi/linux/apm_bios.h>
  18. #define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8)
  19. #define APM_CS_16 (APM_CS + 8)
  20. #define APM_DS (APM_CS_16 + 8)
  21. /* Results of APM Installation Check */
  22. #define APM_16_BIT_SUPPORT 0x0001
  23. #define APM_32_BIT_SUPPORT 0x0002
  24. #define APM_IDLE_SLOWS_CLOCK 0x0004
  25. #define APM_BIOS_DISABLED 0x0008
  26. #define APM_BIOS_DISENGAGED 0x0010
  27. /*
  28. * Data for APM that is persistent across module unload/load
  29. */
  30. struct apm_info {
  31. struct apm_bios_info bios;
  32. unsigned short connection_version;
  33. int get_power_status_broken;
  34. int get_power_status_swabinminutes;
  35. int allow_ints;
  36. int forbid_idle;
  37. int realmode_power_off;
  38. int disabled;
  39. };
  40. /*
  41. * The APM function codes
  42. */
  43. #define APM_FUNC_INST_CHECK 0x5300
  44. #define APM_FUNC_REAL_CONN 0x5301
  45. #define APM_FUNC_16BIT_CONN 0x5302
  46. #define APM_FUNC_32BIT_CONN 0x5303
  47. #define APM_FUNC_DISCONN 0x5304
  48. #define APM_FUNC_IDLE 0x5305
  49. #define APM_FUNC_BUSY 0x5306
  50. #define APM_FUNC_SET_STATE 0x5307
  51. #define APM_FUNC_ENABLE_PM 0x5308
  52. #define APM_FUNC_RESTORE_BIOS 0x5309
  53. #define APM_FUNC_GET_STATUS 0x530a
  54. #define APM_FUNC_GET_EVENT 0x530b
  55. #define APM_FUNC_GET_STATE 0x530c
  56. #define APM_FUNC_ENABLE_DEV_PM 0x530d
  57. #define APM_FUNC_VERSION 0x530e
  58. #define APM_FUNC_ENGAGE_PM 0x530f
  59. #define APM_FUNC_GET_CAP 0x5310
  60. #define APM_FUNC_RESUME_TIMER 0x5311
  61. #define APM_FUNC_RESUME_ON_RING 0x5312
  62. #define APM_FUNC_TIMER 0x5313
  63. /*
  64. * Function code for APM_FUNC_RESUME_TIMER
  65. */
  66. #define APM_FUNC_DISABLE_TIMER 0
  67. #define APM_FUNC_GET_TIMER 1
  68. #define APM_FUNC_SET_TIMER 2
  69. /*
  70. * Function code for APM_FUNC_RESUME_ON_RING
  71. */
  72. #define APM_FUNC_DISABLE_RING 0
  73. #define APM_FUNC_ENABLE_RING 1
  74. #define APM_FUNC_GET_RING 2
  75. /*
  76. * Function code for APM_FUNC_TIMER_STATUS
  77. */
  78. #define APM_FUNC_TIMER_DISABLE 0
  79. #define APM_FUNC_TIMER_ENABLE 1
  80. #define APM_FUNC_TIMER_GET 2
  81. /*
  82. * in arch/i386/kernel/setup.c
  83. */
  84. extern struct apm_info apm_info;
  85. /*
  86. * This is the "All Devices" ID communicated to the BIOS
  87. */
  88. #define APM_DEVICE_BALL ((apm_info.connection_version > 0x0100) ? \
  89. APM_DEVICE_ALL : APM_DEVICE_OLD_ALL)
  90. #endif /* LINUX_APM_H */