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 July 15, 2024 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.hw.acpi.override_isa_irq_polarity (x86) 260Forces active-lo polarity for edge-triggered ISA interrupts. 261Some older systems incorrectly specify active-lo polarity for ISA 262interrupts and this override fixes those systems. 263This override is enabled by default on systems with Intel CPUs, 264but can be enabled or disabled by setting the tunable explicitly. 265.It Va hw.acpi.reset_video 266Enables calling the VESA reset BIOS vector on the resume path. 267This can fix some graphics cards that have problems such as LCD white-out 268after resume. 269Default is 0 (disabled). 270.It Va hw.acpi.serialize_methods 271Allow override of whether methods execute in parallel or not. 272Enable this for serial behavior, which fixes 273.Qq Li AE_ALREADY_EXISTS 274errors for 275AML that really cannot handle parallel method execution. 276It is off by default since this breaks recursive methods and some IBMs use 277such code. 278.It Va hw.acpi.verbose 279Turn on verbose debugging information about what ACPI is doing. 280.It Va hw.pci.link.%s.%d.irq 281Override the interrupt to use for this link and index. 282This capability should be used carefully, and only if a device is not 283working with 284.Nm 285enabled. 286.Qq %s 287is the name of the link (e.g., LNKA). 288.Qq %d 289is the resource index when the link supports multiple IRQs. 290Most PCI links only have one IRQ resource, so the below form should be used. 291.It Va hw.pci.link.%s.irq 292Override the interrupt to use. 293This capability should be used carefully, and only if a device is not 294working with 295.Nm 296enabled. 297.Qq %s 298is the name of the link (e.g., LNKA). 299.El 300.Sh DISABLING ACPI 301Since ACPI support on different platforms varies greatly, there are many 302debugging and tuning options available. 303.Pp 304For machines known not to work with 305.Nm 306enabled, there is a BIOS blacklist. 307Currently, the blacklist only controls whether 308.Nm 309should be disabled or not. 310In the future, it will have more granularity to control features (the 311infrastructure for that is already there). 312.Pp 313To enable 314.Nm 315(for debugging purposes, etc.) on machines that are on the blacklist, set the 316kernel environment variable 317.Va hint.acpi.0.disabled 318to 0. 319Before trying this, consider updating your BIOS to a more recent version that 320may be compatible with ACPI. 321.Pp 322To disable the 323.Nm 324driver completely, set the kernel environment variable 325.Va hint.acpi.0.disabled 326to 1. 327.Pp 328Some i386 machines totally fail to operate with some or all of ACPI disabled. 329Other i386 machines fail with ACPI enabled. 330Disabling all or part of ACPI on non-i386 platforms (i.e., platforms where 331ACPI support is mandatory) may result in a non-functional system. 332.Pp 333The 334.Nm 335driver comprises a set of drivers, which may be selectively disabled 336in case of problems. 337To disable a sub-driver, list it in the kernel 338environment variable 339.Va debug.acpi.disabled . 340Multiple entries can be listed, separated by a space. 341.Pp 342ACPI sub-devices and features that can be disabled: 343.Bl -tag -width ".Li sysresource" 344.It Li all 345Disable all ACPI features and devices. 346.It Li acad 347.Pq Vt device 348Supports AC adapter. 349.It Li bus 350.Pq Vt feature 351Probes and attaches subdevices. 352Disabling will avoid scanning the ACPI namespace entirely. 353.It Li children 354.Pq Vt feature 355Attaches standard ACPI sub-drivers and devices enumerated in the 356ACPI namespace. 357Disabling this has a similar effect to disabling 358.Dq Li bus , 359except that the 360ACPI namespace will still be scanned. 361.It Li button 362.Pq Vt device 363Supports ACPI button devices (typically power and sleep buttons). 364.It Li cmbat 365.Pq Vt device 366Control-method batteries device. 367.It Li cpu 368.Pq Vt device 369Supports CPU power-saving and speed-setting functions. 370.It Li ec 371.Pq Vt device 372Supports the ACPI Embedded Controller interface, used to communicate 373with embedded platform controllers. 374.It Li isa 375.Pq Vt device 376Supports an ISA bus bridge defined in the ACPI namespace, 377typically as a child of a PCI bus. 378.It Li lid 379.Pq Vt device 380Supports an ACPI laptop lid switch, which typically puts a 381system to sleep. 382.It Li mwait 383.Pq Vt feature 384Do not ask firmware for available x86-vendor specific methods to enter 385.Li Cx 386sleep states. 387Only query and use the generic I/O-based entrance method. 388The knob is provided to work around inconsistencies in the tables 389filled by firmware. 390.It Li quirks 391.Pq Vt feature 392Do not honor quirks. 393Quirks automatically disable ACPI functionality based on the XSDT table's 394OEM vendor name and revision date. 395.It Li pci 396.Pq Vt device 397Supports Host to PCI bridges. 398.It Li pci_link 399.Pq Vt feature 400Performs PCI interrupt routing. 401.It Li sysresource 402.Pq Vt device 403Pseudo-devices containing resources which ACPI claims. 404.It Li thermal 405.Pq Vt device 406Supports system cooling and heat management. 407.It Li timer 408.Pq Vt device 409Implements a timecounter using the ACPI fixed-frequency timer. 410.It Li video 411.Pq Vt device 412Supports 413.Xr acpi_video 4 414which may conflict with 415.Xr agp 4 416device. 417.El 418.Pp 419It is also possible to avoid portions of the ACPI namespace which 420may be causing problems, by listing the full path of the root of 421the region to be avoided in the kernel environment variable 422.Va debug.acpi.avoid . 423The object and all of its children will be ignored during the 424bus/children scan of the namespace. 425The ACPI CA code will still know about the avoided region. 426.Sh DEBUGGING OUTPUT 427To enable debugging output, 428.Nm 429must be compiled with 430.Cd "options ACPI_DEBUG" . 431Debugging output is separated between layers and levels, where a layer is 432a component of the ACPI subsystem, and a level is a particular kind 433of debugging output. 434.Pp 435Both layers and levels are specified as a whitespace-separated list of 436tokens, with layers listed in 437.Va debug.acpi.layer 438and levels in 439.Va debug.acpi.level . 440.Pp 441The first set of layers is for ACPI-CA components, and the second is for 442.Fx 443drivers. 444The ACPI-CA layer descriptions include the prefix for the files they 445refer to. 446The supported layers are: 447.Pp 448.Bl -tag -compact -width ".Li ACPI_CA_DISASSEMBLER" 449.It Li ACPI_UTILITIES 450Utility ("ut") functions 451.It Li ACPI_HARDWARE 452Hardware access ("hw") 453.It Li ACPI_EVENTS 454Event and GPE ("ev") 455.It Li ACPI_TABLES 456Table access ("tb") 457.It Li ACPI_NAMESPACE 458Namespace evaluation ("ns") 459.It Li ACPI_PARSER 460AML parser ("ps") 461.It Li ACPI_DISPATCHER 462Internal representation of interpreter state ("ds") 463.It Li ACPI_EXECUTER 464Execute AML methods ("ex") 465.It Li ACPI_RESOURCES 466Resource parsing ("rs") 467.It Li ACPI_CA_DEBUGGER 468Debugger implementation ("db", "dm") 469.It Li ACPI_OS_SERVICES 470Usermode support routines ("os") 471.It Li ACPI_CA_DISASSEMBLER 472Disassembler implementation (unused) 473.It Li ACPI_ALL_COMPONENTS 474All the above ACPI-CA components 475.It Li ACPI_AC_ADAPTER 476AC adapter driver 477.It Li ACPI_BATTERY 478Control-method battery driver 479.It Li ACPI_BUS 480ACPI, ISA, and PCI bus drivers 481.It Li ACPI_BUTTON 482Power and sleep button driver 483.It Li ACPI_EC 484Embedded controller driver 485.It Li ACPI_FAN 486Fan driver 487.It Li ACPI_OEM 488Platform-specific driver for hotkeys, LED, etc. 489.It Li ACPI_POWER 490Power resource driver 491.It Li ACPI_PROCESSOR 492CPU driver 493.It Li ACPI_THERMAL 494Thermal zone driver 495.It Li ACPI_TIMER 496Timer driver 497.It Li ACPI_ALL_DRIVERS 498All the above 499.Fx 500ACPI drivers 501.El 502.Pp 503The supported levels are: 504.Pp 505.Bl -tag -compact -width ".Li ACPI_LV_AML_DISASSEMBLE" 506.It Li ACPI_LV_INIT 507Initialization progress 508.It Li ACPI_LV_DEBUG_OBJECT 509Stores to objects 510.It Li ACPI_LV_INFO 511General information and progress 512.It Li ACPI_LV_REPAIR 513Repair a common problem with predefined methods 514.It Li ACPI_LV_ALL_EXCEPTIONS 515All the previous levels 516.It Li ACPI_LV_PARSE 517.It Li ACPI_LV_DISPATCH 518.It Li ACPI_LV_EXEC 519.It Li ACPI_LV_NAMES 520.It Li ACPI_LV_OPREGION 521.It Li ACPI_LV_BFIELD 522.It Li ACPI_LV_TABLES 523.It Li ACPI_LV_VALUES 524.It Li ACPI_LV_OBJECTS 525.It Li ACPI_LV_RESOURCES 526.It Li ACPI_LV_USER_REQUESTS 527.It Li ACPI_LV_PACKAGE 528.It Li ACPI_LV_VERBOSITY1 529All the previous levels 530.It Li ACPI_LV_ALLOCATIONS 531.It Li ACPI_LV_FUNCTIONS 532.It Li ACPI_LV_OPTIMIZATIONS 533.It Li ACPI_LV_VERBOSITY2 534All the previous levels 535.It Li ACPI_LV_ALL 536Synonym for 537.Qq Li ACPI_LV_VERBOSITY2 538.It Li ACPI_LV_MUTEX 539.It Li ACPI_LV_THREADS 540.It Li ACPI_LV_IO 541.It Li ACPI_LV_INTERRUPTS 542.It Li ACPI_LV_VERBOSITY3 543All the previous levels 544.It Li ACPI_LV_AML_DISASSEMBLE 545.It Li ACPI_LV_VERBOSE_INFO 546.It Li ACPI_LV_FULL_TABLES 547.It Li ACPI_LV_EVENTS 548.It Li ACPI_LV_VERBOSE 549All levels after 550.Qq Li ACPI_LV_VERBOSITY3 551.It Li ACPI_LV_INIT_NAMES 552.It Li ACPI_LV_LOAD 553.El 554.Pp 555Selection of the appropriate layer and level values is important 556to avoid massive amounts of debugging output. 557For example, the following configuration is a good way to gather initial 558information. 559It enables debug output for both ACPI-CA and the 560.Nm 561driver, printing basic information about errors, warnings, and progress. 562.Bd -literal -offset indent 563debug.acpi.layer="ACPI_ALL_COMPONENTS ACPI_ALL_DRIVERS" 564debug.acpi.level="ACPI_LV_ALL_EXCEPTIONS" 565.Ed 566.Pp 567Debugging output by the ACPI CA subsystem is prefixed with the 568module name in lowercase, followed by a source line number. 569Output from the 570.Fx Ns -local 571code follows the same format, but 572the module name is uppercased. 573.Sh OVERRIDING YOUR BIOS BYTECODE 574ACPI interprets bytecode named AML 575(ACPI Machine Language) 576provided by the BIOS vendor as a memory image at boot time. 577Sometimes, the AML code contains a bug that does not appear when parsed 578by the Microsoft implementation. 579.Fx 580provides a way to override it with your own AML code to work around 581or debug such problems. 582Note that all AML in your DSDT and any SSDT tables is overridden. 583.Pp 584In order to load your AML code, you must edit 585.Pa /boot/loader.conf 586and include the following lines. 587.Bd -literal -offset indent 588acpi_dsdt_load="YES" 589acpi_dsdt_name="/boot/acpi_dsdt.aml" # You may change this name. 590.Ed 591.Pp 592In order to prepare your AML code, you will need the 593.Xr acpidump 8 594and 595.Xr iasl 8 596utilities and some ACPI knowledge. 597.Sh COMPATIBILITY 598ACPI is only found and supported on i386/ia32 and amd64. 599.Sh SEE ALSO 600.Xr kenv 1 , 601.Xr acpi_thermal 4 , 602.Xr device.hints 5 , 603.Xr loader.conf 5 , 604.Xr acpiconf 8 , 605.Xr acpidump 8 , 606.Xr config 8 , 607.Xr iasl 8 608.Rs 609.%A "Compaq Computer Corporation" 610.%A "Intel Corporation" 611.%A "Microsoft Corporation" 612.%A "Phoenix Technologies Ltd." 613.%A "Toshiba Corporation" 614.%D August 25, 2003 615.%T "Advanced Configuration and Power Interface Specification" 616.%U http://acpi.info/spec.htm 617.Re 618.Sh AUTHORS 619.An -nosplit 620The ACPI CA subsystem is developed and maintained by 621Intel Architecture Labs. 622.Pp 623The following people made notable contributions to the ACPI subsystem 624in 625.Fx : 626.An Michael Smith , 627.An Takanori Watanabe Aq Mt takawata@jp.FreeBSD.org , 628.An Mitsuru IWASAKI Aq Mt iwasaki@jp.FreeBSD.org , 629.An Munehiro Matsuda , 630.An Nate Lawson , 631the ACPI-jp mailing list at 632.Aq Mt acpi-jp@jp.FreeBSD.org , 633and many other contributors. 634.Pp 635This manual page was written by 636.An Michael Smith Aq Mt msmith@FreeBSD.org . 637.Sh BUGS 638Many BIOS versions have serious bugs that may cause system instability, 639break suspend/resume, or prevent devices from operating properly due to 640IRQ routing problems. 641Upgrade your BIOS to the latest version available from the vendor before 642deciding it is a problem with 643.Nm . 644