1*2e0bf311Sandvar.\" $NetBSD: amldb.8,v 1.8 2021/08/17 22:00:33 andvar Exp $ 253e202c1Schristos.\" ACPI (ACPI Package) 353e202c1Schristos.\" 453e202c1Schristos.\" Copyright (c) 2000 Takanori Watanabe <takawata@FreeBSD.org> 553e202c1Schristos.\" Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org> 653e202c1Schristos.\" Copyright (c) 2000 Yasuo YOKOYAMA <yokoyama@jp.FreeBSD.org> 753e202c1Schristos.\" Copyright (c) 2000 Norihiro KUMAGAI <kumagai@home.com> 853e202c1Schristos.\" 953e202c1Schristos.\" Redistribution and use in source and binary forms, with or without 1053e202c1Schristos.\" modification, are permitted provided that the following conditions 1153e202c1Schristos.\" are met: 1253e202c1Schristos.\" 1. Redistributions of source code must retain the above copyright 1353e202c1Schristos.\" notice, this list of conditions and the following disclaimer. 1453e202c1Schristos.\" 2. Redistributions in binary form must reproduce the above copyright 1553e202c1Schristos.\" notice, this list of conditions and the following disclaimer in the 1653e202c1Schristos.\" documentation and/or other materials provided with the distribution. 1753e202c1Schristos.\" 1853e202c1Schristos.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1953e202c1Schristos.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2053e202c1Schristos.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2153e202c1Schristos.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2253e202c1Schristos.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2353e202c1Schristos.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2453e202c1Schristos.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2553e202c1Schristos.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2653e202c1Schristos.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2753e202c1Schristos.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2853e202c1Schristos.\" SUCH DAMAGE. 2953e202c1Schristos.\" 3053e202c1Schristos.\" $FreeBSD: src/usr.sbin/acpi/amldb/amldb.8,v 1.10 2002/08/13 16:07:26 ru Exp $ 3153e202c1Schristos.\" 3253e202c1Schristos.Dd August 31, 2000 3353e202c1Schristos.Dt AMLDB 8 3453e202c1Schristos.Os 3553e202c1Schristos.Sh NAME 3653e202c1Schristos.Nm amldb 3753e202c1Schristos.Nd executing and debugging AML interpreter 3853e202c1Schristos(with DSDT files) 3953e202c1Schristos.Sh SYNOPSIS 4053e202c1Schristos.Nm 4153e202c1Schristos.Op Fl dhst 4253e202c1Schristos.Ar dsdt_file ... 4353e202c1Schristos.Sh DESCRIPTION 4453e202c1SchristosThe 4553e202c1Schristos.Nm 4653e202c1Schristosutility parses the DSDT 4753e202c1Schristos(Differentiated System Description Table) 4853e202c1Schristosfiles, which usually are acquired from ACPI BIOS, and executes 4953e202c1Schristosthe sequence of ACPI Control Methods described in AML 5053e202c1Schristos(ACPI Machine Language) 5153e202c1Schristoswith its AML interpreter. 5253e202c1SchristosThe 5353e202c1Schristos.Nm 54d23d0c4aSwizutility also has a simple ACPI virtual machine. 55d23d0c4aSwizDuring execution of the 5653e202c1SchristosControl Methods each access to the region, such as 5753e202c1SchristosSystemMemory, SystemIO, PCI_Config, does not affect the real 5853e202c1Schristoshardware but only the virtual machine. 5953e202c1SchristosBecause the sequence of virtual accesses is maintained in user space, 6053e202c1SchristosAML interpreter developers need not worry about any effect on hardware 61d23d0c4aSwizwhen they analyze DSDT data files. 62d23d0c4aSwizThey can develop and debug the 6353e202c1Schristosinterpreter, even if the machine has no ACPI BIOS. 6453e202c1Schristos.Pp 6553e202c1SchristosThe developer will need to acquire a DSDT data file from any machine 6653e202c1Schristoswith ACPI BIOS through 6753e202c1Schristos.Xr acpidump 8 . 6853e202c1SchristosThe DSDT is a table, a part of the whole ACPI memory table 6953e202c1Schristoslocated in somewhere in the BIOS area 7053e202c1Schristos.Pq Li 0xa0000 \- 0x100000 . 7153e202c1SchristosIt includes such information as the detailed hardware information 7253e202c1Schristosfor PnP, and the set of procedures which perform power management from 73d23d0c4aSwizthe OS. 74d23d0c4aSwizThe information is stored in AML format. 7553e202c1Schristos.Pp 7653e202c1SchristosThe AML interpreter can execute any of the Control Methods specified 77d23d0c4aSwizby users. 78d23d0c4aSwizWhen executed, it interprets the byte sequence in the 79d23d0c4aSwizControl Method of DSDT, and disassembles the opcodes that it 8053e202c1Schristosrecognizes into ASL 8153e202c1Schristos(ACPI Source Language) 8253e202c1Schristosformat to be displayed. 8353e202c1Schristos.Pp 8453e202c1SchristosIf it encounters one of more accesses to the region such as 8553e202c1SchristosSystemMemory in executing the Control Methods, its ACPI Virtual 8653e202c1SchristosMachine simulates the input/output operations to the resources in the 87d23d0c4aSwizregion. 88d23d0c4aSwizIn writing to a certain region, the ACPI Virtual Machine 8953e202c1Schristosprepares a piece of memory corresponding to its address, 9053e202c1Schristosif necessary, and holds the specified value in the memory as the 9153e202c1Schristos.Em region contents . 9253e202c1SchristosIn reading from a certain region, it fetches the value in the memory 9353e202c1Schristos.Pq Em region contents , 9453e202c1Schristosprompts with it as the following: 9553e202c1Schristos.Bd -literal -offset indent 9601869ca4SwizDEBUG[read(0, 0x100b6813)&mask:0x1](default: 0x1 / 1) >> 9753e202c1Schristos.Ed 9853e202c1Schristos.Pp 9953e202c1Schristosfor users to have the opportunity to modify it, and hands it to 100d23d0c4aSwizthe AML interpreter. 101d23d0c4aSwizIn case that there is no corresponding region 10253e202c1Schristosin the AML Virtual Machine, the value zero is handed. 10353e202c1Schristos.Pp 10453e202c1SchristosThe interpreter continues to maintain all of the 10553e202c1Schristos.Em region contents 10653e202c1Schristosuntil 10753e202c1Schristos.Nm 108d23d0c4aSwizterminates. 109d23d0c4aSwizYou can specify their initial values with the file 11053e202c1Schristos.Pa region.ini 111d23d0c4aSwizin the current directory. 112d23d0c4aSwizIf it is executed with 11353e202c1Schristos.Fl d 11453e202c1Schristosoption, it dumps the final status of all of its 11553e202c1Schristos.Em region contents 11653e202c1Schristosto the file 11753e202c1Schristos.Pa region.dmp 118d23d0c4aSwizwhen it terminates. 119d23d0c4aSwizEach line of there files consists of the following 12053e202c1Schristosfields, separated by tabs; region type, address, and value. 12153e202c1SchristosRegion types are specified as follows; 12221130793Slukem.Bl -tag -width "Value" -compact -offset indent 12321130793Slukem.It Sy Value 12421130793Slukem.Sy Region type 12521130793Slukem.It 0 12621130793SlukemSystemMemory 12721130793Slukem.It 1 12821130793SlukemSystemIO 12921130793Slukem.It 2 13021130793SlukemPCI_Config 13121130793Slukem.It 3 13221130793SlukemEmbeddedControl 13321130793Slukem.It 4 13421130793SlukemSMBus 13521130793Slukem.El 13653e202c1Schristos.Pp 13753e202c1SchristosInteractive commands are described below: 13853e202c1Schristos.Bl -tag -width indent 13953e202c1Schristos.It Cm s 14053e202c1Schristos.Em Single step : 141d23d0c4aSwizPerforms single-step execution of the current Control Method. 142d23d0c4aSwizIf the next instruction is an invocation of another Control Method, 14353e202c1Schristosthe step execution will continue in the following Control Method. 14453e202c1Schristos.It Cm n 14553e202c1Schristos.Em Step program : 14653e202c1SchristosPerforms single-step execution of the current Control Method. 14753e202c1SchristosEven if the next instruction is an invocation of another Control 14853e202c1SchristosMethod, the step execution will not continue. 14953e202c1Schristos.It Cm c 15053e202c1Schristos.Em Continue program being debugged : 151d23d0c4aSwizResumes execution of the AML interpreter. 152d23d0c4aSwizBecause the current 15353e202c1Schristos.Nm 15453e202c1Schristoshas no way of breakpoint, this command might not so much useful. 15553e202c1Schristos.It Cm q 15653e202c1Schristos.Em Quit method execution : 157d23d0c4aSwizTerminates execution of the current Control Method. 158d23d0c4aSwizIf 15953e202c1Schristos.Nm 16053e202c1Schristosis not in execution, this command causes to input the next 161d23d0c4aSwizDSDT data file. 162d23d0c4aSwizIf there are no next DSDT data files, it terminates 16353e202c1Schristos.Nm 16453e202c1Schristositself. 16553e202c1Schristos.It Cm t 16653e202c1Schristos.Em Show local name space tree and variables : 167d23d0c4aSwizDisplays the structure of the ACPI namespace tree. 168d23d0c4aSwizIf 16953e202c1Schristos.Nm 17053e202c1Schristosis in execution, this command displays the structure that relates 17153e202c1Schristosto the objects, arguments, and local variables below the scope of the 17253e202c1Schristoscurrent Control Method. 17353e202c1Schristos.It Cm i 17453e202c1Schristos.Em Toggle region input prompt : 17553e202c1SchristosSwitches whether the prompt for modifying the value read from the 17653e202c1Schristos.Em region contents 177d23d0c4aSwizbe showed or not. 178d23d0c4aSwizDefault is On. 17953e202c1Schristos.It Cm o 18053e202c1Schristos.Em Toggle region output prompt : 18153e202c1SchristosSwitches whether the prompt for modifying the value to be written 182d23d0c4aSwizto the region contents will be shown or not. 183d23d0c4aSwizThe default is Off. 18453e202c1Schristos.It Cm m 18553e202c1Schristos.Em Show memory management statistics : 18653e202c1SchristosDisplays the current statistics of the memory management system 18753e202c1Schristoson the AML interpreter. 18853e202c1Schristos.It Cm r Ar method 18953e202c1Schristos.Em Run specified method : 190d23d0c4aSwizExecutes the specified Control Method. 191d23d0c4aSwizIf it requires one or 19253e202c1Schristosmore arguments, a prompt such as the following appears; 19353e202c1Schristos.Bd -literal 19453e202c1SchristosMethod: Arg 1 From 0x280626ce To 0x28062775 19553e202c1Schristos Enter argument values (ex. number 1 / string foo). 'q' to quit. 19653e202c1Schristos Arg0 ? 19753e202c1Schristos.Ed 19853e202c1Schristos.Pp 19953e202c1SchristosFor each argument, a pair of type string and value delimited by 200d23d0c4aSwizone or more spaces can be entered. 201d23d0c4aSwizNow only 20253e202c1Schristos.Ic number 20353e202c1Schristosand 20453e202c1Schristos.Ic string 20553e202c1Schristoscan be specified as the type string. 20653e202c1SchristosIn the current implementation, only the first character of the type 20753e202c1Schristosstring, such as 20853e202c1Schristos.Ic n 20953e202c1Schristosor 21053e202c1Schristos.Ic s , 211d23d0c4aSwizis identified. 212d23d0c4aSwizFor example, we can enter as follows: 21353e202c1Schristos.Bd -literal 21453e202c1Schristos Arg0 ? n 1 21553e202c1Schristos.Ed 21653e202c1Schristos.Pp 21753e202c1Schristos.It Cm f Ar string 21853e202c1Schristos.Em Find named objects from namespace : 21953e202c1SchristosLists the named objects that includes the specified string as the 220d23d0c4aSwizterminate elements searching from the ACPI namespace. 221d23d0c4aSwizFor the namespace is expressed as the sequence of four-character 222d23d0c4aSwizelements, appropriate number of additional underscore 22353e202c1Schristos.Pq Ql _ 22453e202c1Schristoscharacters are necessary for specifying objects which have less than four 225d23d0c4aSwizcharacter string. 226d23d0c4aSwizUnless additional underscores specified, matching 22753e202c1Schristosoccurs as the beginning of word with the specified number of characters. 22853e202c1Schristos.It Cm h 229*2e0bf311Sandvar.Em Show help message : 23053e202c1SchristosDisplays the command summary of 23153e202c1Schristos.Nm . 23253e202c1Schristos.El 23353e202c1Schristos.Sh OPTIONS 234d23d0c4aSwizExactly one of the following options must be specified. 235d23d0c4aSwizOtherwise, 23653e202c1Schristos.Nm 23753e202c1Schristosshows its usage and terminates. 23853e202c1Schristos.Bl -tag -width indent 23953e202c1Schristos.It Fl d 24053e202c1SchristosDump the final status of all of the 24153e202c1Schristos.Em region contents 24253e202c1Schristosin the ACPI Virtual Machine to the file 24353e202c1Schristos.Pa region.dmp . 24453e202c1Schristos.It Fl h 24553e202c1SchristosTerminate with the usage of this command. 24653e202c1Schristos.It Fl s 24753e202c1SchristosDisplay the statistics of the memory management system on the 24853e202c1SchristosAML interpreter when 24953e202c1Schristos.Nm 25053e202c1Schristosterminates. 25153e202c1Schristos.It Fl t 25253e202c1SchristosDisplay the tree structure of ACPI namespace after the 25353e202c1SchristosDSDT data file is read. 25453e202c1Schristos.El 255d23d0c4aSwiz.Sh FILES 256d23d0c4aSwiz.Bl -tag -width region.ini -compact 257d23d0c4aSwiz.It Pa region.ini 258d23d0c4aSwiz.It Pa region.dmp 259d23d0c4aSwiz.El 26053e202c1Schristos.Sh EXAMPLES 26153e202c1SchristosThe following is an example including, invoking the 26253e202c1Schristos.Nm , 26353e202c1Schristossearching 26453e202c1Schristos.Li _PRS 26553e202c1Schristos(Possible Resource Settings) 26653e202c1Schristosobjects, and executing the 26753e202c1Schristos.Li _PTS 26853e202c1Schristos(Prepare To Sleep) 26953e202c1SchristosControl Method by the AML interpreter. 27053e202c1Schristos.Bd -literal -offset indent 27153e202c1Schristos% amldb p2b.dsdt.dat 27253e202c1SchristosLoading p2b.dsdt.dat...done 27301869ca4SwizAML>f _PRS 27453e202c1Schristos\\_SB_.PCI0.ISA_.PS2M._PRS. 27553e202c1Schristos\\_SB_.PCI0.ISA_.IRDA._PRS. 27653e202c1Schristos\\_SB_.PCI0.ISA_.UAR2._PRS. 27753e202c1Schristos\\_SB_.PCI0.ISA_.UAR1._PRS. 27853e202c1Schristos\\_SB_.PCI0.ISA_.ECP_._PRS. 27953e202c1Schristos\\_SB_.PCI0.ISA_.LPT_._PRS. 28053e202c1Schristos\\_SB_.PCI0.ISA_.FDC0._PRS. 28153e202c1Schristos\\_SB_.LNKD._PRS. 28253e202c1Schristos\\_SB_.LNKC._PRS. 28353e202c1Schristos\\_SB_.LNKB._PRS. 28453e202c1Schristos\\_SB_.LNKA._PRS. 28501869ca4SwizAML>r _PTS 28653e202c1SchristosMethod: Arg 1 From 0x2805f0a3 To 0x2805f0db 28753e202c1Schristos Enter argument values (ex. number 1 / string foo). 'q' to quit. 28853e202c1Schristos Arg0 ? n 5 28953e202c1Schristos==== Running _PTS. ==== 29001869ca4SwizAML>s 29113ed0794Sjoerg[\\_PTS. START] 29253e202c1SchristosIf(LNot(LEqual(Arg0, 0x5))) 29301869ca4SwizAML> 29453e202c1SchristosIf(LEqual(Arg0, 0x1)) 29501869ca4SwizAML> 29653e202c1SchristosIf(LEqual(Arg0, 0x2)) 29701869ca4SwizAML> 29853e202c1SchristosStore(One, TO12) 29953e202c1Schristos[aml_region_write(1, 1, 0x1, 0xe42c, 0x18, 0x1)] 30053e202c1Schristosamldb: region.ini: No such file or directory 30101869ca4Swiz [1:0x00@0xe42f]->[1:0x01@0xe42f] 30253e202c1Schristos[write(1, 0x1, 0xe42f)] 30353e202c1Schristos[aml_region_read(1, 1, 0xe42c, 0x18, 0x1)] 30453e202c1Schristos [1:0x01@0xe42f] 30501869ca4SwizDEBUG[read(1, 0xe42f)&mask:0x1](default: 0x1 / 1) >> 30601869ca4Swiz[read(1, 0xe42f)->0x1] 30701869ca4SwizAML> 30853e202c1SchristosOr(Arg0, 0xf0, Local2)[Copy number 0xf5] 30901869ca4SwizAML>t 31053e202c1Schristos_PTS Method: Arg 1 From 0x2805f0a3 To 0x2805f0db 31153e202c1Schristos Arg0 Num:0x5 31253e202c1Schristos Local2 Num:0xf5 31301869ca4SwizAML>s 31453e202c1SchristosStore(Local2, DBG1) 31553e202c1Schristos[aml_region_write(1, 1, 0xf5, 0x80, 0x0, 0x8)] 31601869ca4Swiz [1:0x00@0x80]->[1:0xf5@0x80] 31753e202c1Schristos[write(1, 0xf5, 0x80)] 31853e202c1Schristos[aml_region_read(1, 1, 0x80, 0x0, 0x8)] 31953e202c1Schristos [1:0xf5@0x80] 32001869ca4SwizDEBUG[read(1, 0x80)&mask:0xf5](default: 0xf5 / 245) >> 32101869ca4Swiz[read(1, 0x80)->0xf5] 32201869ca4SwizAML> 32313ed0794Sjoerg[\\_PTS. END] 32453e202c1Schristos_PTS Method: Arg 1 From 0x2805f0a3 To 0x2805f0db 32553e202c1SchristosNO object 32653e202c1Schristos==== _PTS finished. ==== 32701869ca4SwizAML>q 32853e202c1Schristos% 32953e202c1Schristos.Ed 33053e202c1Schristos.Sh SEE ALSO 33153e202c1Schristos.Xr acpi 4 , 332d23d0c4aSwiz.\" .Xr acpiconf 8 , 33353e202c1Schristos.Xr acpidump 8 334d23d0c4aSwiz.Sh HISTORY 335d23d0c4aSwizThe 336d23d0c4aSwiz.Nm 337d23d0c4aSwizutility appeared in 338d23d0c4aSwiz.Fx 5.0 . 33953e202c1Schristos.Sh AUTHORS 340a5684d07Swiz.An Takanori Watanabe Aq Mt takawata@FreeBSD.org 341a5684d07Swiz.An Mitsuru IWASAKI Aq Mt iwasaki@FreeBSD.org 342a5684d07Swiz.An Yasuo YOKOYAMA Aq Mt yokoyama@jp.FreeBSD.org 34353e202c1Schristos.Pp 34453e202c1SchristosSome contributions made by 345a5684d07Swiz.An Chitoshi Ohsawa Aq Mt ohsawa@catv1.ccn-net.ne.jp , 346a5684d07Swiz.An Takayasu IWANASHI Aq Mt takayasu@wendy.a.perfect-liberty.or.jp , 347a5684d07Swiz.An Norihiro KUMAGAI Aq Mt kumagai@home.com , 348a5684d07Swiz.An Kenneth Ingham Aq Mt ingham@I-pi.com , 34953e202c1Schristosand 350a5684d07Swiz.An Michael Lucas Aq Mt mwlucas@blackhelicopters.org . 351d23d0c4aSwiz.Sh BUGS 352d23d0c4aSwizThe ACPI virtual machine does not completely simulate the behavior 353d23d0c4aSwizof a machine with an ACPI BIOS. 354d23d0c4aSwizIn the current implementation, the 355d23d0c4aSwizACPI virtual machine only reads or writes the stored values by 356d23d0c4aSwizemulating access to regions such as SystemMemory. 357d23d0c4aSwiz.Pp 358d23d0c4aSwizBecause the AML interpreter interprets and disassembles 359d23d0c4aSwizsimultaneously, it is impossible to implement such features as setting 360d23d0c4aSwizbreakpoints with the specified line number in ASL. 361d23d0c4aSwizSetting breakpoints 362d23d0c4aSwizat certain Control Methods, which is not very difficult, has not 363d23d0c4aSwizyet implemented because nobody has ever needed it. 364