home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / linux / 9531 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  15.0 KB

  1. Path: sparky!uunet!sun-barr!rutgers!dziuxsolim.rutgers.edu!psi.rutgers.edu!scooper
  2. From: scooper@psi.rutgers.edu (Simon P. Cooper)
  3. Newsgroups: comp.os.linux
  4. Subject: Making Linux APM compliant for laptops?
  5. Message-ID: <Aug.31.19.52.27.1992.17240@psi.rutgers.edu>
  6. Date: 31 Aug 92 23:52:27 GMT
  7. Organization: Rutgers Univ., New Brunswick, N.J.
  8. Lines: 353
  9. X-Mn-Key: NORMAL
  10. X-Mn-Key: LAPTOPS
  11.  
  12. I mailed this to "linux-activists".  Others may be interested...
  13. (There is a laptops thread on linux-activists)
  14.  
  15. > Date: Fri, 28 Aug 92 23:27:58 -0400
  16. > From: tytso@athena.mit.edu (Theodore Ts'o)
  17. > Sender: owner-linux-activists@joker.cs.hut.fi
  18. > X-Note1: Remember to put 'X-Mn-Key: normal' to your mail body or header
  19. > X-Mn-Key: NORMAL
  20. > Address: 1 Amherst St., Cambridge, MA 02139
  21. > Phone: (617) 253-8091
  22. >
  23. >    Date:     Sat, 29 Aug 1992 06:01:15 +0300
  24. >    From: Ed Carp <erc@khijol.upl.com>
  25. >
  26. >    I wonder how much hassle it would be to make linux APM-compliant?
  27. >
  28. >    For those who don't know, APM is the Intel/Microsoft name for Advanced
  29. >    Power Management, a system that works to significantly increase battery
  30. >    life in laptops.
  31. >
  32. > Does anyone know where to find the *specs* for APM?  Hopefully APM is
  33. > speced out at a hardware level (send value X to port Y), instead of at
  34. > the BIOS level (do INT 23 with AL set to 5).  If it's the second, it
  35. > would be much harder to support APM than if it had a consistent hardware
  36. > interface.  Unfortunately, knowing Intel/Microsoft, I doubt they did the
  37. > right thing....
  38. >
  39. >                               - Ted
  40.  
  41.    I have already spent a few hours snooping about.  The only place I
  42. found information so far is the excellent: "Comprehensive list of
  43. interrupt calls" by Ralf Brown.  I also skimmed the "pink coloured
  44. cover" edition of the "PC sourcebook" by Thom Hoggan (sp?) but didn't
  45. find anything useful.  I'd be the first to admit that this cannot be
  46. considered thorough research on the problem!  Anyway here is the little
  47. I've found out so far...
  48.  
  49. ---rbrown.txt---
  50. Public Domain/Freeware/Shareware by Ralf Brown:
  51.  
  52. The MSDOS Interrupt List
  53.         A comprehensive listing of more than 4070 functions available
  54.         through interrupt calls on IBM PCs and compatibles.  Includes both
  55.         documented and undocumented functions.
  56.         Current version: INTER31A (release 31, 7/12/92)
  57.                          INTER31B
  58.                          INTER31C (conversion programs)
  59. ....
  60. ----------------
  61.  
  62. You can get your own copy from,
  63.  
  64.     wuarchive.wustl.edu:/mirrors/msdos/info/inter31{a,b,c}.zip
  65.  
  66.    There are some listings for power management routines.  (I have
  67. attached the text for some of the core functions at the end of my
  68. message ...)  The support is in the BIOS :(, fear not though - there are
  69. provisions for 32 bit protected mode operation.
  70.  
  71.    The beast I am working on is a Zenith ZNOTE-320L and the INSTALLATION
  72. CHECK interrupt claims that 32 bit protected mode support exists :) :)
  73.  
  74.     However, not knowing exactly how all the functions are supposed to
  75. operate together I am "debugging" a live Laptop under DOS and making
  76. notes and tweeks.  Quite a bit seems to be going on :)
  77.  
  78. NOTE: To any listening vendors that sell laptops: If I get power
  79. management working on your laptop I just might rush out and buy one.  I
  80. suspect many others would do likewise!  Offer to send me the specs if I
  81. call :).  I have called Zenith, but I think that they misunderstood my
  82. questions :( Persistence is a virtue!
  83.  
  84.    I've created a "laptops" thread.  I am guessing that there are number
  85. of people interested in this line of development ...
  86.  
  87.    If anyone reading this happens to have a copy of the APM spec in a
  88. machine readable form then I'd appreciate a copy.
  89.  
  90. Simon Cooper
  91. Systems Coordinator
  92. Laboratory for Visiometrics and Modeling
  93. -------------------------------------------------------------------------------
  94. Snail-mail: CAIP Center, Rutgers University, E-mail: scooper@vizlab.rutgers.edu
  95.         Frelinghuysen Road, PO Box 1390
  96.         Piscataway. NJ 08855-1390
  97. Telephone: (+1) 908 932 0540                    Fax: (+1) 908 932 4775
  98. -------------------------------------------------------------------------------
  99.  
  100. Reproduced without permission from Ralf Brown's interrupt list...
  101.  
  102. ----------155300BX0000-----------------------
  103. INT 15 - Advanced Power Management Specification - INSTALLATION CHECK
  104.     AX = 5300h
  105.     BX = 0000h (device ID of system BIOS)
  106. Return: CF clear if successful
  107.         AH = major version (BCD)
  108.         AL = minor version (BCD)
  109.         BX = 504Dh ("PM")
  110.         CX = flags
  111.             bit 0: 16-bit protected mode interface supported
  112.         bit 1: 32-bit protected mode interface supported
  113.         bit 2: CPU idle call reduces processor speed
  114.         bit 3: BIOS power management disabled
  115.         bits 4-7 reserved
  116.     CF set on error
  117.         AH = error code (86h) (see below)
  118.  
  119. Values for error code:
  120.  01h    power management functionality disabled
  121.  02h    interface connection already in effect
  122.  03h    interface not connected
  123.  04h    real-mode interface not connected
  124.  05h    16-bit protected-mode interface already connected
  125.  06h    16-bit protected-mode interface not supported
  126.  07h    32-bit protected-mode interface already connected
  127.  08h    32-bit protected-mode interface not supported
  128.  09h    unrecognized device ID
  129.  0Ah    invalid parameter value in CX
  130.  0Bh-1Fh reserved for other interface and general errors
  131.  20h-3Fh reserved for CPU errors
  132.  40h-5Fh reserved for device errors
  133.  60h    can't enter requested state
  134.  61h-7Fh reserved for other system errors
  135.  80h    no power management events pending
  136.  81h-85h reserved for other power management event errors
  137.  86h    APM not present
  138.  87h-9Fh reserved for other power management event errors
  139. ----------155301BX0000-----------------------
  140. INT 15 - Advanced Power Management Specification - CONNECT REAL-MODE INTERFACE
  141.     AX = 5301h
  142.     BX = 0000h (device ID of system BIOS)
  143. Return: CF clear if successful
  144.     CF set on error
  145.         AH = error code (02h,09h) (see AX=5300h)
  146. SeeAlso: AX=5302h,AX=5303h,AX=5304h
  147. ----------155302BX0000-----------------------
  148. INT 15 R - Advanced Power Management Spec - CONNECT 16-BIT PROTMODE INTERFACE
  149.     AX = 5302h
  150.     BX = 0000h (device ID of system BIOS)
  151. Return: CF clear if successful
  152.         AX = real-mode segment base address of protected-mode 16-bit code
  153.             segment
  154.         BX = offset of entry point
  155.         CX = real-mode segment base address of protected-mode 16-bit data
  156.             segment
  157.     CF set on error
  158.         AH = error code (05h,06h,09h) (see AX=5300h)
  159. Notes:    the caller must initialize two consecutive descriptors with the
  160.       returned segment base addresses; these descriptors must be valid
  161.       whenever the protected-mode interface is called, and will have
  162.       their limits arbitrarily set to 64K.
  163.     the protected mode interface is invoked by making a far call with the
  164.       same register values as for INT 15; it must be invoked while CPL=0,
  165.       the code segment descriptor must have a DPL of 0, the stack must be
  166.       in a 16-bit segment and have enough room for BIOS use and possible
  167.       interrupts, and the current I/O permission bit map must allow access
  168.       to the I/O ports used for power management.
  169.     functions 00h-03h are not available from protected mode
  170. SeeAlso: AX=5301h,AX=5303h,AX=5304h
  171. ----------155303BX0000-----------------------
  172. INT 15 - Advanced Power Management Spec - CONNECT 32-BIT PROTMODE INTERFACE
  173.     AX = 5303h
  174.     BX = 0000h (device ID of system BIOS)
  175. Return: CF clear if successful
  176.         AX = real-mode segment base address of protected-mode 32-bit code
  177.             segment
  178.         EBX = offset of entry point
  179.         CX = real-mode segment base address of protected-mode 16-bit code
  180.             segment
  181.         DX = real-mode segment base address of protected-mode 16-bit data
  182.             segment
  183.     CF set on error
  184.         AH = error code (07h,08h,09h) (see AX=5300h)
  185. Notes:    the caller must initialize three consecutive descriptors with the
  186.       returned segment base addresses for 32-bit code, 16-bit code, and
  187.       16-bit data, respectively; these descriptors must be valid whenever
  188.       the protected-mode interface is called, and will have their limits
  189.       arbitrarily set to 64K.
  190.     the protected mode interface is invoked by making a far call to the
  191.       32-bit code segment with the same register values as for INT 15; it
  192.       must be invoked while CPL=0, the code segment descriptor must have a
  193.       DPL of 0, the stack must be in a 32-bit segment and have enough room
  194.       for BIOS use and possible interrupts, and the current I/O permission
  195.       bit map must allow access to the I/O ports used for power management.
  196.     functions 00h-03h are not available from protected mode
  197. SeeAlso: AX=5301h,AX=5302h,AX=5304h
  198. ----------155304BX0000-----------------------
  199. INT 15 - Advanced Power Management Specification - DISCONNECT INTERFACE
  200.     AX = 5304h
  201.     BX = 0000h (device ID of system BIOS)
  202. Return: CF clear if successful
  203.     CF set on error
  204.         AH = error code (03h,09h) (see AX=5300h)
  205. SeeAlso: AX=5301h,AX=5302h,AX=5303h
  206. ----------155305-----------------------------
  207. INT 15 - Advanced Power Management Specification - CPU IDLE
  208.     AX = 5305h
  209. Return: after system leaves idle state
  210.     CF clear
  211. Notes:    call when the system is idle and should be suspended until the next
  212.       system event or interrupt
  213.     should not be called from within a hardware interrupt handler to avoid
  214.       reentrance problems
  215.     if an interrupt causes the system to resume normal processing, the
  216.       interrupt may or may not have been handled when the BIOS returns
  217.       from this call; thus, the caller should allow interrupts on return
  218.     interrupt handlers may not retain control if the BIOS allows
  219.       interrupts while in idle mode even if they are able to determine
  220.       that they were called from idle mode
  221.     the caller should issue this call continuously in a loop until it needs
  222.       to perform some processing of its own
  223. SeeAlso: AX=1000h,AX=5306h,INT 2F/AX=1680h
  224. ----------155306-----------------------------
  225. INT 15 - Advanced Power Management Specification - CPU BUSY
  226.     AX = 5306h
  227. Return: CF clear
  228. Notes:    called to ensure that the system runs at full speed even on systems
  229.       where the BIOS is unable to recognize increased activity (especially
  230.       if interrupts are hooked by other programs and not chained to the
  231.       BIOS)
  232.     this call may be made even when the system is already running at full
  233.       speed, but it will create unnecessary overhead
  234.     should not be called from within a hardware interrupt handler to avoid
  235.       reentrance problems
  236. SeeAlso: AX=5305h
  237. ----------155307-----------------------------
  238. INT 15 - Advanced Power Management Specification - SET POWER STATE
  239.     AX = 5307h
  240.     BX = device ID (see below)
  241.     CX = system state ID
  242.         0000h ready (not supported for device ID 0001h)
  243.         0001h stand-by
  244.         0002h suspend
  245.         0003h off (not supported for device ID 0001h)
  246.         0004h-FFFFh reserved
  247. Return: CF clear if successful
  248.     CF set on error
  249.         AH = error code (01h,09h,0Ah,60h) (see AX=5300h)
  250. Note:    should not be called from within a hardware interrupt handler to avoid
  251.       reentrance problems
  252.  
  253. Values for device IDs:
  254.  0000h    system BIOS
  255.  0001h    all devices for which the system BIOS manages power
  256.  01xxh    display (01FFh for all attached display devices)
  257.  02xxh    secondary storage (02FFh for all attached secondary storage devices)
  258.  03xxh    parallel ports (03FFh for all attached parallel ports)
  259.  04xxh    serial ports (04FFh for all attached serial ports)
  260.  0500h-FFFFh reserved
  261. ----------155307BX0001-----------------------
  262. INT 15 - Advanced Power Management Specification - SYSTEM STAND-BY
  263.     AX = 5307h
  264.     BX = 0001h
  265.     CX = 0001h
  266. Return: CF clear
  267. Notes:    puts the entire system into stand-by mode; normally called in response
  268.       to a System Stand-by Request notification after any necessary
  269.       processing, but may also be invoked at the caller's discretion
  270.     should not be called from within a hardware interrupt handler to avoid
  271.       reentrance problems
  272.     the stand-by state is typically exited on an interrupt
  273. SeeAlso: AX=4280h,AX=5307h/BX=0001h/CX=0002h,AX=530Bh
  274. ----------155307BX0001-----------------------
  275. INT 15 - Advanced Power Management Specification - SUSPEND SYSTEM
  276.     AX = 5307h
  277.     BX = 0001h
  278.     CX = 0002h
  279. Return: after system is resumed
  280.     CF clear
  281. Notes:    puts the entire system into a low-power suspended state; normally
  282.       called in response to a Suspend System Request notification after
  283.       any necessary processing, but may also be invoked at the caller's
  284.       discretion
  285.     should not be called from within a hardware interrupt handler to avoid
  286.       reentrance problems
  287.     the caller may need to update its date and time values because the
  288.       system could have been suspended for a long period of time
  289. SeeAlso: AX=5307h/BX=0001h/CX=0001h,AX=530Bh
  290. ----------155308BXFFFF-----------------------
  291. INT 15 - Advanced Power Management Spec - ENABLE/DISABLE POWER MANAGEMENT
  292.     AX = 5308h
  293.     BX = FFFFh
  294.     CX = new state
  295.         0000h disabled
  296.         0001h enabled
  297. Return: CF clear if successful
  298.     CF set on error
  299.         AH = error code (01h,09h,0Ah) (see AX=5300h)
  300. Notes:    when power management is disabled, the system BIOS will not
  301.       automatically power down devices, enter stand-by or suspended mode,
  302.       or perform any power-saving actions in response to AX=5305h calls
  303.     should not be called from within a hardware interrupt handler to avoid
  304.       reentrance problems
  305. SeeAlso: AX=5309h
  306. ----------155309BXFFFF-----------------------
  307. INT 15 - Advanced Power Management Specification - RESTORE POWER-ON DEFAULTS
  308.     AX = 5309h
  309.     BX = FFFFh
  310. Return: CF clear if successful
  311.     CF set on error
  312.         AH = error code (09h) (see AX=5300h)
  313. Note:    should not be called from within a hardware interrupt handler to avoid
  314.       reentrance problems
  315. SeeAlso: AX=5308h
  316. ----------15530ABX0001-----------------------
  317. INT 15 - Advanced Power Management Specification - GET POWER STATUS
  318.     AX = 530Ah
  319.     BX = 0001h
  320. Return: CF clear if successful
  321.         BH = AC line status
  322.             00h off-line
  323.         01h on-line
  324.         FFh unknown
  325.         other reserved
  326.         BL = battery status
  327.             00h high
  328.         01h low
  329.         02h critical
  330.         03h charging
  331.         FFh unknown
  332.         other reserved
  333.         CL = remaining battery life
  334.             00h-64h (0-100) percentage of full charge
  335.         FFh unknown
  336.     CF set on error
  337.         AH = error code (09h) (see AX=5300h)
  338. Note:    should not be called from within a hardware interrupt handler to avoid
  339.       reentrance problems
  340. ----------15530B-----------------------------
  341. INT 15 - Advanced Power Management Specification - GET POWER MANAGEMENT EVENT
  342.     AX = 530Bh
  343. Return: CF clear if successful
  344.         BX = event code
  345.             0001h system stand-by request
  346.         0002h system suspend request
  347.         0003h normal resume system notification
  348.         0004h critical resume system notification
  349.         0005h battery low notification
  350.     CF set on error
  351.         AH = error code (03h,80h) (see AX=5300h)
  352. Notes:    although power management events are often asynchronous, notification
  353.       will not be made until polled via this call to permit software to
  354.       only receive event notification when it is prepared to process
  355.       power management events; since these events are not very time-
  356.       critical, it should be sufficient to poll once or twice per second
  357.     the critical resume notification is made after the system resumes
  358.       from an emergency suspension; normally, the system BIOS only notifies
  359.       its partner that it wishes to suspend and relies on the partner to
  360.       actually request the suspension, but no notification is made on an
  361.       emergency suspension
  362.     should not be called from within a hardware interrupt handler to avoid
  363.       reentrance problems
  364. SeeAlso: AX=5307h,AX=5307h/BX=0001h/CX=0001h,AX=5307h/BX=0001h/CX=0002h
  365.