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