1.\" $NetBSD: acpi.4,v 1.71 2011/07/13 12:22:36 jruoho Exp $ 2.\" 3.\" Copyright (c) 2002, 2004, 2010 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd July 13, 2011 28.Dt ACPI 4 29.Os 30.Sh NAME 31.Nm acpi 32.Nd Advanced Configuration and Power Interface 33.Sh SYNOPSIS 34.Cd acpi0 at mainbus0 35.Pp 36.Cd options ACPI_DEBUG 37.Cd options ACPIVERBOSE 38.Cd options ACPI_ACTIVATE_DEV 39.Cd options ACPI_DSDT_OVERRIDE 40.Cd options ACPI_DSDT_FILE="" 41.Cd options ACPI_BLACKLIST_YEAR=2000 42.Sh DESCRIPTION 43.Nx 44provides machine-independent bus support for 45Advanced Configuration and Power Interface 46.Pq Tn ACPI 47devices and includes several 48.Tn ACPI 49device drivers. 50.Pp 51The 52.Nx 53implementation of 54.Tn ACPI 55integrates Intel's ACPI Component Architecture 56.Pq Tn ACPI-CA 57for the OS-independent part. 58The 59.Tn ACPI-CA 60provides OS-neutral 61.Tn ACPI 62functionalities such as 63.Tn ACPI 64.Tn BIOS 65table support, 66an 67.Tn ACPI 68event framework and an ACPI Machine Language 69.Pq Tn AML 70interpreter. 71.Pp 72Options: 73.Bl -tag -width ACPI_DSDT_FILE__filename_XX -offset 3n 74.It Dv ACPI_DEBUG 75Enable various debug facilities. 76.It Dv ACPIVERBOSE 77Enable verbose debug messages. 78.It Dv ACPI_ACTIVATE_DEV 79Determine if the 80.Tn ACPI 81driver should attempt to activate inactive devices. 82The default is off. 83.It Dv ACPI_DSDT_OVERRIDE 84Force a given Differentiated System Description Table 85.Pq Tn DSDT 86instead of the version supplied by the 87.Tn BIOS . 88Use 89.Dv ACPI_DSDT_FILE 90to specify a 91.Tn DSDT . 92.It Dv ACPI_DSDT_FILE="filename" 93If 94.Dv ACPI_DSDT_FILE 95is not specified, default to 96.Dq dsdt.hex 97in the build directory. 98.It Dv ACPI_BLACKLIST_YEAR=2000 99Do not use ACPI with any BIOS made on or before the specified year. 100.El 101.Sh SYSCTL SUPPORT 102Few 103.Xr sysctl 8 104variables are directly relevant for 105.Tn ACPI . 106.Bl -tag -width "123456" -offset indent 107.It Ic hw.acpi.root 108The address of the 109.Tn ACPI 110root pointer in system memory. 111.It Ic hw.acpi.sleep.state 112The system sleep state. 113.It Ic hw.acpi.sleep.states 114A list of system sleep states that the machine supports. 115The possible values are: 116.Pp 117.Bl -tag -width XS1X -offset indent -compact 118.It S0 119fully running 120.It S1 121power on suspend (CPU and hard disks are off) 122.It S2 123similar to S3, usually not implemented 124.It S3 125suspend-to-RAM 126.It S4 127suspend-to-disk (not supported on 128.Nx ) 129.It S5 130power off 131.El 132.It Ic hw.acpi.sleep.beep 133A boolean variable that controls whether the 134.Tn PC 135speaker beeps upon resume. 136.It Ic hw.acpi.sleep.vbios 137Defines the handling of the graphics card. 138The supported values are: 139.Bl -tag -width '2' -offset 2n 140.It 0 141No attempt to reset the 142.Tn VGA 143controller will be made. 144.It 1 145Call the 146.Tn VGA 147.Tn BIOS 148when still in real mode. 149This can result in direct reboots. 150In that case, use 151.Sq 2 152or 153.Ic vbetool post 154from the 155.Pa pkgsrc/sysutils/vbetool 156package. 157.It 2 158Call the 159.Tn VGA 160.Tn BIOS 161using the in-kernel x86 emulator. 162.El 163.Pp 164If the system has problems in resuming from the 165.Tn S3 166state, experimenting with different values may provide a solution. 167.It Ic hw.acpi.stat.gpe 168The number of dispatched General Purpose Events 169.Pq Tn GPEs . 170.It Ic hw.acpi.stat.sci 171The number of System Control Interrupts 172.Pq Tn SCIs . 173See 174.Xr acpiec 4 175for a brief description of both 176.Tn GPEs 177and 178.Tn SCIs . 179.It Ic hw.acpi.stat.fixed 180The number of 181.Dq fixed events . 182.It Ic hw.acpi.stat.method 183The number of 184.Tn ACPI 185methods executed by the interpreter. 186.It Ic hw.acpi.power 187This read-only node describes the 188.Tn ACPI 189power state of devices. 190The values range from 191.Tn D0 192.Pq Dq on 193to 194.Tn D3 195.Pq Dq off . 196.It Ic hw.acpi.wake 197This node represents devices that can wake the system from the 198.Tn S3 199or 200.Tn S4 201sleep state. 202By default, 203.Xr acpibut 4 , 204.Xr acpilid 4 , 205and 206.Xr pckbd 4 207are allowed to wake the system, provided that the devices are present and 208the firmware supports wake-up capabilities for the devices. 209.El 210.Sh SUPPORTED DEVICES 211.Nx 212.Tn ACPI 213supports several machine-dependent and machine-independent devices, 214some specific to 215.Tn ACPI 216and some configured via it. 217.Ss Machine-independent devices 218.Bl -tag -width "thinkpad(4) " -offset indent -compact 219.It Xr acpiacad 4 220.Tn ACPI 221AC adapters. 222.It Xr acpibat 4 223.Tn ACPI 224batteries. 225.It Xr acpibut 4 226.Tn ACPI 227power and sleep buttons. 228.It Xr acpicpu 4 229.Tn ACPI 230processors. 231.It Xr acpidalb 4 232.Tn ACPI 233direction application launch buttons. 234.It Xr acpiec 4 235.Tn ACPI 236embedded controllers. 237.It Xr acpiecdt 4 238.Tn ACPI 239Embedded Controller Boot Resource Table 240.Pq Tn ECDT . 241.It Xr acpifan 4 242.Tn ACPI 243fans. 244.It Xr acpilid 4 245.Tn ACPI 246lid switches. 247.It Xr acpipmtr 4 248.Tn ACPI 249power meters. 250.It Xr acpismbus 4 251.Tn ACPI 252SMBus via control method interface 253.Pq Tn CMI . 254.It Xr acpitz 4 255.Tn ACPI 256thermal zones. 257.It Xr acpivga 4 258.Tn ACPI 259display adapter and output devices. 260.It Xr acpiwmi 4 261.Tn ACPI 262support for Windows Management Instrumentation. 263.It Xr acpiwdrt 4 264.Tn ACPI 265watchdogs. 266.It Xr aibs 4 267ASUSTeK voltage, temperature and fan sensors. 268.It asus 269ASUS laptop hotkeys. 270.It Xr attimer 4 271AT Timer. 272.It Xr com 4 273NS8250-, NS16450-, and NS16550-based serial ports. 274.It Xr fdc 4 275Floppy disk controllers. 276.It Xr fujitsu 4 277Fujitsu brightness, pointer, and hotkeys. 278.It Xr hpacel 4 279HP 3D DriveGuard accelerometer. 280.It Xr hpet 4 281High Precision Event Timer 282.Pq Tn HPET . 283.It Xr hpqlb 4 284HP Quick Launch Buttons. 285.It Xr joy 4 286Joystick/Game port interface. 287.It Xr lpt 4 288Standard ISA parallel port interface. 289.It Xr mpu 4 290Roland MPU-401 (compatible) MIDI UART. 291.It Xr pcppi 4 292AT-style speaker sound. 293.It Xr thinkpad 4 294IBM/Lenovo ThinkPad laptop device driver. 295.It Xr ug 4 296Abit uGuru Hardware monitor. 297.It Xr vald 4 298Toshiba Libretto device. 299.It Xr wb 4 300Winbond W83L518D Integrated Media Reader. 301.It Xr wss 4 302Windows Sound System-compatible sound cards 303.It Xr ym 4 304Yamaha OPL3-SA2 and OPL3-SA3 audio device driver. 305.El 306.Ss i386-dependent devices 307.Bl -tag -width "thinkpad(4) " -offset indent -compact 308.It Xr npx 4 309i386 numeric processing extension coprocessor. 310.It Xr pckbc 4 311PC keyboard controllers. 312.It Xr sony 4 313Sony Miscellaneous Controller 314.It Xr spic 4 315Sony programmable I/O controller. 316.El 317.Sh DEBUGGING 318Although the situation has become better over the years, 319.Tn ACPI 320is typically prone to various errors, 321ranging from blatant flaws in the firmware to bugs in the implementation. 322Before anything else, it is a good practice to upgrade the 323.Tn BIOS 324to the latest version available from the vendor. 325.Pp 326To ease the task of diagnosing and fixing different problems, the 327.Tn ACPICA 328reference implementation provides a rich 329facility of different debugging methods. 330In 331.Nx 332these are generally only available if the kernel has been compiled with the 333.Tn ACPI_DEBUG 334option. 335.Ss Verbose messages 336The 337.Tn ACPIVERBOSE 338compile time option enables some verbose 339debug messages printed during the system startup. 340In a 341.Tn MODULAR 342(see 343.Xr options 4 ) 344system, the information can be printed also at runtime, 345regardless of the presence of 346.Tn ACPIVERBOSE . 347To print the messages, 348.Xr modload 8 349the 350.Ic acpiverbose 351module using the option 352.Ar -b dump=true . 353.Ss Custom DSDT 354.Tn ACPI 355interprets bytecode known as 356.Tn ACPI 357Machine Language 358.Pq Tn AML , 359provided by the 360.Tn BIOS 361as a memory image during the system bootstrap. 362Most of the 363.Tn AML 364relevant to 365.Nm 366is implemented in the so-called 367Differentiated System Descriptor Table 368.Pq Tn DSDT . 369.Nx 370provides support for overriding the default 371.Tn DSDT 372supplied by the 373.Tn BIOS . 374.Pp 375The following steps can be used to override the 376.Tn DSDT : 377.Bl -enum -offset indent 378.It 379Dump the raw 380.Tn DSDT 381with 382.Xr acpidump 8 . 383.It 384Disassemble the table with 385.Xr iasl 8 . 386.It 387Modify the disassembled table. 388.It 389Compile the table with 390.Xr iasl 8 391using the option 392.Ar \-tc . 393.It 394Either copy the 395.Pq Pa *.hex 396file to 397.Bd -literal -offset indent 398src/sys/dev/acpi/acpica/Osd/custom_dsdt.hex 399.Ed 400.Pp 401or use the option 402.Bd -literal -offset indent 403ACPI_DSDT_FILE="/some/directory/custom_dsdt.hex" 404.Ed 405.Pp 406in the kernel configuration file. 407.It 408Define 409.Tn ACPI_DSDT_OVERRIDE 410in the kernel configuration file and rebuild. 411.El 412.Ss Debugger 413The 414.Tn ACPICA 415interpreter provides its own debugger for low-level debugging. 416It can be used to display internal data structures and namespace objects, 417and to debug the execution of control methods. 418Single step and breakpoint functionality are available. 419In 420.Nx 421this is integrated to the in-kernel 422.Xr ddb 4 . 423In order to enter the 424.Tn ACPICA 425debugger from 426.Xr ddb 4 , 427use the command 428.Ic call 429with the argument 430.Ic acpi_osd_debugger . 431.Ss Debug Output 432.Nx 433provides three 434.Xr sysctl 8 435variables that control the debug output at runtime. 436The 437.Ic hw.acpi.debug.layer 438variable limits the output to a specific 439.Tn ACPI 440layer and the 441.Ic hw.acpi.debug.level 442variable controls the debug level. 443Both 444.Xr sysctl 8 445variables are string literals. 446The third variable is 447.Ic hw.acpi.debug.object . 448This is a boolean that controls whether debug messages internal to the 449.Tn AML 450are enabled. 451.Pp 452For the first two variables, the possible values are: 453.Bl -column -offset indent \ 454"ACPI_RESOURCE_COMPONENT " "ACPI_RESOURCE_COMPONENT " 455.It Sy LAYER Ta Sy LEVEL 456.It Li ACPI_DEBUG_NONE Ta ACPI_DEBUG_NONE 457.It Ta 458.It Li ACPI_UTILITIES Ta ACPI_LV_INIT 459.It Li ACPI_HARDWARE Ta ACPI_LV_DEBUG_OBJECT 460.It Li ACPI_EVENTS Ta ACPI_LV_INFO 461.It Li ACPI_TABLES Ta ACPI_LV_ALL_EXCEPTIONS * 462.It Li ACPI_NAMESPACE Ta 463.It Li ACPI_PARSER Ta ACPI_LV_INIT_NAMES 464.It Li ACPI_DISPATCHER Ta ACPI_LV_PARSE 465.It Li ACPI_EXECUTER Ta ACPI_LV_LOAD 466.It Li ACPI_RESOURCES Ta ACPI_LV_DISPATCH 467.It Li ACPI_CA_DEBUGGER Ta ACPI_LV_EXEC 468.It Li ACPI_OS_SERVICES Ta ACPI_LV_NAMES 469.It Li ACPI_CA_DISASSEMBLER Ta ACPI_LV_OPREGION 470.It Li ACPI_COMPILER Ta ACPI_LV_BFIELD 471.It Li ACPI_TOOLS Ta ACPI_LV_TABLES 472.It Li ACPI_EXAMPLE Ta ACPI_LV_VALUES 473.It Li ACPI_DRIVER Ta ACPI_LV_OBJECTS 474.It Li ACPI_ALL_COMPONENTS * Ta ACPI_LV_RESOURCES 475.It Ta ACPI_LV_USER_REQUESTS 476.It Li ACPI_BUS_COMPONENT Ta ACPI_LV_PACKAGE 477.It Li ACPI_ACAD_COMPONENT Ta ACPI_LV_VERBOSITY1 * 478.It Li ACPI_BAT_COMPONENT Ta 479.It Li ACPI_BUTTON_COMPONENT Ta ACPI_LV_ALLOCATIONS 480.It Li APCI_EC_COMPONENT Ta ACPI_LV_FUNCTIONS 481.It Li ACPI_LID_COMPONENT Ta ACPI_LV_OPTIMIZATIONS 482.It Li ACPI_RESOURCE_COMPONENT Ta ACPI_LV_VERBOSITY2 * 483.It Li ACPI_TZ_COMPONENT Ta 484.It Li ACPI_DISPLAY_COMPONENT Ta 485.It Li ACPI_ALL_DRIVERS * Ta ACPI_LV_MUTEX 486.It Ta ACPI_LV_THREADS 487.It Ta ACPI_LV_IO 488.It Ta ACPI_LV_AML_INTERRUPTS 489.It Li "* This is a compound" Ta ACPI_LV_VERBOSITY3 * 490.It Li " constant, including" Ta 491.It Li " all previous elements." Ta ACPI_LV_AML_DISASSEMBLE 492.It Ta ACPI_LV_VERBOSE_INFO 493.It Ta ACPI_LV_FULL_TABLES 494.It Ta ACPI_LV_EVENTS 495.It Ta ACPI_LV_VERBOSE * 496.El 497.Pp 498In addition, there is 499.Dv ACPI_DEBUG_DEFAULT 500that is used by 501.Tn ACPICA 502as the default debug level. 503It includes 504.Dv ACPI_LV_INIT 505and 506.Dv ACPI_LV_DEBUG_OBJECT . 507.Pp 508The debug layer can be divided into two groups: 509the first one is specific to the 510.Tn ACPICA 511interpreter and the second one contains the internal 512.Tn ACPI 513components of 514.Nx . 515The constant 516.Dv ACPI_ALL_DRIVERS 517includes all 518.Nx 519specific parts. 520.Pp 521The 522.Tn ACPICA 523interpreter uses several debug levels internally, 524but the 525.Nx 526specific parts are typically limited to 527.Dv ACPI_LV_DEBUG_OBJECT 528and 529.Dv ACPI_LV_INFO . 530The debug output can be stopped by setting 531.Ic hw.acpi.debug.level 532to 533.Dv ACPI_DEBUG_NONE . 534.Ss Example 535As an example, a driver may have defined the component it belongs to and 536the name of the module: 537.Bd -literal -offset indent 538#define _COMPONENT ACPI_BUS_COMPONENT 539ACPI_MODULE_NAME ("acpi_example") 540.Ed 541.Pp 542The driver may also utilize the debug facility: 543.Bd -literal -offset indent 544ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Failed to evaluate _STA\\n")); 545.Ed 546.Pp 547With these options the debug message from the 548.Dv ACPI_DEBUG_PRINT 549macro is only visible when 550.Ic hw.acpi.debug.layer 551is either 552.Dv ACPI_BUS_COMPONENT 553or a compound constant including it, and 554.Ic hw.acpi.debug.level 555is 556.Dv ACPI_LV_INFO 557or some constant that includes it. 558Finally, it can be noted that the 559.Tn ACPI 560implementation uses the prefix 561.Dv ACPI_DB , 562whereas the debug level 563.Xr sysctl 8 564variable is always specified with the prefix 565.Dv ACPI_LV . 566.Pp 567Another example can be mentioned for the use of 568.Ic hw.acpi.debug.object . 569The following could appear in an 570.Tn ASL 571code: 572.Bd -literal -offset indent 573Method(_Q19, 0, NotSerialized) 574{ 575 Store("_Q19 invoked", Debug) 576 Notify(ACAD, 0x80) 577} 578.Ed 579.Pp 580When 581.Ic hw.acpi.debug.object 582is set to 1, the message stored to the debug object 583is printed every time the method is called by the interpreter. 584.Sh SEE ALSO 585.Xr ioapic 4 , 586.Xr acpidump 8 , 587.Xr amldb 8 , 588.Xr iasl 8 589.Rs 590.%A Hewlett-Packard Corporation 591.%A Intel Corporation 592.%A Microsoft Corporation 593.%A Phoenix Technologies Ltd. 594.%A Toshiba Corporation 595.%T Advanced Configuration and Power Interface Specification 596.%N Revision 4.0 597.%D June 16, 2009 598.%U http://www.acpi.info/spec.htm 599.Re 600.Rs 601.%A Intel Corporation 602.%T ACPI Component Architecture, 603.%T Programmer Reference, 604.%T OS-Independent Subsystem, Debugger, and Utilities 605.%N Revision 1.27 606.%D January 20, 2010 607.%U http://www.acpica.org/download/acpica-reference.pdf 608.Re 609.Rs 610.%A Len Brown 611.%T ACPI in Linux - Myths vs. Reality 612.%D June 27-30, 2007 613.%O Proceedings of the Linux Symposium 614.%P 65-74 615.%U http://www.linuxsymposium.org/archives/OLS/Reprints-2007/brown_1-Reprint.pdf 616.Re 617.Rs 618.%A Joerg Sonnenberger 619.%A Jared D. McNeill 620.%T Sleeping Beauty - NetBSD on Modern Laptops 621.%D February 3, 2008 622.%O Proceedings of AsiaBSDCon 2008 623.%P 127-134 624.%U http://2008.asiabsdcon.org/papers/P9A-paper.pdf 625.Re 626.Sh HISTORY 627The 628.Nm 629driver 630appeared in 631.Nx 1.6 . 632.Sh AUTHORS 633.An -nosplit 634Authors of the 635.Nm 636subsystem include 637.An Charles M. Hannum , 638.An Frank van der Linden , 639.An Jared D. McNeill , 640.An Jason R. Thorpe , 641.An Joerg Sonnenberger , 642and 643.An Jukka Ruohonen , 644among others. 645.Sh BUGS 646Most of the 647.Tn ACPI 648power management functionalities are not implemented. 649