1.\" $NetBSD: acpi.4,v 1.50 2010/04/25 17:50:13 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 April 25, 2010 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.Sh DESCRIPTION 41.Nx 42provides machine-independent bus support for 43Advanced Configuration and Power Interface 44.Pq Tn ACPI 45devices and includes several 46.Tn ACPI 47device drivers. 48.Pp 49The 50.Nx 51implementation of 52.Tn ACPI 53integrates Intel's ACPI Component Architecture 54.Pq Tn ACPI-CA 55for the OS-independent part. 56The 57.Tn ACPI-CA 58provides OS-neutral 59.Tn ACPI 60functionalities such as 61.Tn ACPI 62.Tn BIOS 63table support, 64an 65.Tn ACPI 66event framework and an ACPI Machine Language 67.Pq Tn AML 68interpreter. 69.Pp 70Options: 71.Bl -tag -width ACPI_DSDT_FILE__filename_XX -offset 3n 72.It Dv ACPI_DEBUG 73Enable 74.Tn ACPI 75debugging message outputs. 76.It Dv ACPI_ACTIVATE_DEV 77Determine if the 78.Tn ACPI 79driver should attempt to activate inactive devices. 80The default is off. 81.It Dv ACPI_DSDT_OVERRIDE 82Force a given Differentiated System Description Table 83.Pq Tn DSDT 84instead of the version supplied by the 85.Tn BIOS . 86Use 87.Dv ACPI_DSDT_FILE 88to specify a 89.Tn DSDT . 90.It Dv ACPI_DSDT_FILE="filename" 91If 92.Dv ACPI_DSDT_FILE 93is not specified, default to 94.Dq dsdt.hex 95in the build directory. 96.El 97.Sh SYSCTL SUPPORT 98Few 99.Xr sysctl 8 100variables are directly relevant for 101.Tn ACPI . 102.Bl -tag -width "123456" -offset indent 103.It Ic hw.acpi.root 104The 105.Tn ACPI 106root pointer. 107.It Ic hw.acpi.supported_states 108A list of the 109.Tn ACPI 110sleep states that the machine supports. 111The possible values are: 112.Pp 113.Bl -tag -width XS1X -offset indent -compact 114.It S0 115fully running 116.It S1 117power on suspend (CPU and hard disks are off) 118.It S2 119similar to S3, usually not implemented 120.It S3 121suspend-to-RAM 122.It S4 123suspend-to-disk (not supported on 124.Nx ) 125.It S5 126power off 127.El 128.It Ic hw.acpi.stat.gpe 129The number of dispatched General Purpose Events 130.Pq Tn GPEs . 131.It Ic hw.acpi.stat.sci 132The number of System Control Interrupts 133.Pq Tn SCIs . 134See 135.Xr acpiec 4 136for a brief description of both 137.Tn GPEs 138and 139.Tn SCIs . 140.It Ic hw.acpi.stat.fixed 141The number of 142.Dq fixed events . 143.It Ic hw.acpi.stat.method 144The number of 145.Tn ACPI 146methods executed by the interpreter. 147.It Ic machdep.acpi_beep_on_reset 148A boolean variable that controls whether the 149.Tn PC 150speaker beeps upon resume. 151.It Ic machdep.acpi_vbios_reset 152Defines the handling of the graphics card. 153The supported values are: 154.Bl -tag -width '2' -offset indent 155.It 0 156No attempt to reset the 157.Tn VGA 158controller will be made. 159.It 1 160Call the 161.Tn VGA 162.Tn BIOS 163when still in real mode. 164This can result in direct reboots. 165In that case, use 166.Sq 2 167or 168.Ic vbetool post 169from the 170.Pa pkgsrc/sysutils/vbetool 171package. 172.It 2 173Call the 174.Tn VGA 175.Tn BIOS 176using the in-kernel x86 emulator. 177.El 178.El 179.Sh SUPPORTED DEVICES 180.Nx 181.Tn ACPI 182supports several machine-dependent and machine-independent devices: 183.Ss Machine-independent devices 184.Bl -tag -width pcdisplay -offset indent -compact 185.It acpiacad 186.Tn ACPI 187AC adapters. 188.It acpibat 189.Tn ACPI 190Control Method Batteries. 191.It acpibut 192.Tn ACPI 193power and sleep buttons. 194.It acpidalb 195.Tn ACPI 196Direction Application Launch Buttons. 197.It acpiec 198.Tn ACPI 199Embedded Controllers. 200.It acpiecdt 201.Tn ACPI 202Embedded Controller Boot Resource Table. 203.It acpilid 204.Tn ACPI 205lid switches. 206.It acpismbus 207.Tn ACPI 208SMBus via Control Method Interface. 209.It acpitz 210.Tn ACPI 211thermal zones. 212.It acpiwmi 213.Tn ACPI 214support for Windows Management Instrumentation. 215.It aibs 216ASUSTeK AI Booster ACPI ATK0110 voltage, temperature and fan sensor. 217.It asus 218ASUS laptop hotkeys. 219.It attimer 220AT Timer. 221.It com 222NS8250-, NS16450-, and NS16550-based serial ports. 223.It fdc 224Floppy disk controllers. 225.It hpet 226High Precision Event Timer. 227.It hpqlb 228HP Quick Launch Buttons. 229.It joy 230Joystick/Game port interface. 231.It lpt 232Standard ISA parallel port interface. 233.It mpu 234Roland MPU-401 (compatible) MIDI UART. 235.It pcppi 236AT-style speaker sound. 237.It thinkpad 238IBM/Lenovo ThinkPad laptop device driver. 239.It ug 240Abit uGuru Hardware monitor. 241.It vald 242Toshiba Libretto device. 243.It wb 244Winbond W83L518D Integrated Media Reader. 245.It wss 246Windows Sound System-compatible sound cards based on the AD1848 and compatible chips. 247.It ym 248Yamaha OPL3-SA2 and OPL3-SA3 audio device driver. 249.El 250.Ss i386-dependent devices 251.Bl -tag -width pcdisplay -offset indent -compact 252.It npx 253i386 numeric processing extension coprocessor. 254.It pckbc 255PC keyboard controllers. 256.It sony 257Sony Miscellaneous Controller 258.It spic 259Sony programmable I/O controller. 260.El 261.Sh DEBUGGING 262Although the situation has become better over the years, 263.Tn ACPI 264is typically prone to various errors, 265ranging from blatant flaws in the firmware to bugs in the implementation. 266Before anything else, it is a good practice to upgrade the 267.Tn BIOS 268to the latest version available from the vendor. 269.Pp 270To ease the task of diagnosing and fixing different problems, the 271.Tn ACPICA 272reference implementation provides a rich 273facility of different debugging methods. 274In 275.Nx 276these are generally only available if the kernel has been compiled with the 277.Tn ACPI_DEBUG 278option. 279.Ss CUSTOM DSDT 280.Tn ACPI 281interprets bytecode known as 282.Tn ACPI 283Machine Language 284.Pq Tn AML , 285provided by the 286.Tn BIOS 287as a memory image during the system bootstrap. 288Most of the 289.Tn AML 290relevant to 291.Nm 292is implemented in the so-called 293Differentiated System Descriptor Table 294.Pq Tn DSDT . 295.Nx 296provides support for overriding the default 297.Tn DSDT 298supplied by the 299.Tn BIOS . 300.Pp 301The following steps can be used to override the 302.Tn DSDT : 303.Bl -enum -offset indent 304.It 305Dump the raw 306.Tn DSDT 307with 308.Xr acpidump 8 . 309.It 310Disassemble the table with 311.Xr iasl 8 . 312.It 313Modify the disassembled table. 314.It 315Compile the table with 316.Xr iasl 8 317using the option 318.Ar \-tc . 319.It 320Either copy the 321.Pq Pa *.hex 322file to 323.Bd -literal -offset indent 324src/sys/dev/acpi/acpica/Osd/custom_dsdt.hex 325.Ed 326.Pp 327or use the option 328.Bd -literal -offset indent 329ACPI_DSDT_FILE="/some/directory/custom_dsdt.hex" 330.Ed 331.Pp 332in the kernel configuration file. 333.It 334Define 335.Tn ACPI_DSDT_OVERRIDE 336in the kernel configuration file and rebuild. 337.El 338.Ss DEBUGGER 339The 340.Tn ACPICA 341interpreter provides its own debugger for low-level debugging. 342It can be used to display internal data structures and namespace objects, 343and to debug the execution of control methods. 344Single step and breakpoint functionality are available. 345In 346.Nx 347this is integrated to the in-kernel 348.Xr ddb 4 . 349In order to enter the 350.Tn ACPICA 351debugger from 352.Xr ddb 4 , 353use the command 354.Ic call 355with the argument 356.Ic acpi_osd_debugger . 357.Ss DEBUG OUTPUT 358.Nx 359provides two 360.Xr sysctl 8 361variables that control the debug output at runtime. 362The 363.Ic hw.acpi.debug.layer 364limits the output to a specific 365.Tn ACPI 366layer and the 367.Ic hw.acpi.debug.level 368controls the debug level. 369Both 370.Xr sysctl 8 371variables are string literals. 372.Pp 373The possible values are: 374.Bl -column -offset indent \ 375"ACPI_RESOURCE_COMPONENT " "ACPI_RESOURCE_COMPONENT " 376.It Sy LAYER Ta Sy LEVEL 377.It Li ACPI_DEBUG_NONE Ta ACPI_DEBUG_NONE 378.It Ta 379.It Li ACPI_UTILITIES Ta ACPI_LV_INIT 380.It Li ACPI_HARDWARE Ta ACPI_LV_DEBUG_OBJECT 381.It Li ACPI_EVENTS Ta ACPI_LV_INFO 382.It Li ACPI_TABLES Ta ACPI_LV_ALL_EXCEPTIONS * 383.It Li ACPI_NAMESPACE Ta 384.It Li ACPI_PARSER Ta ACPI_LV_INIT_NAMES 385.It Li ACPI_DISPATCHER Ta ACPI_LV_PARSE 386.It Li ACPI_EXECUTER Ta ACPI_LV_LOAD 387.It Li ACPI_RESOURCES Ta ACPI_LV_DISPATCH 388.It Li ACPI_CA_DEBUGGER Ta ACPI_LV_EXEC 389.It Li ACPI_OS_SERVICES Ta ACPI_LV_NAMES 390.It Li ACPI_CA_DISASSEMBLER Ta ACPI_LV_OPREGION 391.It Li ACPI_COMPILER Ta ACPI_LV_BFIELD 392.It Li ACPI_TOOLS Ta ACPI_LV_TABLES 393.It Li ACPI_EXAMPLE Ta ACPI_LV_VALUES 394.It Li ACPI_DRIVER Ta ACPI_LV_OBJECTS 395.It Li ACPI_ALL_COMPONENTS * Ta ACPI_LV_RESOURCES 396.It Ta ACPI_LV_USER_REQUESTS 397.It Li ACPI_BUS_COMPONENT Ta ACPI_LV_PACKAGE 398.It Li ACPI_ACAD_COMPONENT Ta ACPI_LV_VERBOSITY1 * 399.It Li ACPI_BAT_COMPONENT Ta 400.It Li ACPI_BUTTON_COMPONENT Ta ACPI_LV_ALLOCATIONS 401.It Li APCI_EC_COMPONENT Ta ACPI_LV_FUNCTIONS 402.It Li ACPI_LID_COMPONENT Ta ACPI_LV_OPTIMIZATIONS 403.It Li ACPI_RESOURCE_COMPONENT Ta ACPI_LV_VERBOSITY2 * 404.It Li ACPI_TZ_COMPONENT Ta 405.It Li ACPI_ALL_DRIVERS * Ta ACPI_LV_MUTEX 406.It Ta ACPI_LV_THREADS 407.It Ta ACPI_LV_IO 408.It Ta ACPI_LV_AML_INTERRUPTS 409.It Li "* This is a compound" Ta ACPI_LV_VERBOSITY3 * 410.It Li " constant, including" Ta 411.It Li " all previous elements." Ta ACPI_LV_AML_DISASSEMBLE 412.It Ta ACPI_LV_VERBOSE_INFO 413.It Ta ACPI_LV_FULL_TABLES 414.It Ta ACPI_LV_EVENTS 415.It Ta ACPI_LV_VERBOSE * 416.El 417.Pp 418In addition, there is 419.Dv ACPI_DEBUG_DEFAULT 420that is used by 421.Tn ACPICA 422as the default debug level. 423It includes 424.Dv ACPI_LV_INIT 425and 426.Dv ACPI_LV_DEBUG_OBJECT . 427.Pp 428The debug layer can be divided into two groups: 429the first one is specific to the 430.Tn ACPICA 431interpreter and the second one contains the internal 432.Tn ACPI 433components of 434.Nx . 435The constant 436.Dv ACPI_ALL_DRIVERS 437includes all 438.Nx 439specific parts. 440.Pp 441The 442.Tn ACPICA 443interpreter uses several debug levels internally, 444but the 445.Nx 446specific parts are typically limited to 447.Dv ACPI_LV_DEBUG_OBJECT 448and 449.Dv ACPI_LV_DEBUG_INFO . 450The debug output can be stopped by setting 451.Ic hw.acpi.debug.level 452to 453.Dv ACPI_DEBUG_NONE . 454.Ss EXAMPLE 455As an example, a driver may have defined the component it belongs to and 456the name of the module: 457.Bd -literal -offset indent 458#define _COMPONENT ACPI_BUS_COMPONENT 459ACPI_MODULE_NAME ("acpi_example") 460.Ed 461.Pp 462The driver may also utilize the debug facility: 463.Bd -literal -offset indent 464ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Failed to evaluate _STA\\n")); 465.Ed 466.Pp 467With these options the debug message from the 468.Dv ACPI_DEBUG_PRINT 469macro is only visible when 470.Ic hw.acpi.debug.layer 471is either 472.Dv ACPI_BUS_COMPONENT 473or a compound constant including it, and 474.Ic hw.acpi.debug.level 475is 476.Dv ACPI_LV_INFO 477or some constant that includes it. 478Finally, it can be noted that the 479.Tn ACPI 480implementation uses the prefix 481.Dv ACPI_DB , 482whereas the debug level 483.Xr sysctl 8 484variable is always specified with the prefix 485.Dv ACPI_LV . 486.Sh SEE ALSO 487.Xr acpiacad 4 , 488.Xr acpibat 4 , 489.Xr acpibut 4 , 490.Xr acpidalb 4 , 491.Xr acpiec 4 , 492.Xr acpilid 4 , 493.Xr acpismbus 4 , 494.Xr acpitz 4 , 495.Xr acpiwmi 4 , 496.Xr aibs 4 , 497.Xr apm 4 , 498.Xr attimer 4 , 499.Xr com 4 , 500.Xr fdc 4 , 501.Xr hpqlb 4 , 502.Xr joy 4 , 503.Xr lpt 4 , 504.Xr mpu 4 , 505.Xr npx 4 , 506.Xr pci 4 , 507.Xr pckbc 4 , 508.Xr pcppi 4 , 509.Xr sony 4 , 510.Xr spic 4 , 511.Xr thinkpad 4 , 512.Xr ug 4 , 513.Xr vald 4 , 514.Xr wb 4 , 515.Xr wss 4 , 516.Xr ym 4 , 517.Xr acpidump 8 , 518.Xr amldb 8 , 519.Xr iasl 8 520.Rs 521.%A Hewlett-Packard Corporation 522.%A Intel Corporation 523.%A Microsoft Corporation 524.%A Phoenix Technologies Ltd. 525.%A Toshiba Corporation 526.%T Advanced Configuration and Power Interface Specification 527.%N Revision 4.0 528.%D June 16, 2009 529.%U http://www.acpi.info/spec.htm 530.Re 531.Rs 532.%A Intel Corporation 533.%T ACPI Component Architecture, 534.%T Programmer Reference, 535.%T OS-Independent Subsystem, Debugger, and Utilities 536.%N Revision 1.27 537.%D January 20, 2010 538.%U http://www.acpica.org/download/acpica-reference.pdf 539.Re 540.Rs 541.%A Joerg Sonnenberger 542.%A Jared D. McNeill 543.%T Sleeping Beauty - NetBSD on Modern Laptops 544.%D February 3, 2008 545.%O Proceedings of AsiaBSDCon 2008 546.%P pp. 127-134 547.Re 548.Sh HISTORY 549The 550.Nm 551driver 552appeared in 553.Nx 1.6 . 554.Sh BUGS 555Most of the 556.Tn ACPI 557power management functionalities are not implemented. 558