1.\" $NetBSD: acpi.4,v 1.73 2011/10/05 10:10:31 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 October 5, 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 fujbp 4 277Fujitsu brightness and pointer. 278.It Xr fujhk 4 279Fujitsu hotkeys. 280.It Xr hpacel 4 281HP 3D DriveGuard accelerometer. 282.It Xr hpet 4 283High Precision Event Timer 284.Pq Tn HPET . 285.It Xr hpqlb 4 286HP Quick Launch Buttons. 287.It Xr joy 4 288Joystick/Game port interface. 289.It Xr lpt 4 290Standard ISA parallel port interface. 291.It Xr mpu 4 292Roland MPU-401 (compatible) MIDI UART. 293.It Xr pcppi 4 294AT-style speaker sound. 295.It Xr thinkpad 4 296IBM/Lenovo ThinkPad laptop device driver. 297.It Xr ug 4 298Abit uGuru Hardware monitor. 299.It Xr vald 4 300Toshiba Libretto device. 301.It Xr wb 4 302Winbond W83L518D Integrated Media Reader. 303.It Xr wss 4 304Windows Sound System-compatible sound cards 305.It Xr ym 4 306Yamaha OPL3-SA2 and OPL3-SA3 audio device driver. 307.El 308.Ss i386-dependent devices 309.Bl -tag -width "thinkpad(4) " -offset indent -compact 310.It Xr npx 4 311i386 numeric processing extension coprocessor. 312.It Xr pckbc 4 313PC keyboard controllers. 314.It Xr sony 4 315Sony Miscellaneous Controller 316.It Xr spic 4 317Sony programmable I/O controller. 318.El 319.Sh DEBUGGING 320Although the situation has become better over the years, 321.Tn ACPI 322is typically prone to various errors, 323ranging from blatant flaws in the firmware to bugs in the implementation. 324Before anything else, it is a good practice to upgrade the 325.Tn BIOS 326to the latest version available from the vendor. 327.Pp 328To ease the task of diagnosing and fixing different problems, the 329.Tn ACPICA 330reference implementation provides a rich 331facility of different debugging methods. 332In 333.Nx 334these are generally only available if the kernel has been compiled with the 335.Tn ACPI_DEBUG 336option. 337.Ss Verbose messages 338The 339.Tn ACPIVERBOSE 340compile time option enables some verbose 341debug messages printed during the system startup. 342In a 343.Tn MODULAR 344(see 345.Xr options 4 ) 346system, the information can be printed also at runtime, 347regardless of the presence of 348.Tn ACPIVERBOSE . 349To print the messages, 350.Xr modload 8 351the 352.Ic acpiverbose 353module using the option 354.Ar -b dump=true . 355.Ss Custom DSDT 356.Tn ACPI 357interprets bytecode known as 358.Tn ACPI 359Machine Language 360.Pq Tn AML , 361provided by the 362.Tn BIOS 363as a memory image during the system bootstrap. 364Most of the 365.Tn AML 366relevant to 367.Nm 368is implemented in the so-called 369Differentiated System Descriptor Table 370.Pq Tn DSDT . 371.Nx 372provides support for overriding the default 373.Tn DSDT 374supplied by the 375.Tn BIOS . 376.Pp 377The following steps can be used to override the 378.Tn DSDT : 379.Bl -enum -offset indent 380.It 381Dump the raw 382.Tn DSDT 383with 384.Xr acpidump 8 . 385.It 386Disassemble the table with 387.Xr iasl 8 . 388.It 389Modify the disassembled table. 390.It 391Compile the table with 392.Xr iasl 8 393using the option 394.Ar \-tc . 395.It 396Either copy the 397.Pq Pa *.hex 398file to 399.Bd -literal -offset indent 400src/sys/dev/acpi/acpica/Osd/custom_dsdt.hex 401.Ed 402.Pp 403or use the option 404.Bd -literal -offset indent 405ACPI_DSDT_FILE="/some/directory/custom_dsdt.hex" 406.Ed 407.Pp 408in the kernel configuration file. 409.It 410Define 411.Tn ACPI_DSDT_OVERRIDE 412in the kernel configuration file and rebuild. 413.El 414.Ss Debugger 415The 416.Tn ACPICA 417interpreter provides its own debugger for low-level debugging. 418It can be used to display internal data structures and namespace objects, 419and to debug the execution of control methods. 420Single step and breakpoint functionality are available. 421In 422.Nx 423this is integrated to the in-kernel 424.Xr ddb 4 . 425In order to enter the 426.Tn ACPICA 427debugger from 428.Xr ddb 4 , 429use the command 430.Ic call 431with the argument 432.Ic acpi_osd_debugger . 433.Ss Debug Output 434.Nx 435provides three 436.Xr sysctl 8 437variables that control the debug output at runtime. 438The 439.Ic hw.acpi.debug.layer 440variable limits the output to a specific 441.Tn ACPI 442layer and the 443.Ic hw.acpi.debug.level 444variable controls the debug level. 445Both 446.Xr sysctl 8 447variables are string literals. 448The third variable is 449.Ic hw.acpi.debug.object . 450This is a boolean that controls whether debug messages internal to the 451.Tn AML 452are enabled. 453.Pp 454For the first two variables, the possible values are: 455.Bl -column -offset indent \ 456"ACPI_RESOURCE_COMPONENT " "ACPI_RESOURCE_COMPONENT " 457.It Sy LAYER Ta Sy LEVEL 458.It Li ACPI_DEBUG_NONE Ta ACPI_DEBUG_NONE 459.It Ta 460.It Li ACPI_UTILITIES Ta ACPI_LV_INIT 461.It Li ACPI_HARDWARE Ta ACPI_LV_DEBUG_OBJECT 462.It Li ACPI_EVENTS Ta ACPI_LV_INFO 463.It Li ACPI_TABLES Ta ACPI_LV_ALL_EXCEPTIONS * 464.It Li ACPI_NAMESPACE Ta 465.It Li ACPI_PARSER Ta ACPI_LV_INIT_NAMES 466.It Li ACPI_DISPATCHER Ta ACPI_LV_PARSE 467.It Li ACPI_EXECUTER Ta ACPI_LV_LOAD 468.It Li ACPI_RESOURCES Ta ACPI_LV_DISPATCH 469.It Li ACPI_CA_DEBUGGER Ta ACPI_LV_EXEC 470.It Li ACPI_OS_SERVICES Ta ACPI_LV_NAMES 471.It Li ACPI_CA_DISASSEMBLER Ta ACPI_LV_OPREGION 472.It Li ACPI_COMPILER Ta ACPI_LV_BFIELD 473.It Li ACPI_TOOLS Ta ACPI_LV_TABLES 474.It Li ACPI_EXAMPLE Ta ACPI_LV_VALUES 475.It Li ACPI_DRIVER Ta ACPI_LV_OBJECTS 476.It Li ACPI_ALL_COMPONENTS * Ta ACPI_LV_RESOURCES 477.It Ta ACPI_LV_USER_REQUESTS 478.It Li ACPI_BUS_COMPONENT Ta ACPI_LV_PACKAGE 479.It Li ACPI_ACAD_COMPONENT Ta ACPI_LV_VERBOSITY1 * 480.It Li ACPI_BAT_COMPONENT Ta 481.It Li ACPI_BUTTON_COMPONENT Ta ACPI_LV_ALLOCATIONS 482.It Li APCI_EC_COMPONENT Ta ACPI_LV_FUNCTIONS 483.It Li ACPI_LID_COMPONENT Ta ACPI_LV_OPTIMIZATIONS 484.It Li ACPI_RESOURCE_COMPONENT Ta ACPI_LV_VERBOSITY2 * 485.It Li ACPI_TZ_COMPONENT Ta 486.It Li ACPI_DISPLAY_COMPONENT Ta 487.It Li ACPI_ALL_DRIVERS * Ta ACPI_LV_MUTEX 488.It Ta ACPI_LV_THREADS 489.It Ta ACPI_LV_IO 490.It Ta ACPI_LV_AML_INTERRUPTS 491.It Li "* This is a compound" Ta ACPI_LV_VERBOSITY3 * 492.It Li " constant, including" Ta 493.It Li " all previous elements." Ta ACPI_LV_AML_DISASSEMBLE 494.It Ta ACPI_LV_VERBOSE_INFO 495.It Ta ACPI_LV_FULL_TABLES 496.It Ta ACPI_LV_EVENTS 497.It Ta ACPI_LV_VERBOSE * 498.El 499.Pp 500In addition, there is 501.Dv ACPI_DEBUG_DEFAULT 502that is used by 503.Tn ACPICA 504as the default debug level. 505It includes 506.Dv ACPI_LV_INIT 507and 508.Dv ACPI_LV_DEBUG_OBJECT . 509.Pp 510The debug layer can be divided into two groups: 511the first one is specific to the 512.Tn ACPICA 513interpreter and the second one contains the internal 514.Tn ACPI 515components of 516.Nx . 517The constant 518.Dv ACPI_ALL_DRIVERS 519includes all 520.Nx 521specific parts. 522.Pp 523The 524.Tn ACPICA 525interpreter uses several debug levels internally, 526but the 527.Nx 528specific parts are typically limited to 529.Dv ACPI_LV_DEBUG_OBJECT 530and 531.Dv ACPI_LV_INFO . 532The debug output can be stopped by setting 533.Ic hw.acpi.debug.level 534to 535.Dv ACPI_DEBUG_NONE . 536.Ss Example 537As an example, a driver may have defined the component it belongs to and 538the name of the module: 539.Bd -literal -offset indent 540#define _COMPONENT ACPI_BUS_COMPONENT 541ACPI_MODULE_NAME ("acpi_example") 542.Ed 543.Pp 544The driver may also utilize the debug facility: 545.Bd -literal -offset indent 546ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Failed to evaluate _STA\\n")); 547.Ed 548.Pp 549With these options the debug message from the 550.Dv ACPI_DEBUG_PRINT 551macro is only visible when 552.Ic hw.acpi.debug.layer 553is either 554.Dv ACPI_BUS_COMPONENT 555or a compound constant including it, and 556.Ic hw.acpi.debug.level 557is 558.Dv ACPI_LV_INFO 559or some constant that includes it. 560Finally, it can be noted that the 561.Tn ACPI 562implementation uses the prefix 563.Dv ACPI_DB , 564whereas the debug level 565.Xr sysctl 8 566variable is always specified with the prefix 567.Dv ACPI_LV . 568.Pp 569Another example can be mentioned for the use of 570.Ic hw.acpi.debug.object . 571The following could appear in an 572.Tn ASL 573code: 574.Bd -literal -offset indent 575Method(_Q19, 0, NotSerialized) 576{ 577 Store("_Q19 invoked", Debug) 578 Notify(ACAD, 0x80) 579} 580.Ed 581.Pp 582When 583.Ic hw.acpi.debug.object 584is set to 1, the message stored to the debug object 585is printed every time the method is called by the interpreter. 586.Sh SEE ALSO 587.Xr ioapic 4 , 588.Xr acpidump 8 , 589.Xr amldb 8 , 590.Xr iasl 8 591.Rs 592.%A Hewlett-Packard Corporation 593.%A Intel Corporation 594.%A Microsoft Corporation 595.%A Phoenix Technologies Ltd. 596.%A Toshiba Corporation 597.%T Advanced Configuration and Power Interface Specification 598.%N Revision 4.0 599.%D June 16, 2009 600.%U http://www.acpi.info/spec.htm 601.Re 602.Rs 603.%A Intel Corporation 604.%T ACPI Component Architecture, 605.%T Programmer Reference, 606.%T OS-Independent Subsystem, Debugger, and Utilities 607.%N Revision 1.27 608.%D January 20, 2010 609.%U http://www.acpica.org/download/acpica-reference.pdf 610.Re 611.Rs 612.%A Len Brown 613.%T ACPI in Linux - Myths vs. Reality 614.%D June 27-30, 2007 615.%O Proceedings of the Linux Symposium 616.%P 65-74 617.%U http://www.linuxsymposium.org/archives/OLS/Reprints-2007/brown_1-Reprint.pdf 618.Re 619.Rs 620.%A Joerg Sonnenberger 621.%A Jared D. McNeill 622.%T Sleeping Beauty - NetBSD on Modern Laptops 623.%D February 3, 2008 624.%O Proceedings of AsiaBSDCon 2008 625.%P 127-134 626.%U http://2008.asiabsdcon.org/papers/P9A-paper.pdf 627.Re 628.Rs 629.%A Takanori Watanabe 630.%T ACPI Implementation on FreeBSD 631.%I USENIX Association 632.%B Proceedings of the FREENIX Track: 2002 USENIX Annual Technical Conference 633.%P 121-131 634.%D June 10-15, 2002 635.%U http://www.usenix.org/event/usenix02/tech/freenix/full_papers/watanabe/watanabe.pdf 636.Re 637.Sh HISTORY 638The 639.Nm 640driver 641appeared in 642.Nx 1.6 . 643.Sh AUTHORS 644.An -nosplit 645Authors of the 646.Nm 647subsystem include 648.An Charles M. Hannum , 649.An Frank van der Linden , 650.An Jared D. McNeill , 651.An Jason R. Thorpe , 652.An Joerg Sonnenberger , 653and 654.An Jukka Ruohonen , 655among others. 656.Sh BUGS 657Most of the 658.Tn ACPI 659power management functionalities are not implemented. 660