APM(4)

πŸ’… APM(4) β€” the i386 Kernel Interfaces Manual glow-up

ok so bestie, welcome to APM(4), straight out of the i386 Kernel Interfaces Manual ✨ this is the page for apm, and yeah she's a legacy queen but she still has lore. let's get into it 🫢


✨ NAME ✨

apm β€” APM BIOS interface πŸ’»βš‘

πŸŽ€ SYNOPSIS πŸŽ€

device apm

πŸ’€ DEPRECATION NOTICE πŸ’€

ok so heads up: this driver is scheduled for removal prior to the release of FreeBSD 13.0. she's on her farewell tour, no cap. 😭

🌸 DESCRIPTION 🌸

apm is your interface to the Intel / Microsoft APM (Advanced Power Management) BIOS on laptop PCs. that's the vibe. it's giving "my battery is my whole personality." πŸ”‹

here's everything apm does for you, in order, because we love a numbered list:

  1. when the system wakes up from suspended mode, apm adjusts the system clock to RTC. ⏰✨
  2. when the system wakes up from suspended mode, apm passes a message to syslogd(8) comprising of system wakeup time and elapsed time during suspended mode. she's a gossip, she tells on you. πŸ“
  3. apm slows the CPU clock when there are no system activities (runnable processes, interrupts, etc.). this function is available only on systems whose APM supports CPU idling. if yours doesn't, don't come for her. πŸ™ˆ
  4. apm exports an application interface as a character device. applications can control APM, or retrieve APM status information via this interface. apm exports the following interfaces. these symbols are defined in <machine/apm_bios.h>. πŸ“–
    • APMIO_SUSPEND β€” Suspend system. 😴
    • APMIO_GET β€” Get power management information. πŸ“Š
    • APMIO_ENABLE / APMIO_DISABLE β€” Enable / Disable power management. πŸ”›
    • APMIO_HALTCPU / APMIO_NOTHALTCPU β€” Control execution of HLT in the kernel context switch routine. πŸ›‘
    • APMIO_GETPWSTATUS β€” Get per battery information. πŸ”‹πŸ’–

okay so about those last two, the HLT ones, because this is where it gets real:

Some APM implementations execute the HLT (Halt CPU until an interrupt occurs) instruction in the "Idle CPU" call, while others do not. Thus enabling this may result in redundant HLT executions because "Idle CPU" is called from the kernel context switch routine that inherently executes HLT. This may reduce peak system performance.
Also the system hangs up if HLT instruction is disabled in the kernel context switch routine, and if the APM implementation of the machine does not execute HLT in "Idle CPU". On some implementations that do not support CPU clock slowdown, APM might not execute HLT. apm disables APMIO_NOTHALTCPU operation on such machines. πŸ’€
The current version of apm does not call "Idle CPU" from the kernel context switch routine if clock slowdown is not supported, and it executes HLT instruction by default. Therefore, there is no need to use these two operations in most cases. periodt. πŸ’…

these interfaces are used by apm(8). πŸ‘‘

  1. apm polls APM events and handles the following events. here's the whole roster, bestie, nobody's getting cut:
    • PMEV_STANDBYREQ β€” suspend system β€” standby request
    • PMEV_SUSPENDREQ β€” suspend system β€” suspend request
    • PMEV_USERSUSPENDREQ β€” suspend system β€” user suspend request
    • PMEV_CRITSUSPEND β€” suspend system β€” critical suspend request
    • PMEV_NORMRESUME β€” resume system β€” normal resume
    • PMEV_CRITRESUME β€” resume system β€” critical resume
    • PMEV_STANDBYRESUME β€” resume system β€” standby resume
    • PMEV_BATTERYLOW β€” notify message β€” battery low
    • PMEV_UPDATETIME β€” adjust clock β€” update time

πŸ¦‹ SEE ALSO πŸ¦‹

apm(8), zzz(8) πŸ˜΄πŸ’€

πŸ‘‘ AUTHORS πŸ‘‘

Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org> β€” thank you for your service, king 🫑

πŸ”₯ BUGS πŸ”₯

WARNING! Many, if not most, of the implementations of APM-bios in laptops today are buggy. You may be putting your LCD-display and batteries at a risk by using this interface. (The reason this is not a problem for MS-Windows is that they use the real-mode interface.) If you see any weird behavior from your system with this code in use, unplug the power and batteries ASAP, if not immediately, and disable this code.

like bestie that is not a drill, that is a whole fire emoji situation. πŸ”₯😭

We are very interested in getting this code working, so please send your observations of any anomalous behavior to us. she's asking for feedback, respectfully. πŸ™

When apm is active, calling the BIOS setup routine by using hot-keys, may cause serious trouble when resuming the system. BIOS setup programs should be called during bootstrap, or from DOS. πŸ’€

Some APM implementations cannot handle events such as pushing the power button or closing the cover. On such implementations, the system must be suspended only by using apm(8) or zzz(8). no improvising. πŸ™…β™€οΈ

Disk spin-down, LCD backlight control, and power on demand have not been supported on the current version. not yet, babes. 🌈


and that's the whole page, bestie!! this one came from the <strong>Debian</strong> crew, dated <strong>November 1, 1994</strong>, and it's filed under <strong>APM(4)</strong>. vintage icon behavior. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from