xref: /freebsd/share/man/man4/acpi.4 (revision 02e9120893770924227138ba49df1edb3896112a)
1.\"
2.\" Copyright (c) 2001 Michael Smith
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd October 12, 2021
27.Dt ACPI 4
28.Os
29.Sh NAME
30.Nm acpi
31.Nd Advanced Configuration and Power Management support
32.Sh SYNOPSIS
33.Cd "device acpi"
34.Pp
35.Cd "options ACPI_DEBUG"
36.Cd "options DDB"
37.Sh DESCRIPTION
38The
39.Nm
40driver provides support for the Intel/Microsoft/Compaq/Toshiba ACPI
41standard.
42This support includes platform hardware discovery (superseding the
43PnP and PCI BIOS), as well as power management (superseding APM) and
44other features.
45ACPI core support is provided by the ACPI CA reference implementation
46from Intel.
47.Pp
48Note that the
49.Nm
50driver is automatically loaded by the
51.Xr loader 8 ,
52and should only be
53compiled into the kernel on platforms where ACPI is mandatory.
54.Sh SYSCTL VARIABLES
55The
56.Nm
57driver is intended to provide power management without user intervention.
58If the default settings are not optimal, the following sysctls can be
59used to modify or monitor
60.Nm
61behavior.
62Note that some variables will be available only if the given hardware supports
63them (such as
64.Va hw.acpi.acline ) .
65.Bl -tag -width indent
66.It Va debug.acpi.enable_debug_objects
67Enable dumping Debug objects without
68.Cd "options ACPI_DEBUG" .
69Default is 0, ignore Debug objects.
70.It Va dev.cpu.N.cx_usage
71Debugging information listing the percent of total usage for each sleep state.
72The values are reset when
73.Va dev.cpu.N.cx_lowest
74is modified.
75.It Va dev.cpu.N.cx_lowest
76Lowest Cx state to use for idling the CPU.
77A scheduling algorithm will select states between
78.Li C1
79and this setting
80as system load dictates.
81To enable ACPI CPU idling control,
82.Va machdep.idle
83should be set to
84.Li acpi
85if it is listed in
86.Va machdep.idle_available .
87.It Va dev.cpu.N.cx_supported
88List of supported CPU idle states and their transition latency
89in microseconds.
90Each state has a type (e.g.,
91.Li C2 ) .
92.Li C1
93is equivalent to the ia32
94.Li HLT
95instruction,
96.Li C2
97provides a deeper
98sleep with the same semantics, and
99.Li C3
100provides the deepest sleep
101but additionally requires bus mastering to be disabled.
102States greater than
103.Li C3
104provide even more power savings with the same
105semantics as the
106.Li C3
107state.
108Deeper sleeps provide more power savings but increased transition
109latency when an interrupt occurs.
110.It Va dev.cpu.N.cx_method
111List of supported CPU idle states and their transition methods, as
112directed by the firmware.
113.It Va hw.acpi.acline
114AC line state (1 means online, 0 means on battery power).
115.It Va hw.acpi.disable_on_reboot
116Disable ACPI during the reboot process.
117Most systems reboot fine with ACPI still enabled, but some require
118exiting to legacy mode first.
119Default is 0, leave ACPI enabled.
120.It Va hw.acpi.handle_reboot
121Use the ACPI Reset Register capability to reboot the system.
122Some newer systems require use of this register, while some only work
123with legacy rebooting support.
124.It Va hw.acpi.lid_switch_state
125Suspend state
126.Pq Li S1 Ns \[en] Ns Li S5
127to enter when the lid switch (i.e., a notebook screen) is closed, or
128.Dq Li NONE
129.Pq do nothing .
130Default is
131.Dq Li NONE .
132.It Va hw.acpi.power_button_state
133Suspend state
134.Pq Li S1 Ns \[en] Ns Li S5
135to enter when the power button is pressed, or
136.Dq Li NONE
137.Pq do nothing .
138Default is
139.Li S5
140(power-off nicely).
141.It Va hw.acpi.reset_video
142Reset the video adapter from real mode during the resume path.
143Some systems need this help, others have display problems if it is enabled.
144Default is 0 (disabled).
145.It Va hw.acpi.s4bios
146Indicate whether the system supports
147.Li S4BIOS .
148This means that the BIOS can handle all the functions of suspending the
149system to disk.
150Otherwise, the OS is responsible for suspending to disk
151.Pq Li S4OS .
152Most current systems do not support
153.Li S4BIOS .
154.It Va hw.acpi.sleep_button_state
155Suspend state
156.Pq Li S1 Ns \[en] Ns Li S5
157to enter when the sleep button is pressed.
158This is usually a special function button on the keyboard.
159Default is
160.Li S3
161(suspend-to-RAM).
162.It Va hw.acpi.sleep_delay
163Wait this number of seconds between preparing the system to suspend and
164actually entering the suspend state.
165Default is 1 second.
166.It Va hw.acpi.supported_sleep_state
167Suspend states
168.Pq Li S1 Ns \[en] Ns Li S5
169supported by the BIOS.
170.Bl -tag -width indent
171.It Li S1
172Quick suspend to RAM.
173The CPU enters a lower power state, but most peripherals are left running.
174.It Li S2
175Lower power state than
176.Li S1 ,
177but with the same basic characteristics.
178Not supported by many systems.
179.It Li S3
180Suspend to RAM.
181Most devices are powered off, and the system stops running except for
182memory refresh.
183.It Li S4
184Suspend to disk.
185All devices are powered off, and the system stops running.
186When resuming, the system starts as if from a cold power on.
187Not yet supported by
188.Fx
189unless
190.Li S4BIOS
191is available.
192.It Li S5
193System shuts down cleanly and powers off.
194.El
195.It Va hw.acpi.verbose
196Enable verbose printing from the various ACPI subsystems.
197.El
198.Sh LOADER TUNABLES
199Tunables can be set at the
200.Xr loader 8
201prompt before booting the kernel or stored in
202.Pa /boot/loader.conf .
203Many of these tunables also have a matching
204.Xr sysctl 8
205entry for access after boot.
206.Bl -tag -width indent
207.It Va acpi_dsdt_load
208Enables loading of a custom ACPI DSDT.
209.It Va acpi_dsdt_name
210Name of the DSDT table to load, if loading is enabled.
211.It Va debug.acpi.disabled
212Selectively disables portions of ACPI for debugging purposes.
213.It Va debug.acpi.interpreter_slack
214Enable less strict ACPI implementations.
215Default is 1, ignore common BIOS mistakes.
216.It Va debug.acpi.max_threads
217Specify the number of task threads that are started on boot.
218Limiting this to 1 may help work around various BIOSes that cannot
219handle parallel requests.
220The default value is 3.
221.It Va debug.acpi.quirks
222Override any automatic quirks completely.
223.It Va debug.acpi.resume_beep
224Beep the PC speaker on resume.
225This can help diagnose suspend/resume problems.
226Default is 0 (disabled).
227.It Va hint.acpi.0.disabled
228Set this to 1 to disable all of ACPI.
229If ACPI has been disabled on your system due to a blacklist entry for your
230BIOS, you can set this to 0 to re-enable ACPI for testing.
231.It Va hw.acpi.ec.poll_timeout
232Delay in milliseconds to wait for the EC to respond.
233Try increasing this number if you get the error
234.Qq Li AE_NO_HARDWARE_RESPONSE .
235.It Va hw.acpi.host_mem_start
236Override the assumed memory starting address for PCI host bridges.
237.It Va hw.acpi.install_interface , hw.acpi.remove_interface
238Install or remove OS interface(s) to control return value of
239.Ql _OSI
240query method.
241When an OS interface is specified in
242.Va hw.acpi.install_interface ,
243.Li _OSI
244query for the interface returns it is
245.Em supported .
246Conversely, when an OS interface is specified in
247.Va hw.acpi.remove_interface ,
248.Li _OSI
249query returns it is
250.Em not supported .
251Multiple interfaces can be specified in a comma-separated list and
252any leading white spaces will be ignored.
253For example,
254.Qq Li FreeBSD, Linux
255is a valid list of two interfaces
256.Qq Li FreeBSD
257and
258.Qq Li Linux .
259.It Va hw.acpi.reset_video
260Enables calling the VESA reset BIOS vector on the resume path.
261This can fix some graphics cards that have problems such as LCD white-out
262after resume.
263Default is 0 (disabled).
264.It Va hw.acpi.serialize_methods
265Allow override of whether methods execute in parallel or not.
266Enable this for serial behavior, which fixes
267.Qq Li AE_ALREADY_EXISTS
268errors for
269AML that really cannot handle parallel method execution.
270It is off by default since this breaks recursive methods and some IBMs use
271such code.
272.It Va hw.acpi.verbose
273Turn on verbose debugging information about what ACPI is doing.
274.It Va hw.pci.link.%s.%d.irq
275Override the interrupt to use for this link and index.
276This capability should be used carefully, and only if a device is not
277working with
278.Nm
279enabled.
280.Qq %s
281is the name of the link (e.g., LNKA).
282.Qq %d
283is the resource index when the link supports multiple IRQs.
284Most PCI links only have one IRQ resource, so the below form should be used.
285.It Va hw.pci.link.%s.irq
286Override the interrupt to use.
287This capability should be used carefully, and only if a device is not
288working with
289.Nm
290enabled.
291.Qq %s
292is the name of the link (e.g., LNKA).
293.El
294.Sh DISABLING ACPI
295Since ACPI support on different platforms varies greatly, there are many
296debugging and tuning options available.
297.Pp
298For machines known not to work with
299.Nm
300enabled, there is a BIOS blacklist.
301Currently, the blacklist only controls whether
302.Nm
303should be disabled or not.
304In the future, it will have more granularity to control features (the
305infrastructure for that is already there).
306.Pp
307To enable
308.Nm
309(for debugging purposes, etc.) on machines that are on the blacklist, set the
310kernel environment variable
311.Va hint.acpi.0.disabled
312to 0.
313Before trying this, consider updating your BIOS to a more recent version that
314may be compatible with ACPI.
315.Pp
316To disable the
317.Nm
318driver completely, set the kernel environment variable
319.Va hint.acpi.0.disabled
320to 1.
321.Pp
322Some i386 machines totally fail to operate with some or all of ACPI disabled.
323Other i386 machines fail with ACPI enabled.
324Disabling all or part of ACPI on non-i386 platforms (i.e., platforms where
325ACPI support is mandatory) may result in a non-functional system.
326.Pp
327The
328.Nm
329driver comprises a set of drivers, which may be selectively disabled
330in case of problems.
331To disable a sub-driver, list it in the kernel
332environment variable
333.Va debug.acpi.disabled .
334Multiple entries can be listed, separated by a space.
335.Pp
336ACPI sub-devices and features that can be disabled:
337.Bl -tag -width ".Li sysresource"
338.It Li all
339Disable all ACPI features and devices.
340.It Li acad
341.Pq Vt device
342Supports AC adapter.
343.It Li bus
344.Pq Vt feature
345Probes and attaches subdevices.
346Disabling will avoid scanning the ACPI namespace entirely.
347.It Li children
348.Pq Vt feature
349Attaches standard ACPI sub-drivers and devices enumerated in the
350ACPI namespace.
351Disabling this has a similar effect to disabling
352.Dq Li bus ,
353except that the
354ACPI namespace will still be scanned.
355.It Li button
356.Pq Vt device
357Supports ACPI button devices (typically power and sleep buttons).
358.It Li cmbat
359.Pq Vt device
360Control-method batteries device.
361.It Li cpu
362.Pq Vt device
363Supports CPU power-saving and speed-setting functions.
364.It Li ec
365.Pq Vt device
366Supports the ACPI Embedded Controller interface, used to communicate
367with embedded platform controllers.
368.It Li isa
369.Pq Vt device
370Supports an ISA bus bridge defined in the ACPI namespace,
371typically as a child of a PCI bus.
372.It Li lid
373.Pq Vt device
374Supports an ACPI laptop lid switch, which typically puts a
375system to sleep.
376.It Li mwait
377.Pq Vt feature
378Do not ask firmware for available x86-vendor specific methods to enter
379.Li Cx
380sleep states.
381Only query and use the generic I/O-based entrance method.
382The knob is provided to work around inconsistencies in the tables
383filled by firmware.
384.It Li quirks
385.Pq Vt feature
386Do not honor quirks.
387Quirks automatically disable ACPI functionality based on the XSDT table's
388OEM vendor name and revision date.
389.It Li pci
390.Pq Vt device
391Supports Host to PCI bridges.
392.It Li pci_link
393.Pq Vt feature
394Performs PCI interrupt routing.
395.It Li sysresource
396.Pq Vt device
397Pseudo-devices containing resources which ACPI claims.
398.It Li thermal
399.Pq Vt device
400Supports system cooling and heat management.
401.It Li timer
402.Pq Vt device
403Implements a timecounter using the ACPI fixed-frequency timer.
404.It Li video
405.Pq Vt device
406Supports
407.Xr acpi_video 4
408which may conflict with
409.Xr agp 4
410device.
411.El
412.Pp
413It is also possible to avoid portions of the ACPI namespace which
414may be causing problems, by listing the full path of the root of
415the region to be avoided in the kernel environment variable
416.Va debug.acpi.avoid .
417The object and all of its children will be ignored during the
418bus/children scan of the namespace.
419The ACPI CA code will still know about the avoided region.
420.Sh DEBUGGING OUTPUT
421To enable debugging output,
422.Nm
423must be compiled with
424.Cd "options ACPI_DEBUG" .
425Debugging output is separated between layers and levels, where a layer is
426a component of the ACPI subsystem, and a level is a particular kind
427of debugging output.
428.Pp
429Both layers and levels are specified as a whitespace-separated list of
430tokens, with layers listed in
431.Va debug.acpi.layer
432and levels in
433.Va debug.acpi.level .
434.Pp
435The first set of layers is for ACPI-CA components, and the second is for
436.Fx
437drivers.
438The ACPI-CA layer descriptions include the prefix for the files they
439refer to.
440The supported layers are:
441.Pp
442.Bl -tag -compact -width ".Li ACPI_CA_DISASSEMBLER"
443.It Li ACPI_UTILITIES
444Utility ("ut") functions
445.It Li ACPI_HARDWARE
446Hardware access ("hw")
447.It Li ACPI_EVENTS
448Event and GPE ("ev")
449.It Li ACPI_TABLES
450Table access ("tb")
451.It Li ACPI_NAMESPACE
452Namespace evaluation ("ns")
453.It Li ACPI_PARSER
454AML parser ("ps")
455.It Li ACPI_DISPATCHER
456Internal representation of interpreter state ("ds")
457.It Li ACPI_EXECUTER
458Execute AML methods ("ex")
459.It Li ACPI_RESOURCES
460Resource parsing ("rs")
461.It Li ACPI_CA_DEBUGGER
462Debugger implementation ("db", "dm")
463.It Li ACPI_OS_SERVICES
464Usermode support routines ("os")
465.It Li ACPI_CA_DISASSEMBLER
466Disassembler implementation (unused)
467.It Li ACPI_ALL_COMPONENTS
468All the above ACPI-CA components
469.It Li ACPI_AC_ADAPTER
470AC adapter driver
471.It Li ACPI_BATTERY
472Control-method battery driver
473.It Li ACPI_BUS
474ACPI, ISA, and PCI bus drivers
475.It Li ACPI_BUTTON
476Power and sleep button driver
477.It Li ACPI_EC
478Embedded controller driver
479.It Li ACPI_FAN
480Fan driver
481.It Li ACPI_OEM
482Platform-specific driver for hotkeys, LED, etc.
483.It Li ACPI_POWER
484Power resource driver
485.It Li ACPI_PROCESSOR
486CPU driver
487.It Li ACPI_THERMAL
488Thermal zone driver
489.It Li ACPI_TIMER
490Timer driver
491.It Li ACPI_ALL_DRIVERS
492All the above
493.Fx
494ACPI drivers
495.El
496.Pp
497The supported levels are:
498.Pp
499.Bl -tag -compact -width ".Li ACPI_LV_AML_DISASSEMBLE"
500.It Li ACPI_LV_INIT
501Initialization progress
502.It Li ACPI_LV_DEBUG_OBJECT
503Stores to objects
504.It Li ACPI_LV_INFO
505General information and progress
506.It Li ACPI_LV_REPAIR
507Repair a common problem with predefined methods
508.It Li ACPI_LV_ALL_EXCEPTIONS
509All the previous levels
510.It Li ACPI_LV_PARSE
511.It Li ACPI_LV_DISPATCH
512.It Li ACPI_LV_EXEC
513.It Li ACPI_LV_NAMES
514.It Li ACPI_LV_OPREGION
515.It Li ACPI_LV_BFIELD
516.It Li ACPI_LV_TABLES
517.It Li ACPI_LV_VALUES
518.It Li ACPI_LV_OBJECTS
519.It Li ACPI_LV_RESOURCES
520.It Li ACPI_LV_USER_REQUESTS
521.It Li ACPI_LV_PACKAGE
522.It Li ACPI_LV_VERBOSITY1
523All the previous levels
524.It Li ACPI_LV_ALLOCATIONS
525.It Li ACPI_LV_FUNCTIONS
526.It Li ACPI_LV_OPTIMIZATIONS
527.It Li ACPI_LV_VERBOSITY2
528All the previous levels
529.It Li ACPI_LV_ALL
530Synonym for
531.Qq Li ACPI_LV_VERBOSITY2
532.It Li ACPI_LV_MUTEX
533.It Li ACPI_LV_THREADS
534.It Li ACPI_LV_IO
535.It Li ACPI_LV_INTERRUPTS
536.It Li ACPI_LV_VERBOSITY3
537All the previous levels
538.It Li ACPI_LV_AML_DISASSEMBLE
539.It Li ACPI_LV_VERBOSE_INFO
540.It Li ACPI_LV_FULL_TABLES
541.It Li ACPI_LV_EVENTS
542.It Li ACPI_LV_VERBOSE
543All levels after
544.Qq Li ACPI_LV_VERBOSITY3
545.It Li ACPI_LV_INIT_NAMES
546.It Li ACPI_LV_LOAD
547.El
548.Pp
549Selection of the appropriate layer and level values is important
550to avoid massive amounts of debugging output.
551For example, the following configuration is a good way to gather initial
552information.
553It enables debug output for both ACPI-CA and the
554.Nm
555driver, printing basic information about errors, warnings, and progress.
556.Bd -literal -offset indent
557debug.acpi.layer="ACPI_ALL_COMPONENTS ACPI_ALL_DRIVERS"
558debug.acpi.level="ACPI_LV_ALL_EXCEPTIONS"
559.Ed
560.Pp
561Debugging output by the ACPI CA subsystem is prefixed with the
562module name in lowercase, followed by a source line number.
563Output from the
564.Fx Ns -local
565code follows the same format, but
566the module name is uppercased.
567.Sh OVERRIDING YOUR BIOS BYTECODE
568ACPI interprets bytecode named AML
569(ACPI Machine Language)
570provided by the BIOS vendor as a memory image at boot time.
571Sometimes, the AML code contains a bug that does not appear when parsed
572by the Microsoft implementation.
573.Fx
574provides a way to override it with your own AML code to work around
575or debug such problems.
576Note that all AML in your DSDT and any SSDT tables is overridden.
577.Pp
578In order to load your AML code, you must edit
579.Pa /boot/loader.conf
580and include the following lines.
581.Bd -literal -offset indent
582acpi_dsdt_load="YES"
583acpi_dsdt_name="/boot/acpi_dsdt.aml" # You may change this name.
584.Ed
585.Pp
586In order to prepare your AML code, you will need the
587.Xr acpidump 8
588and
589.Xr iasl 8
590utilities and some ACPI knowledge.
591.Sh COMPATIBILITY
592ACPI is only found and supported on i386/ia32 and amd64.
593.Sh SEE ALSO
594.Xr kenv 1 ,
595.Xr acpi_thermal 4 ,
596.Xr device.hints 5 ,
597.Xr loader.conf 5 ,
598.Xr acpiconf 8 ,
599.Xr acpidump 8 ,
600.Xr config 8 ,
601.Xr iasl 8
602.Rs
603.%A "Compaq Computer Corporation"
604.%A "Intel Corporation"
605.%A "Microsoft Corporation"
606.%A "Phoenix Technologies Ltd."
607.%A "Toshiba Corporation"
608.%D August 25, 2003
609.%T "Advanced Configuration and Power Interface Specification"
610.%U http://acpi.info/spec.htm
611.Re
612.Sh AUTHORS
613.An -nosplit
614The ACPI CA subsystem is developed and maintained by
615Intel Architecture Labs.
616.Pp
617The following people made notable contributions to the ACPI subsystem
618in
619.Fx :
620.An Michael Smith ,
621.An Takanori Watanabe Aq Mt takawata@jp.FreeBSD.org ,
622.An Mitsuru IWASAKI Aq Mt iwasaki@jp.FreeBSD.org ,
623.An Munehiro Matsuda ,
624.An Nate Lawson ,
625the ACPI-jp mailing list at
626.Aq Mt acpi-jp@jp.FreeBSD.org ,
627and many other contributors.
628.Pp
629This manual page was written by
630.An Michael Smith Aq Mt msmith@FreeBSD.org .
631.Sh BUGS
632Many BIOS versions have serious bugs that may cause system instability,
633break suspend/resume, or prevent devices from operating properly due to
634IRQ routing problems.
635Upgrade your BIOS to the latest version available from the vendor before
636deciding it is a problem with
637.Nm .
638