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